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

Commit 501aef3c authored by Andy Mast's avatar Andy Mast
Browse files

Themes: Map themed icon to app after upgrade

Before this patch, applying an icon theme and then upgrading an app would
cause the app to lose its themed icon.

Change-Id: Ia76a33d0fb731720aa735e9dd9596bc5d2e75d9f
(cherry picked from commit 88a5574d)
parent 8c2e9f99
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -4976,6 +4976,13 @@ public class PackageManagerService extends IPackageManager.Stub {
            }
            // Add the new setting to mSettings
            mSettings.insertPackageSettingLPw(pkgSetting, pkg);
            // Themes: handle case where app was installed after icon mapping applied
            if (mIconPackHelper != null) {
                int id = mIconPackHelper.getResourceIdForApp(pkg.packageName);
                pkg.applicationInfo.themedIcon = id;
            }
            // Add the new setting to mPackages
            mPackages.put(pkg.applicationInfo.packageName, pkg);
            // Make sure we don't accidentally delete its data.
@@ -5129,6 +5136,13 @@ public class PackageManagerService extends IPackageManager.Stub {
                PackageParser.Activity a = pkg.activities.get(i);
                a.info.processName = fixProcessName(pkg.applicationInfo.processName,
                        a.info.processName, pkg.applicationInfo.uid);
                // Themes: handle case where app was installed after icon mapping applied
                if (mIconPackHelper != null) {
                    a.info.themedIcon = mIconPackHelper
                            .getResourceIdForActivityIcon(a.info);
                }
                mActivities.addActivity(a, "activity");
                if ((parseFlags&PackageParser.PARSE_CHATTY) != 0) {
                    if (r == null) {
@@ -12285,6 +12299,7 @@ public class PackageManagerService extends IPackageManager.Stub {
    }
    private void clearIconMapping() {
        mIconPackHelper = null;
        for (Activity activity : mActivities.mActivities.values()) {
            activity.info.themedIcon = 0;
        }