常见的PKMS问题分析

1.Steps to reproduce the problem:
Device updates from an earlier version to any version of Android 6.0.
Symptom of the problem:
Preloaded apps (e.g. Google Play services or Google Play Store) crash repeatedly, leaving the device in an
unusable state.


Preconditions of when the problem would be reproduced:
If an app is removed from the system image or its package name is renamed during the OTA update
process.


frameworks/base / services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
    private boolean isSysComponentOrPersistentPlatformSignedPrivAppLPr(PackageParser.Package pkg) {
        if (UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID) {
            return true;
        }
        if (!pkg.isPrivilegedApp()) {
            return false;
        }
        PackageSetting sysPkg = mService.mSettings.getDisabledSystemPkgLPr(pkg.packageName);
 -       if (sysPkg != null ) {
 +       if (sysPkg != null && sysPkg.pkg != null) {
            if ((sysPkg.pkg.applicationInfo.flags & ApplicationInfo.FLAG_PERSISTENT) == 0) {
                return false;
            }
        } else if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_PERSISTENT) == 0) {
            return false;
        }
        return PackageManagerService.compareSignatures(mService.mPlatformPackage.mSignatures,
                pkg.mSignatures) == PackageManager.SIGNATURE_MATCH;
    }


你可能感兴趣的:(常见的PKMS问题分析)