summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2015-09-14 12:51:17 -0700
committerJay Shrauner <shrauner@google.com>2015-09-14 12:54:12 -0700
commit9eca34ff60a7928eee8727277f9cf16a087d1f46 (patch)
treeb330c8371a4b8f629ed7c4ae560cb9a525fd6a1b
parent84f6633fc2ffef805a36b7516f27ee9236fcbd1f (diff)
Fix IllegalStateException in showDiambigDialogue
Check to make sure the activity is still running before showing the disambiguation dialogue Bug:24064251 Change-Id: Icf48434164e2aa9e5d89b71f637456f0f6c2b1b4
-rw-r--r--src/com/android/dialer/interactions/PhoneNumberInteraction.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/dialer/interactions/PhoneNumberInteraction.java b/src/com/android/dialer/interactions/PhoneNumberInteraction.java
index 6e218c025..601a9c77c 100644
--- a/src/com/android/dialer/interactions/PhoneNumberInteraction.java
+++ b/src/com/android/dialer/interactions/PhoneNumberInteraction.java
@@ -521,7 +521,17 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> {
@VisibleForTesting
/* package */ void showDisambiguationDialog(ArrayList<PhoneItem> phoneList) {
- PhoneDisambiguationDialogFragment.show(((Activity)mContext).getFragmentManager(),
- phoneList, mInteractionType, mCallOrigin);
+ final Activity activity = (Activity) mContext;
+ if (activity.isDestroyed()) {
+ // Check whether the activity is still running
+ return;
+ }
+ try {
+ PhoneDisambiguationDialogFragment.show(activity.getFragmentManager(),
+ phoneList, mInteractionType, mCallOrigin);
+ } catch (IllegalStateException e) {
+ // ignore to be safe. Shouldn't happen because we checked the
+ // activity wasn't destroyed, but to be safe.
+ }
}
}