From e31fcb6dda510746baf2241c3dd78d2df9ef3a4f Mon Sep 17 00:00:00 2001 From: Mill Chen Date: Mon, 15 Jun 2020 18:01:53 +0800 Subject: [PATCH] Avoid double-badging application icon in the dialog When creating a confirmation dialog for removing work profile, it will fetch an icon from ApplicationInfo and badge the icon. However, the cases of double-badging icon are happening in the some devices with higher density, which means the icon has already had a badge after getting it from ApplicationInfo. So this change attempts to directly use the icon. Bug: 148137991 Test: visual, manual 1. Install Test DPC from Play Store 2. Setup work profile 3. Settings -> Security -> Device admin apps 4. Click Test DPC item which has the badged icon -> Remove work profile 5. Observe the icon of the confirmation dialog Change-Id: I126bb799e37e168fb5fbc76107c0c897a6be2f9a --- src/com/android/settings/users/UserDialogs.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/android/settings/users/UserDialogs.java b/src/com/android/settings/users/UserDialogs.java index 0fb96369ef3..9aab5b03da1 100644 --- a/src/com/android/settings/users/UserDialogs.java +++ b/src/com/android/settings/users/UserDialogs.java @@ -92,8 +92,7 @@ public final class UserDialogs { View view = inflater.inflate(R.layout.delete_managed_profile_dialog, null); ImageView imageView = (ImageView) view.findViewById(R.id.delete_managed_profile_mdm_icon_view); - Drawable badgedApplicationIcon = packageManager.getUserBadgedIcon( - packageManager.getApplicationIcon(mdmApplicationInfo), new UserHandle(userId)); + Drawable badgedApplicationIcon = packageManager.getApplicationIcon(mdmApplicationInfo); imageView.setImageDrawable(badgedApplicationIcon); CharSequence appLabel = packageManager.getApplicationLabel(mdmApplicationInfo);