diff options
author | maxwelb <maxwelb@google.com> | 2017-11-18 06:44:52 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-11-18 06:44:52 +0000 |
commit | 09d05f87e732cbd85bb9d455b9fc1a61adafd3de (patch) | |
tree | 0dd52d74168530e4f088c354d2ab3db679388f96 | |
parent | 27686da6fe8f2fb804f3e3d46db27ee5265d6b29 (diff) | |
parent | 04a21f6195203227fb102dc55b3eb88b89e9c232 (diff) |
Merge "Fix crash caused by opening dialogs with a dead activity"
am: 04a21f6195
Change-Id: I72dc6989a3f47d15e6545be859e5f1ecd8923f0c
-rw-r--r-- | java/com/android/dialer/interactions/PhoneNumberInteraction.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/java/com/android/dialer/interactions/PhoneNumberInteraction.java b/java/com/android/dialer/interactions/PhoneNumberInteraction.java index 15c6ce899..5a6c34607 100644 --- a/java/com/android/dialer/interactions/PhoneNumberInteraction.java +++ b/java/com/android/dialer/interactions/PhoneNumberInteraction.java @@ -82,7 +82,7 @@ import java.util.List; */ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { - private static final String TAG = PhoneNumberInteraction.class.getSimpleName(); + static final String TAG = PhoneNumberInteraction.class.getSimpleName(); /** The identifier for a permissions request if one is generated. */ public static final int REQUEST_READ_CONTACTS = 1; @@ -356,12 +356,19 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } private void showDisambiguationDialog(ArrayList<PhoneItem> phoneList) { + // TODO(a bug): don't leak the activity final Activity activity = (Activity) mContext; + if (activity.isFinishing()) { + LogUtil.i("PhoneNumberInteraction.showDisambiguationDialog", "activity finishing"); + return; + } + if (activity.isDestroyed()) { // Check whether the activity is still running LogUtil.i("PhoneNumberInteraction.showDisambiguationDialog", "activity destroyed"); return; } + try { PhoneDisambiguationDialogFragment.show( activity.getFragmentManager(), |