summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-12-23 11:30:31 -0800
committerNatiq Ahmed <mnatiq@codeaurora.org>2015-03-13 15:00:39 +0530
commite59aaea70a08f1fecb3d86d794b0bf65e1846046 (patch)
tree8b04d5a916a08f1694ad9d546da60ff7aeae29f5
parentae0f68139f38fc8634db17345d71dd1523f44480 (diff)
downloadandroid_packages_apps_Dialer-e59aaea70a08f1fecb3d86d794b0bf65e1846046.tar.gz
android_packages_apps_Dialer-e59aaea70a08f1fecb3d86d794b0bf65e1846046.tar.bz2
android_packages_apps_Dialer-e59aaea70a08f1fecb3d86d794b0bf65e1846046.zip
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
-rw-r--r--src/com/android/dialer/calllog/ClearCallLogDialog.java6
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 33476e773..ec28aec62 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;
@@ -57,6 +58,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) {
@@ -69,7 +71,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;
}