Loading core/java/android/content/pm/PackageParser.java +18 −6 Original line number Diff line number Diff line Loading @@ -828,7 +828,7 @@ public class PackageParser { if (pkg.mCertificates == null) { pkg.mCertificates = entryCerts; pkg.mSignatures = convertToSignatures(entryCerts); pkg.mSigningKeys = new ArraySet<>(); pkg.mSigningKeys = new ArraySet<PublicKey>(); for (int i=0; i < entryCerts.length; i++) { pkg.mSigningKeys.add(entryCerts[i][0].getPublicKey()); } Loading Loading @@ -1222,6 +1222,17 @@ public class PackageParser { if (parsePermissionTree(pkg, res, parser, attrs, outError) == null) { return null; } } else if (tagName.equals("upgrade-keyset")) { sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestUpgradeKeySet); String name = sa.getNonResourceString( com.android.internal.R.styleable.AndroidManifestUpgradeKeySet_name); sa.recycle(); if (pkg.mUpgradeKeySets == null) { pkg.mUpgradeKeySets = new ArraySet<String>(); } pkg.mUpgradeKeySets.add(name); XmlUtils.skipCurrentTag(parser); } else if (tagName.equals("uses-permission")) { if (!parseUsesPermission(pkg, res, parser, attrs, outError)) { return null; Loading Loading @@ -1795,7 +1806,7 @@ public class PackageParser { } } owner.mKeySetMapping = new ArrayMap<String, ArraySet<PublicKey>>(); owner.mKeySetMapping = new ArrayMap<String, Set<PublicKey>>(); for (Map.Entry<PublicKey, Set<String>> e : definedKeySets.entrySet()) { PublicKey key = e.getKey(); Set<String> keySetNames = e.getValue(); Loading @@ -1803,7 +1814,7 @@ public class PackageParser { if (owner.mKeySetMapping.containsKey(alias)) { owner.mKeySetMapping.get(alias).add(key); } else { ArraySet<PublicKey> keys = new ArraySet<PublicKey>(); Set<PublicKey> keys = new ArraySet<PublicKey>(); keys.add(key); owner.mKeySetMapping.put(alias, keys); } Loading Loading @@ -3795,8 +3806,9 @@ public class PackageParser { /** * Data used to feed the KeySetManager */ public ArraySet<PublicKey> mSigningKeys; public ArrayMap<String, ArraySet<PublicKey>> mKeySetMapping; public Set<PublicKey> mSigningKeys; public Set<String> mUpgradeKeySets; public Map<String, Set<PublicKey>> mKeySetMapping; public Package(String packageName) { this.packageName = packageName; Loading core/res/res/values/attrs_manifest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -2019,4 +2019,10 @@ <declare-styleable name="KeySet"> <attr name="name" /> </declare-styleable> <!-- Associate declared KeySets with upgrading capability --> <declare-styleable name="AndroidManifestUpgradeKeySet" parent="AndroidManifest"> <attr name="name" /> </declare-styleable> </resources> core/tests/coretests/apks/keyset/Android.mk 0 → 100644 +91 −0 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) #apks signed by keyset_A include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_unone LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uNone/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_ua LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uA/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_uab LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uAB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_ua_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uAuB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_permdef_sa_unone LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := permDef/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_permuse_sa_ua_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := permUse/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) #apks signed by keyset_B include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sb_ua LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uA/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sb_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_permuse_sb_ua_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := permUse/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) #apks signed by keyset_A and keyset_B include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sab_ua LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uA/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) #apks signed by keyset_A and unit_test include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sau_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) No newline at end of file core/tests/coretests/apks/keyset/permDef/AndroidManifest.xml 0 → 100644 +24 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.frameworks.coretests.keysets_permdef"> <application android:hasCode="false"> </application> <permission android:description="@string/keyset_perm_desc" android:label="@string/keyset_perm_label" android:name="com.android.frameworks.coretests.keysets_permdef.keyset_perm" android:protectionLevel="signature" /> </manifest> core/tests/coretests/apks/keyset/permUse/AndroidManifest.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.frameworks.coretests.keysets"> <application android:hasCode="false"> </application> <uses-permission android:name="com.android.frameworks.coretests.keysets_permdef.keyset_perm" /> <keys> <publicKey android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="> <keyset android:name="A" /> </publicKey> <publicKey android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTfQsY8UuXiXmvw/y7Tpr7HoyfAC0nE/8Qdk3ZtEr9asa5qqP0F6xzCI1PGVFV+WLVRwm6FdB9StENL5EKyQFcCAwEAAQ=="> <keyset android:name="B" /> </publicKey> </keys> <upgrade-keyset android:name="A"/> <upgrade-keyset android:name="B"/> </manifest> Loading
core/java/android/content/pm/PackageParser.java +18 −6 Original line number Diff line number Diff line Loading @@ -828,7 +828,7 @@ public class PackageParser { if (pkg.mCertificates == null) { pkg.mCertificates = entryCerts; pkg.mSignatures = convertToSignatures(entryCerts); pkg.mSigningKeys = new ArraySet<>(); pkg.mSigningKeys = new ArraySet<PublicKey>(); for (int i=0; i < entryCerts.length; i++) { pkg.mSigningKeys.add(entryCerts[i][0].getPublicKey()); } Loading Loading @@ -1222,6 +1222,17 @@ public class PackageParser { if (parsePermissionTree(pkg, res, parser, attrs, outError) == null) { return null; } } else if (tagName.equals("upgrade-keyset")) { sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestUpgradeKeySet); String name = sa.getNonResourceString( com.android.internal.R.styleable.AndroidManifestUpgradeKeySet_name); sa.recycle(); if (pkg.mUpgradeKeySets == null) { pkg.mUpgradeKeySets = new ArraySet<String>(); } pkg.mUpgradeKeySets.add(name); XmlUtils.skipCurrentTag(parser); } else if (tagName.equals("uses-permission")) { if (!parseUsesPermission(pkg, res, parser, attrs, outError)) { return null; Loading Loading @@ -1795,7 +1806,7 @@ public class PackageParser { } } owner.mKeySetMapping = new ArrayMap<String, ArraySet<PublicKey>>(); owner.mKeySetMapping = new ArrayMap<String, Set<PublicKey>>(); for (Map.Entry<PublicKey, Set<String>> e : definedKeySets.entrySet()) { PublicKey key = e.getKey(); Set<String> keySetNames = e.getValue(); Loading @@ -1803,7 +1814,7 @@ public class PackageParser { if (owner.mKeySetMapping.containsKey(alias)) { owner.mKeySetMapping.get(alias).add(key); } else { ArraySet<PublicKey> keys = new ArraySet<PublicKey>(); Set<PublicKey> keys = new ArraySet<PublicKey>(); keys.add(key); owner.mKeySetMapping.put(alias, keys); } Loading Loading @@ -3795,8 +3806,9 @@ public class PackageParser { /** * Data used to feed the KeySetManager */ public ArraySet<PublicKey> mSigningKeys; public ArrayMap<String, ArraySet<PublicKey>> mKeySetMapping; public Set<PublicKey> mSigningKeys; public Set<String> mUpgradeKeySets; public Map<String, Set<PublicKey>> mKeySetMapping; public Package(String packageName) { this.packageName = packageName; Loading
core/res/res/values/attrs_manifest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -2019,4 +2019,10 @@ <declare-styleable name="KeySet"> <attr name="name" /> </declare-styleable> <!-- Associate declared KeySets with upgrading capability --> <declare-styleable name="AndroidManifestUpgradeKeySet" parent="AndroidManifest"> <attr name="name" /> </declare-styleable> </resources>
core/tests/coretests/apks/keyset/Android.mk 0 → 100644 +91 −0 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) #apks signed by keyset_A include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_unone LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uNone/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_ua LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uA/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_uab LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uAB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sa_ua_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := uAuB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_permdef_sa_unone LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := permDef/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_permuse_sa_ua_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_MANIFEST_FILE := permUse/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) #apks signed by keyset_B include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sb_ua LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uA/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sb_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_permuse_sb_ua_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := permUse/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) #apks signed by keyset_A and keyset_B include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sab_ua LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uA/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) #apks signed by keyset_A and unit_test include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := keyset_sau_ub LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/../../certs/keyset_B LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml include $(FrameworkCoreTests_BUILD_PACKAGE) No newline at end of file
core/tests/coretests/apks/keyset/permDef/AndroidManifest.xml 0 → 100644 +24 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.frameworks.coretests.keysets_permdef"> <application android:hasCode="false"> </application> <permission android:description="@string/keyset_perm_desc" android:label="@string/keyset_perm_label" android:name="com.android.frameworks.coretests.keysets_permdef.keyset_perm" android:protectionLevel="signature" /> </manifest>
core/tests/coretests/apks/keyset/permUse/AndroidManifest.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.frameworks.coretests.keysets"> <application android:hasCode="false"> </application> <uses-permission android:name="com.android.frameworks.coretests.keysets_permdef.keyset_perm" /> <keys> <publicKey android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="> <keyset android:name="A" /> </publicKey> <publicKey android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTfQsY8UuXiXmvw/y7Tpr7HoyfAC0nE/8Qdk3ZtEr9asa5qqP0F6xzCI1PGVFV+WLVRwm6FdB9StENL5EKyQFcCAwEAAQ=="> <keyset android:name="B" /> </publicKey> </keys> <upgrade-keyset android:name="A"/> <upgrade-keyset android:name="B"/> </manifest>