Fix the icon flash issue cause from the shared drawable icon am: a3b89868f4 am: e44128f021

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15802168

Change-Id: If1a9387932316ff3b4addea1075d8d69853d38dc
This commit is contained in:
ykhung
2021-09-11 00:24:09 +00:00
committed by Automerger Merge Worker

View File

@@ -113,7 +113,7 @@ public class BatteryDiffEntry {
/** Gets the app icon {@link Drawable} for this entry. */ /** Gets the app icon {@link Drawable} for this entry. */
public Drawable getAppIcon() { public Drawable getAppIcon() {
loadLabelAndIcon(); loadLabelAndIcon();
return mAppIcon; return mAppIcon.getConstantState().newDrawable();
} }
/** Gets the app icon id for this entry. */ /** Gets the app icon id for this entry. */
@@ -348,8 +348,8 @@ public class BatteryDiffEntry {
private Drawable getBadgeIconForUser(Drawable icon) { private Drawable getBadgeIconForUser(Drawable icon) {
final int userId = UserHandle.getUserId((int) mBatteryHistEntry.mUid); final int userId = UserHandle.getUserId((int) mBatteryHistEntry.mUid);
final UserHandle userHandle = new UserHandle(userId); return userId == UserHandle.USER_OWNER ? icon :
return mUserManager.getBadgedIconForUser(icon, userHandle); mUserManager.getBadgedIconForUser(icon, new UserHandle(userId));
} }
private static boolean isSystemUid(int uid) { private static boolean isSystemUid(int uid) {