From e5f1d24913e4925a329c107d8dce38abec490358 Mon Sep 17 00:00:00 2001 From: Jason Chiu Date: Wed, 8 Dec 2021 11:01:26 +0800 Subject: [PATCH] Do not show the redundant RemoveAccountFailureDialog When the AccountManager's confirm remove dialog is canceled, a redundant ConfirmRemoveAccountDialog showed up. - Only show the dialog when a real error reported from AccountManager - Also change RemoveAccountFailureDialog's title to remove the redundant question mark Fix: 204948166 Test: manual Change-Id: If712e120938e80e1bf4593fa78a1a2a70684fc2a --- .../accounts/RemoveAccountPreferenceController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/accounts/RemoveAccountPreferenceController.java b/src/com/android/settings/accounts/RemoveAccountPreferenceController.java index 037f5846a88..2ce22061907 100644 --- a/src/com/android/settings/accounts/RemoveAccountPreferenceController.java +++ b/src/com/android/settings/accounts/RemoveAccountPreferenceController.java @@ -53,6 +53,7 @@ import java.io.IOException; public class RemoveAccountPreferenceController extends AbstractPreferenceController implements PreferenceControllerMixin, OnClickListener { + private static final String TAG = "RemoveAccountPrefController"; private static final String KEY_REMOVE_ACCOUNT = "remove_account"; private final MetricsFeatureProvider mMetricsFeatureProvider; @@ -175,10 +176,11 @@ public class RemoveAccountPreferenceController extends AbstractPreferenceControl | IOException | AuthenticatorException e) { // handled below - } - if (failed) { + Log.w(TAG, "Remove account error: " + e); RemoveAccountFailureDialog.show(getTargetFragment()); - } else { + } + Log.i(TAG, "failed: " + failed); + if (!failed) { targetActivity.finish(); } }, null, mUserHandle); @@ -210,7 +212,7 @@ public class RemoveAccountPreferenceController extends AbstractPreferenceControl final Context context = getActivity(); return new AlertDialog.Builder(context) - .setTitle(R.string.really_remove_account_title) + .setTitle(R.string.remove_account_label) .setMessage(R.string.remove_account_failed) .setPositiveButton(android.R.string.ok, null) .create();