Check if dialpad is already open when handleing new intents.

If the user had the dialpad open when they received a call, they could
potentially crash dialer if they pressed add call or clicked on a phone number
in another app.

Bug: 74711879
Test: manual
PiperOrigin-RevId: 189371425
Change-Id: I14df55e2467be07dd30e3971004e601216f57daf
diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java
index a614c70..46f6a90 100644
--- a/java/com/android/dialer/main/impl/MainSearchController.java
+++ b/java/com/android/dialer/main/impl/MainSearchController.java
@@ -110,6 +110,15 @@
   /** Should be called if we're showing the dialpad because of a new ACTION_DIAL intent. */
   public void showDialpadFromNewIntent() {
     LogUtil.enterBlock("MainSearchController.showDialpadFromNewIntent");
+    if (isDialpadVisible()) {
+      // One scenario where this can happen is if the user has the dialpad open when the receive a
+      // call and press add call in the in call ui which calls this method.
+      LogUtil.i("MainSearchController.showDialpadFromNewIntent", "Dialpad is already visible.");
+
+      // Mark started from new intent in case there is a phone number in the intent
+      getDialpadFragment().setStartedFromNewIntent(true);
+      return;
+    }
     showDialpad(/* animate=*/ false, /* fromNewIntent=*/ true);
   }