@Override
  public void onBackPressed() {
    Log.i(this, "onBackPressed");

    // BACK is also used to exit out of any "special modes" of the
    // in-call UI:

    if (!mConferenceManagerFragment.isVisible() && !mCallCardFragment.isVisible()) {
      return;
    }

    if (mDialpadFragment != null && mDialpadFragment.isVisible()) {
      mCallButtonFragment.displayDialpad(false /* show */, true /* animate */);
      return;
    } else if (mConferenceManagerFragment.isVisible()) {
      showConferenceCallManager(false);
      return;
    }

    // Always disable the Back key while an incoming call is ringing
    final Call call = CallList.getInstance().getIncomingCall();
    if (call != null) {
      Log.d(this, "Consume Back press for an incoming call");
      return;
    }

    // Nothing special to do.  Fall back to the default behavior.
    super.onBackPressed();
  }
  @Override
  protected void onResume() {
    Log.i(this, "onResume()...");
    super.onResume();

    mIsForegroundActivity = true;

    InCallPresenter.getInstance().setThemeColors();
    InCallPresenter.getInstance().onUiShowing(true);

    if (mShowDialpadRequested) {
      mCallButtonFragment.displayDialpad(true /* show */, mAnimateDialpadOnShow /* animate */);
      mShowDialpadRequested = false;
      mAnimateDialpadOnShow = false;

      if (mDialpadFragment != null) {
        mDialpadFragment.setDtmfText(mDtmfText);
        mDtmfText = null;
      }
    }

    if (mShowPostCharWaitDialogOnResume) {
      showPostCharWaitDialog(mShowPostCharWaitDialogCallId, mShowPostCharWaitDialogChars);
    }
  }
 /**
  * Simulates a user click to hide the dialpad. This will update the UI to show the call card,
  * update the checked state of the dialpad button, and update the proximity sensor state.
  */
 public void hideDialpadForDisconnect() {
   mCallButtonFragment.displayDialpad(false /* show */, true /* animate */);
 }