From da06cec1734d9fd1360fdade3756e8e1db395587 Mon Sep 17 00:00:00 2001 From: Yanting Yang Date: Thu, 10 Jun 2021 23:20:38 +0800 Subject: [PATCH] Improve flicker when enter Security page The flicker preferences are injected from external apps and the text shifting is due to it needing time to load the icon from the content uri. To avoid flicker, put a transparent icon as default to wait for icon update. Fixes: 189165518 Test: robotests & visual Change-Id: I727eeefd5455711a53d3fd9ccd5356a15b9daae4 --- .../settings/dashboard/DashboardFeatureProviderImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java index 0de86f5b668..a03a4f9b301 100644 --- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java @@ -360,6 +360,11 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { // Icon provided by the content provider overrides any static icon. if (tile.getMetaData() != null && tile.getMetaData().containsKey(META_DATA_PREFERENCE_ICON_URI)) { + // Set a transparent color before starting to fetch the real icon, this is necessary + // to avoid preference padding change. + setPreferenceIcon(preference, tile, forceRoundedIcon, mContext.getPackageName(), + Icon.createWithResource(mContext, android.R.color.transparent)); + ThreadUtils.postOnBackgroundThread(() -> { final Intent intent = tile.getIntent(); String packageName = null;