Loading core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -1400,7 +1400,9 @@ package android.app.compat { method public static boolean isChangeEnabled(long); method @RequiresPermission(allOf={"android.permission.READ_COMPAT_CHANGE_CONFIG", "android.permission.LOG_COMPAT_CHANGE"}) public static boolean isChangeEnabled(long, @NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(allOf={"android.permission.READ_COMPAT_CHANGE_CONFIG", "android.permission.LOG_COMPAT_CHANGE"}) public static boolean isChangeEnabled(long, int); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void putAllPackageOverrides(@NonNull java.util.Map<java.lang.String,java.util.Map<java.lang.Long,android.app.compat.PackageOverride>>); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void putPackageOverrides(@NonNull String, @NonNull java.util.Map<java.lang.Long,android.app.compat.PackageOverride>); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void removeAllPackageOverrides(@NonNull java.util.Map<java.lang.String,java.util.Set<java.lang.Long>>); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void removePackageOverrides(@NonNull String, @NonNull java.util.Set<java.lang.Long>); } core/java/android/app/compat/CompatChanges.java +55 −0 Original line number Diff line number Diff line Loading @@ -22,8 +22,11 @@ import android.annotation.SystemApi; import android.compat.Compatibility; import android.os.RemoteException; import android.os.UserHandle; import android.util.ArrayMap; import com.android.internal.compat.CompatibilityOverrideConfig; import com.android.internal.compat.CompatibilityOverridesByPackageConfig; import com.android.internal.compat.CompatibilityOverridesToRemoveByPackageConfig; import com.android.internal.compat.CompatibilityOverridesToRemoveConfig; import java.util.Map; Loading Loading @@ -97,6 +100,31 @@ public final class CompatChanges { return QUERY_CACHE.query(ChangeIdStateQuery.byUid(changeId, uid)); } /** * Equivalent to calling {@link #putPackageOverrides(String, Map)} on each entry in {@code * packageNameToOverrides}, but the state of the compat config will be updated only once * instead of for each package. * * @param packageNameToOverrides A map from package name to a map from change ID to the * override applied for that package name and change ID. */ @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void putAllPackageOverrides( @NonNull Map<String, Map<Long, PackageOverride>> packageNameToOverrides) { ArrayMap<String, CompatibilityOverrideConfig> packageNameToConfig = new ArrayMap<>(); for (String packageName : packageNameToOverrides.keySet()) { packageNameToConfig.put(packageName, new CompatibilityOverrideConfig(packageNameToOverrides.get(packageName))); } CompatibilityOverridesByPackageConfig config = new CompatibilityOverridesByPackageConfig( packageNameToConfig); try { QUERY_CACHE.getPlatformCompatService().putAllOverridesOnReleaseBuilds(config); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } /** * Associates app compat overrides with the given package and their respective change IDs. * This will check whether the caller is allowed to perform this operation on the given apk and Loading @@ -122,6 +150,33 @@ public final class CompatChanges { } } /** * Equivalent to calling {@link #removePackageOverrides(String, Set)} on each entry in {@code * packageNameToOverridesToRemove}, but the state of the compat config will be updated only once * instead of for each package. * * @param packageNameToOverridesToRemove A map from package name to a set of change IDs for * which to remove overrides for that package name. */ @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void removeAllPackageOverrides( @NonNull Map<String, Set<Long>> packageNameToOverridesToRemove) { ArrayMap<String, CompatibilityOverridesToRemoveConfig> packageNameToConfig = new ArrayMap<>(); for (String packageName : packageNameToOverridesToRemove.keySet()) { packageNameToConfig.put(packageName, new CompatibilityOverridesToRemoveConfig( packageNameToOverridesToRemove.get(packageName))); } CompatibilityOverridesToRemoveByPackageConfig config = new CompatibilityOverridesToRemoveByPackageConfig(packageNameToConfig); try { QUERY_CACHE.getPlatformCompatService().removeAllOverridesOnReleaseBuilds(config); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } /** * Removes app compat overrides for the given package. This will check whether the caller is * allowed to perform this operation on the given apk and build. Only the installer package is Loading core/java/com/android/internal/compat/CompatibilityOverridesByPackageConfig.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package com.android.internal.compat; parcelable CompatibilityOverridesByPackageConfig; core/java/com/android/internal/compat/CompatibilityOverridesByPackageConfig.java 0 → 100644 +74 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package com.android.internal.compat; import android.os.Parcel; import android.os.Parcelable; import java.util.HashMap; import java.util.Map; /** * Parcelable containing compat config overrides by application. * @hide */ public final class CompatibilityOverridesByPackageConfig implements Parcelable { public final Map<String, CompatibilityOverrideConfig> packageNameToOverrides; public CompatibilityOverridesByPackageConfig( Map<String, CompatibilityOverrideConfig> packageNameToOverrides) { this.packageNameToOverrides = packageNameToOverrides; } private CompatibilityOverridesByPackageConfig(Parcel in) { int keyCount = in.readInt(); packageNameToOverrides = new HashMap<>(); for (int i = 0; i < keyCount; i++) { String key = in.readString(); packageNameToOverrides.put(key, CompatibilityOverrideConfig.CREATOR.createFromParcel(in)); } } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(packageNameToOverrides.size()); for (String key : packageNameToOverrides.keySet()) { dest.writeString(key); packageNameToOverrides.get(key).writeToParcel(dest, /* flags= */ 0); } } public static final Parcelable.Creator<CompatibilityOverridesByPackageConfig> CREATOR = new Parcelable.Creator<CompatibilityOverridesByPackageConfig>() { @Override public CompatibilityOverridesByPackageConfig createFromParcel(Parcel in) { return new CompatibilityOverridesByPackageConfig(in); } @Override public CompatibilityOverridesByPackageConfig[] newArray(int size) { return new CompatibilityOverridesByPackageConfig[size]; } }; } core/java/com/android/internal/compat/CompatibilityOverridesToRemoveByPackageConfig.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package com.android.internal.compat; parcelable CompatibilityOverridesToRemoveByPackageConfig; Loading
core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -1400,7 +1400,9 @@ package android.app.compat { method public static boolean isChangeEnabled(long); method @RequiresPermission(allOf={"android.permission.READ_COMPAT_CHANGE_CONFIG", "android.permission.LOG_COMPAT_CHANGE"}) public static boolean isChangeEnabled(long, @NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(allOf={"android.permission.READ_COMPAT_CHANGE_CONFIG", "android.permission.LOG_COMPAT_CHANGE"}) public static boolean isChangeEnabled(long, int); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void putAllPackageOverrides(@NonNull java.util.Map<java.lang.String,java.util.Map<java.lang.Long,android.app.compat.PackageOverride>>); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void putPackageOverrides(@NonNull String, @NonNull java.util.Map<java.lang.Long,android.app.compat.PackageOverride>); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void removeAllPackageOverrides(@NonNull java.util.Map<java.lang.String,java.util.Set<java.lang.Long>>); method @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void removePackageOverrides(@NonNull String, @NonNull java.util.Set<java.lang.Long>); }
core/java/android/app/compat/CompatChanges.java +55 −0 Original line number Diff line number Diff line Loading @@ -22,8 +22,11 @@ import android.annotation.SystemApi; import android.compat.Compatibility; import android.os.RemoteException; import android.os.UserHandle; import android.util.ArrayMap; import com.android.internal.compat.CompatibilityOverrideConfig; import com.android.internal.compat.CompatibilityOverridesByPackageConfig; import com.android.internal.compat.CompatibilityOverridesToRemoveByPackageConfig; import com.android.internal.compat.CompatibilityOverridesToRemoveConfig; import java.util.Map; Loading Loading @@ -97,6 +100,31 @@ public final class CompatChanges { return QUERY_CACHE.query(ChangeIdStateQuery.byUid(changeId, uid)); } /** * Equivalent to calling {@link #putPackageOverrides(String, Map)} on each entry in {@code * packageNameToOverrides}, but the state of the compat config will be updated only once * instead of for each package. * * @param packageNameToOverrides A map from package name to a map from change ID to the * override applied for that package name and change ID. */ @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void putAllPackageOverrides( @NonNull Map<String, Map<Long, PackageOverride>> packageNameToOverrides) { ArrayMap<String, CompatibilityOverrideConfig> packageNameToConfig = new ArrayMap<>(); for (String packageName : packageNameToOverrides.keySet()) { packageNameToConfig.put(packageName, new CompatibilityOverrideConfig(packageNameToOverrides.get(packageName))); } CompatibilityOverridesByPackageConfig config = new CompatibilityOverridesByPackageConfig( packageNameToConfig); try { QUERY_CACHE.getPlatformCompatService().putAllOverridesOnReleaseBuilds(config); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } /** * Associates app compat overrides with the given package and their respective change IDs. * This will check whether the caller is allowed to perform this operation on the given apk and Loading @@ -122,6 +150,33 @@ public final class CompatChanges { } } /** * Equivalent to calling {@link #removePackageOverrides(String, Set)} on each entry in {@code * packageNameToOverridesToRemove}, but the state of the compat config will be updated only once * instead of for each package. * * @param packageNameToOverridesToRemove A map from package name to a set of change IDs for * which to remove overrides for that package name. */ @RequiresPermission(android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD) public static void removeAllPackageOverrides( @NonNull Map<String, Set<Long>> packageNameToOverridesToRemove) { ArrayMap<String, CompatibilityOverridesToRemoveConfig> packageNameToConfig = new ArrayMap<>(); for (String packageName : packageNameToOverridesToRemove.keySet()) { packageNameToConfig.put(packageName, new CompatibilityOverridesToRemoveConfig( packageNameToOverridesToRemove.get(packageName))); } CompatibilityOverridesToRemoveByPackageConfig config = new CompatibilityOverridesToRemoveByPackageConfig(packageNameToConfig); try { QUERY_CACHE.getPlatformCompatService().removeAllOverridesOnReleaseBuilds(config); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } /** * Removes app compat overrides for the given package. This will check whether the caller is * allowed to perform this operation on the given apk and build. Only the installer package is Loading
core/java/com/android/internal/compat/CompatibilityOverridesByPackageConfig.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package com.android.internal.compat; parcelable CompatibilityOverridesByPackageConfig;
core/java/com/android/internal/compat/CompatibilityOverridesByPackageConfig.java 0 → 100644 +74 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package com.android.internal.compat; import android.os.Parcel; import android.os.Parcelable; import java.util.HashMap; import java.util.Map; /** * Parcelable containing compat config overrides by application. * @hide */ public final class CompatibilityOverridesByPackageConfig implements Parcelable { public final Map<String, CompatibilityOverrideConfig> packageNameToOverrides; public CompatibilityOverridesByPackageConfig( Map<String, CompatibilityOverrideConfig> packageNameToOverrides) { this.packageNameToOverrides = packageNameToOverrides; } private CompatibilityOverridesByPackageConfig(Parcel in) { int keyCount = in.readInt(); packageNameToOverrides = new HashMap<>(); for (int i = 0; i < keyCount; i++) { String key = in.readString(); packageNameToOverrides.put(key, CompatibilityOverrideConfig.CREATOR.createFromParcel(in)); } } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(packageNameToOverrides.size()); for (String key : packageNameToOverrides.keySet()) { dest.writeString(key); packageNameToOverrides.get(key).writeToParcel(dest, /* flags= */ 0); } } public static final Parcelable.Creator<CompatibilityOverridesByPackageConfig> CREATOR = new Parcelable.Creator<CompatibilityOverridesByPackageConfig>() { @Override public CompatibilityOverridesByPackageConfig createFromParcel(Parcel in) { return new CompatibilityOverridesByPackageConfig(in); } @Override public CompatibilityOverridesByPackageConfig[] newArray(int size) { return new CompatibilityOverridesByPackageConfig[size]; } }; }
core/java/com/android/internal/compat/CompatibilityOverridesToRemoveByPackageConfig.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package com.android.internal.compat; parcelable CompatibilityOverridesToRemoveByPackageConfig;