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

Commit 400b4758 authored by d34d's avatar d34d Committed by Steve Kondik
Browse files

Themes: Use mRealPackage, when available, for idmapping

Some packages replace existing apps and take on their package name,
i.e. com.cyanogenmod.trebuchet -> com.android.launcher3.  When this
happens pkg.packageName becomes the name of the package it is
overriding and mRealPackage will be the original package name.

Because it is possible for the resources in the new package to not
match up with the package it replaced, we need to perform the idmap
using the original package name.

Change-Id: Ic22c7005274ae5c4ea29d9a4b29f9b9f40719e68
parent 4cbe27b0
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -4235,7 +4235,11 @@ public class PackageManagerService extends IPackageManager.Stub {
                    opkg.baseCodePath + ": overlay not trusted");
                    opkg.baseCodePath + ": overlay not trusted");
            return false;
            return false;
        }
        }
        ArrayMap<String, PackageParser.Package> overlaySet = mOverlays.get(pkg.packageName);
        // Some apps like to take on the package name of an existing app so we'll use the
        // "real" package name, if it is non-null, when performing the idmap
        final String pkgName = pkg.mRealPackage != null ? pkg.mRealPackage : pkg.packageName;
        ArrayMap<String, PackageParser.Package> overlaySet = mOverlays.get(pkgName);
        if (overlaySet == null) {
        if (overlaySet == null) {
            Slog.e(TAG, "was about to create idmap for " + pkg.baseCodePath + " and " +
            Slog.e(TAG, "was about to create idmap for " + pkg.baseCodePath + " and " +
                    opkg.baseCodePath + " but target package has no known overlays");
                    opkg.baseCodePath + " but target package has no known overlays");
@@ -4243,7 +4247,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        }
        }
        final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
        final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
        final String cachePath =
        final String cachePath =
                ThemeUtils.getTargetCacheDir(pkg.packageName, opkg.packageName);
                ThemeUtils.getTargetCacheDir(pkgName, opkg.packageName);
        if (mInstaller.idmap(pkg.baseCodePath, opkg.baseCodePath, cachePath, sharedGid,
        if (mInstaller.idmap(pkg.baseCodePath, opkg.baseCodePath, cachePath, sharedGid,
                getPackageHashCode(pkg), getPackageHashCode(opkg)) != 0) {
                getPackageHashCode(pkg), getPackageHashCode(opkg)) != 0) {
            Slog.e(TAG, "Failed to generate idmap for " + pkg.baseCodePath +
            Slog.e(TAG, "Failed to generate idmap for " + pkg.baseCodePath +
@@ -6629,7 +6633,6 @@ public class PackageManagerService extends IPackageManager.Stub {
                        throw new PackageManagerException(
                        throw new PackageManagerException(
                                PackageManager.INSTALL_FAILED_THEME_AAPT_ERROR,
                                PackageManager.INSTALL_FAILED_THEME_AAPT_ERROR,
                                "Unable to process theme " + pkgName);
                                "Unable to process theme " + pkgName);
>>>>>>> Themes: Port to CM12 [1/6]
                    }
                    }
                }
                }
            }
            }
@@ -14392,7 +14395,8 @@ public class PackageManagerService extends IPackageManager.Stub {
                }
                }
            }
            }
        }
        }
=======
    }
    private void clearIconMapping() {
    private void clearIconMapping() {
        mIconPackHelper = null;
        mIconPackHelper = null;
        for (Activity activity : mActivities.mActivities.values()) {
        for (Activity activity : mActivities.mActivities.values()) {
@@ -14459,7 +14463,6 @@ public class PackageManagerService extends IPackageManager.Stub {
        }
        }
        return 0;
        return 0;
>>>>>>> Themes: Port to CM12 [1/6]
    }
    }
    /**
    /**