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

Commit 3a0dbfb2 authored by dcashman's avatar dcashman
Browse files

Record properSigningKeySet values to packages.xml

PackageKeySetData records all of the defined keysets which are a subset of an
apk's signing keyset.  It also records the original superset for all of these
in an easy-to-access 'proper' signing-keyset which is consulted as the official
source for a package.  This value was not being recorded, causing
PackageManager to re-gather the certificates for a package on each boot after
a fix for a different bug.  Record it.

Bug: 16076095
Change-Id: If5a7f6d70dd4784284d7bab466dab0311aa13c28
parent 5e458dd6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1958,6 +1958,13 @@ final class Settings {
    void writeSigningKeySetsLPr(XmlSerializer serializer,
            PackageKeySetData data) throws IOException {
        if (data.getSigningKeySets() != null) {
            // Keep track of the original signing-keyset.
            // Must be recorded first, since it will be read first and wipe the
            // current signing-keysets for the package when set.
            long properSigningKeySet = data.getProperSigningKeySet();
            serializer.startTag(null, "proper-signing-keyset");
            serializer.attribute(null, "identifier", Long.toString(properSigningKeySet));
            serializer.endTag(null, "proper-signing-keyset");
            for (long id : data.getSigningKeySets()) {
                serializer.startTag(null, "signing-keyset");
                serializer.attribute(null, "identifier", Long.toString(id));
@@ -2917,6 +2924,9 @@ final class Settings {
                } else if (tagName.equals("perms")) {
                    readGrantedPermissionsLPw(parser, packageSetting.grantedPermissions);
                    packageSetting.permissionsFixed = true;
                } else if (tagName.equals("proper-signing-keyset")) {
                    long id = Long.parseLong(parser.getAttributeValue(null, "identifier"));
                    packageSetting.keySetData.setProperSigningKeySet(id);
                } else if (tagName.equals("signing-keyset")) {
                    long id = Long.parseLong(parser.getAttributeValue(null, "identifier"));
                    packageSetting.keySetData.addSigningKeySet(id);