diff options
author | Yorke Lee <yorkelee@google.com> | 2014-12-23 11:30:31 -0800 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-12-23 11:34:30 -0800 |
commit | 56e15541106a28a1cf03088a6cef7dab9dc3a8c3 (patch) | |
tree | 61de07f6a863c228f9fa02b3e04595e284a268bc /src | |
parent | fa584b69a579523c9df0e7ec1ea7748587821014 (diff) |
Fix for clear call log dialog not being dismissed
This CL fixes a bug that could result in the progress dialog
that appears when clearing call logs to never be dismissed.
The cause of this bug is a race condition that causes
the original dialog fragment to be detached from the parent activity
before the progress dialog is dismissed.
If that happens, the progress dialog is never dismissed and stays
on screen forever. This CL fixes this by assigning the activity to
the dialog explicitly and retrieving it when trying to dismiss it.
Bug: 18836384
Change-Id: I5f8941e13dc7eb962b23e828cf47bc64f2b1a2aa
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/ClearCallLogDialog.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/ClearCallLogDialog.java b/src/com/android/dialer/calllog/ClearCallLogDialog.java index f4c75d10d..bef5010ec 100644 --- a/src/com/android/dialer/calllog/ClearCallLogDialog.java +++ b/src/com/android/dialer/calllog/ClearCallLogDialog.java @@ -16,6 +16,7 @@ package com.android.dialer.calllog; +import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; @@ -56,6 +57,7 @@ public class ClearCallLogDialog extends DialogFragment { final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), getString(R.string.clearCallLogProgress_title), "", true, false); + progressDialog.setOwnerActivity(getActivity()); final AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { @@ -67,7 +69,9 @@ public class ClearCallLogDialog extends DialogFragment { } @Override protected void onPostExecute(Void result) { - if (getActivity() == null || getActivity().isDestroyed()) { + final Activity activity = progressDialog.getOwnerActivity(); + + if (activity == null || activity.isDestroyed() || activity.isFinishing()) { return; } |