Settings: Fix loading iconpack-based Wellbeing icon

Wellbeing apk still provides Android 11 style settings icon
when an icon pack is set. It consists of a layer-list with
circle shape and drawable, so fetch the drawable to make
it work with Android 12 settings.

Change-Id: I78be2db9dc8ca262e61fdb13b93da007c3a6eb81
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
This commit is contained in:
Adithya R
2022-05-30 02:15:47 +05:30
committed by Joey
parent 540bf3b652
commit e76c1716dc

View File

@@ -96,6 +96,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
private static final String DASHBOARD_TILE_PREF_KEY_PREFIX = "dashboard_tile_pref_";
private static final String META_DATA_KEY_INTENT_ACTION = "com.android.settings.intent.action";
private static final String TOP_LEVEL_ACCOUNT_CATEGORY = "top_level_account_category";
private static final String WELLBEING_PACKAGE = "com.google.android.apps.wellbeing";
private static final Map<String, Pair<Integer, Integer>> COLOR_SCHEMES = ImmutableMap.of(
"blue_variant", new Pair<>(
@@ -486,6 +487,11 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
return;
}
}
if (iconPackage.equals(WELLBEING_PACKAGE) && iconDrawable instanceof LayerDrawable
&& ((LayerDrawable) iconDrawable).getDrawable(1) != null) {
iconDrawable = ((LayerDrawable) iconDrawable).getDrawable(1);
iconDrawable.mutate();
}
iconDrawable.setTint(Utils.getHomepageIconColor(preference.getContext()));
}