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

Commit 9066a6c2 authored by Chad Brubaker's avatar Chad Brubaker Committed by android-build-merger
Browse files

Merge "Allow shared users to rotate signing certs in an OTA" into pi-dev am: c826eec1

am: 52e9e978

Change-Id: If9d77ffe534d8b7af7c5d6c17ad9f84ee76fd5b3
parents 38da6cc1 52e9e978
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -10196,20 +10196,10 @@ public class PackageManagerService extends IPackageManager.Stub
                // The signature has changed, but this package is in the system
                // image...  let's recover!
                pkgSetting.signatures.mSigningDetails = pkg.mSigningDetails;
                // However...  if this package is part of a shared user, but it
                // doesn't match the signature of the shared user, let's fail.
                // What this means is that you can't change the signatures
                // associated with an overall shared user, which doesn't seem all
                // that unreasonable.
                // If the system app is part of a shared user we allow that shared user to change
                // signatures as well in part as part of an OTA.
                if (signatureCheckPs.sharedUser != null) {
                    if (compareSignatures(
                            signatureCheckPs.sharedUser.signatures.mSigningDetails.signatures,
                            pkg.mSigningDetails.signatures) != PackageManager.SIGNATURE_MATCH) {
                        throw new PackageManagerException(
                                INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES,
                                "Signature mismatch for shared user: "
                                        + pkgSetting.sharedUser);
                    }
                    signatureCheckPs.sharedUser.signatures.mSigningDetails = pkg.mSigningDetails;
                }
                // File a report about this.
                String msg = "System package " + pkg.packageName