Merge "Create a new permission to override Overridable change ids" into sc-dev am: 16cd2836a3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13988946

Change-Id: If9fa205c5bdf5d8f37846a84d55653ffd383604d
This commit is contained in:
Benjamin Franz
2021-03-25 15:44:55 +00:00
committed by Automerger Merge Worker
13 changed files with 185 additions and 55 deletions

View File

@@ -40,8 +40,7 @@ public final class CompatibilityOverrideConfig implements Parcelable {
overrides = new HashMap<>();
for (int i = 0; i < keyCount; i++) {
long key = in.readLong();
PackageOverride override = in.readParcelable(PackageOverride.class.getClassLoader());
overrides.put(key, override);
overrides.put(key, PackageOverride.createFromParcel(in));
}
}
@@ -55,7 +54,7 @@ public final class CompatibilityOverrideConfig implements Parcelable {
dest.writeInt(overrides.size());
for (Long key : overrides.keySet()) {
dest.writeLong(key);
dest.writeParcelable(overrides.get(key), 0);
overrides.get(key).writeToParcel(dest);
}
}

View File

@@ -151,15 +151,23 @@ interface IPlatformCompat {
void setOverrides(in CompatibilityChangeConfig overrides, in String packageName);
/**
* Adds overrides to compatibility changes.
* Adds overrides to compatibility changes on release builds.
*
* <p>Kills the app to allow the changes to take effect.
* <p>The caller to this API needs to hold
* {@code android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD} and all change ids
* in {@code overrides} need to annotated with {@link android.compat.annotation.Overridable}.
*
* A release build in this definition means that {@link android.os.Build#IS_DEBUGGABLE} needs to
* be {@code false}.
*
* <p>Note that this does not kill the app, and therefore overrides read from the app process
* will not be updated. Overrides read from the system process do take effect.
*
* @param overrides parcelable containing the compat change overrides to be applied
* @param packageName the package name of the app whose changes will be overridden
* @throws SecurityException if overriding changes is not permitted
*/
void setOverridesFromInstaller(in CompatibilityOverrideConfig overrides, in String packageName);
void setOverridesOnReleaseBuilds(in CompatibilityOverrideConfig overrides, in String packageName);
/**
* Adds overrides to compatibility changes.