@Override
  public void onPause() {
    super.onPause();
    MyAccessibilityService talkBackService = MyAccessibilityService.getInstance();
    if (talkBackService != null && talkBackService.supportsTouchScreen()) {
      getContentResolver().unregisterContentObserver(mTouchExploreObserver);
    }

    if (mExploreByTouchDialog != null) {
      mExploreByTouchDialog.dismiss();
    }

    if (mTreeDebugDialog != null) {
      mTreeDebugDialog.dismiss();
    }
  }
  @Override
  public void onResume() {
    super.onResume();
    MyAccessibilityService talkBackService = MyAccessibilityService.getInstance();
    if (talkBackService != null && talkBackService.supportsTouchScreen()) {
      registerTouchSettingObserver();
    }

    if (mExploreByTouchDialog != null) {
      mExploreByTouchDialog.show();
    }

    if (mTreeDebugDialog != null) {
      mTreeDebugDialog.show();
    }

    updateTalkBackShortcutStatus();
    updateDimingPreferenceStatus();
  }