diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-11-18 06:38:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-11-18 06:38:53 +0000 |
commit | 04a21f6195203227fb102dc55b3eb88b89e9c232 (patch) | |
tree | 0dd52d74168530e4f088c354d2ab3db679388f96 /java/com/android/dialer/interactions/PhoneNumberInteraction.java | |
parent | 4c7f551810ffd84cf59ddbfbc1f7694344f6b26f (diff) | |
parent | 6d87dbcb3843d6c5adf5f6d82e4fd00cba6dd8e5 (diff) |
Merge "Fix crash caused by opening dialogs with a dead activity"
Diffstat (limited to 'java/com/android/dialer/interactions/PhoneNumberInteraction.java')
-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(), |