Merge "Clone profile badge resolution in settings." into udc-dev am: f45ad6f512

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21547684

Change-Id: Ib0fe219775a648c058551ac7ab8a0be9cc5e3340
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Himanshu Gupta
2023-02-27 15:42:26 +00:00
committed by Automerger Merge Worker

View File

@@ -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);
}
}