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

Commit 96716fd0 authored by d34d's avatar d34d Committed by Clark Scheff
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 6157da92
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -5695,6 +5695,10 @@ public class PackageManagerService extends IPackageManager.Stub {
                    opkg.baseCodePath + ": overlay not trusted");
                    opkg.baseCodePath + ": overlay not trusted");
            return false;
            return false;
        }
        }
        // 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(pkg.packageName);
        ArrayMap<String, PackageParser.Package> overlaySet = mOverlays.get(pkg.packageName);
        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 " +
@@ -5703,7 +5707,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 +