From 491c34e7272f6c29d61d8c37b2c130167e6a3fff Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Mon, 13 Feb 2023 11:06:57 +0000 Subject: Clone profile badge resolution in settings. Adds the mechanism to allow iconLoader library resolve badges for clone profile alongside work profile. Bug: 266177840 Test: Manually flashing and checking settings. Change-Id: I8c5814d165a440574d3728cb552d48af07901a86 --- packages/SettingsLib/src/com/android/settingslib/Utils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'packages/SettingsLib/src') diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java index 888b09fafd3b..e846480f68d9 100644 --- a/packages/SettingsLib/src/com/android/settingslib/Utils.java +++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java @@ -575,9 +575,15 @@ public class Utils { /** Get the corresponding adaptive icon drawable. */ public static Drawable getBadgedIcon(Context context, Drawable icon, UserHandle user) { + UserManager um = context.getSystemService(UserManager.class); + boolean isClone = um.getProfiles(user.getIdentifier()).stream() + .anyMatch(profile -> + profile.isCloneProfile() && profile.id == user.getIdentifier()); try (IconFactory iconFactory = IconFactory.obtain(context)) { return iconFactory - .createBadgedIconBitmap(icon, new IconOptions().setUser(user)) + .createBadgedIconBitmap( + icon, + new IconOptions().setUser(user).setIsCloneProfile(isClone)) .newIcon(context); } } -- cgit v1.2.3-59-g8ed1b