Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3b89868 authored by ykhung's avatar ykhung Committed by YUKAI HUNG
Browse files

Fix the icon flash issue cause from the shared drawable icon

different time slot may have the same application entry, we should not make them share the same drawable instance to impact the states, we will use newDrawable() method to create a new one for each application entry

Bug: 198553245
Test: make SettingsRoboTests
Change-Id: I4a321133ba171817fca1ab7ad47b9af8f7450675
parent b62cdecc
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -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) {