From f0d8071bc613aec4c4996a5cd2af4f1f5396d8fe Mon Sep 17 00:00:00 2001 From: Ahaan Ugale Date: Mon, 28 Jun 2021 23:15:28 -0700 Subject: [PATCH] Password settings: Fix UI flicker from loading summary Adds a placeholder summary string so the UI doesn't shift when the summary is updated. Also disables debug logging. Fix: 191939601 Test: manual Change-Id: If6027f101a6bad022501f7ba6c6ab576341f0ce4 --- .../autofill/PasswordsPreferenceController.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java b/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java index 8e43853e21a..7cbbf6db4d1 100644 --- a/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java +++ b/src/com/android/settings/applications/autofill/PasswordsPreferenceController.java @@ -67,6 +67,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class PasswordsPreferenceController extends BasePreferenceController implements LifecycleObserver { private static final String TAG = "AutofillSettings"; + private static final boolean DEBUG = false; private final PackageManager mPm; private final IconDrawableFactory mIconFactory; @@ -128,6 +129,8 @@ public class PasswordsPreferenceController extends BasePreferenceController pref.setIntent( new Intent(Intent.ACTION_MAIN) .setClassName(serviceInfo.packageName, service.getPasswordsActivity())); + // Set an empty summary to avoid a UI flicker when the value loads. + pref.setSummary(R.string.summary_placeholder); final MutableLiveData passwordCount = new MutableLiveData<>(); passwordCount.observe( @@ -172,15 +175,18 @@ public class PasswordsPreferenceController extends BasePreferenceController @Override public void onServiceConnected(ComponentName name, IBinder service) { final IAutoFillService autofillService = IAutoFillService.Stub.asInterface(service); - // TODO check if debug is logged on user build. - Log.d(TAG, "Fetching password count from " + name); + if (DEBUG) { + Log.d(TAG, "Fetching password count from " + name); + } try { autofillService.onSavedPasswordCountRequest( new IResultReceiver.Stub() { @Override public void send(int resultCode, Bundle resultData) { - Log.d(TAG, "Received password count result " + resultCode - + " from " + name); + if (DEBUG) { + Log.d(TAG, "Received password count result " + resultCode + + " from " + name); + } if (resultCode == 0 && resultData != null) { mData.postValue(resultData.getInt(EXTRA_RESULT)); }