diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/server/SystemConfig.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java index ea390cd71e31..4fc66bc802f3 100644 --- a/core/java/com/android/server/SystemConfig.java +++ b/core/java/com/android/server/SystemConfig.java @@ -19,6 +19,7 @@ package com.android.server; import static com.android.internal.util.ArrayUtils.appendInt; import android.annotation.NonNull; +import android.annotation.Nullable; import android.app.ActivityManager; import android.content.ComponentName; import android.content.pm.FeatureInfo; @@ -238,6 +239,14 @@ public class SystemConfig { */ private Map<String, Map<String, String>> mNamedActors = null; + // Package name of the package pre-installed on a read-only + // partition that is used to verify if an overlay package fulfills + // the 'config_signature' policy by comparing their signatures: + // if the overlay package is signed with the same certificate as + // the package declared in 'config-signature' tag, then the + // overlay package fulfills the 'config_signature' policy. + private String mOverlayConfigSignaturePackage; + public static SystemConfig getInstance() { if (!isSystemProcess()) { Slog.wtf(TAG, "SystemConfig is being accessed by a process other than " @@ -433,6 +442,12 @@ public class SystemConfig { return mNamedActors != null ? mNamedActors : Collections.emptyMap(); } + @Nullable + public String getOverlayConfigSignaturePackage() { + return TextUtils.isEmpty(mOverlayConfigSignaturePackage) + ? null : mOverlayConfigSignaturePackage; + } + /** * Only use for testing. Do NOT use in production code. * @param readPermissions false to create an empty SystemConfig; true to read the permissions. @@ -1151,6 +1166,27 @@ public class SystemConfig { } XmlUtils.skipCurrentTag(parser); } break; + case "overlay-config-signature": { + if (allowAll) { + String pkgName = parser.getAttributeValue(null, "package"); + if (pkgName == null) { + Slog.w(TAG, "<" + name + "> without package in " + permFile + + " at " + parser.getPositionDescription()); + } else { + if (TextUtils.isEmpty(mOverlayConfigSignaturePackage)) { + mOverlayConfigSignaturePackage = pkgName.intern(); + } else { + throw new IllegalStateException("Reference signature package " + + "defined as both " + + mOverlayConfigSignaturePackage + + " and " + pkgName); + } + } + } else { + logNotAllowedInPartition(name, permFile, parser); + } + XmlUtils.skipCurrentTag(parser); + } break; case "rollback-whitelisted-app": { String pkgname = parser.getAttributeValue(null, "package"); if (pkgname == null) { |