public void dismissPendingDialogs() {
   if (mDialog != null) {
     mDialog.dismiss();
     mDialog = null;
   }
   mAnswerFragment.dismissPendingDialogues();
 }
  /**
   * Dismisses the in-call screen.
   *
   * <p>We never *really* finish() the InCallActivity, since we don't want to get destroyed and then
   * have to be re-created from scratch for the next call. Instead, we just move ourselves to the
   * back of the activity stack.
   *
   * <p>This also means that we'll no longer be reachable via the BACK button (since
   * moveTaskToBack() puts us behind the Home app, but the home app doesn't allow the BACK key to
   * move you any farther down in the history stack.)
   *
   * <p>(Since the Phone app itself is never killed, this basically means that we'll keep a single
   * InCallActivity instance around for the entire uptime of the device. This noticeably improves
   * the UI responsiveness for incoming calls.)
   */
  @Override
  public void finish() {
    Log.i(this, "finish().  Dialog showing: " + (mDialog != null));

    // skip finish if we are still showing a dialog.
    if (!hasPendingErrorDialog() && !mAnswerFragment.hasPendingDialogs()) {
      super.finish();
    }
  }