Loading core/java/com/android/internal/compat/IPlatformCompat.aidl +9 −0 Original line number Original line Diff line number Diff line Loading @@ -170,6 +170,15 @@ interface IPlatformCompat */ */ void clearOverrides(in String packageName); void clearOverrides(in String packageName); /** * Revert overrides to compatibility changes. Doesn't kill the app, to be only used in tests. * * @param packageName The package name of the app whose overrides will be cleared. * */ void clearOverridesForTest(in String packageName); /** /** * Get configs for an application. * Get configs for an application. * * Loading services/core/java/com/android/server/compat/PlatformCompat.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -125,6 +125,12 @@ public class PlatformCompat extends IPlatformCompat.Stub { killPackage(packageName); killPackage(packageName); } } @Override public void clearOverridesForTest(String packageName) { CompatConfig config = CompatConfig.get(); config.removePackageOverrides(packageName); } @Override @Override public boolean clearOverride(long changeId, String packageName) { public boolean clearOverride(long changeId, String packageName) { boolean existed = CompatConfig.get().removeOverride(changeId, packageName); boolean existed = CompatConfig.get().removeOverride(changeId, packageName); Loading tests/PlatformCompatGating/Android.bp 0 → 100644 +33 −0 Original line number Original line Diff line number Diff line // // Copyright (C) 2019 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. // android_test { name: "PlatformCompatGating", // Only compile source java files in this apk. srcs: ["src/**/*.java"], certificate: "platform", libs: [ "android.test.runner", "android.test.base", ], static_libs: [ "junit", "android-support-test", "mockito-target-minus-junit4", "truth-prebuilt", "platform-compat-test-rules" ], } tests/PlatformCompatGating/AndroidManifest.xml 0 → 100644 +11 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.tests.gating"> <application android:label="GatingTest"> <uses-library android:name="android.test.runner" /> </application> <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" android:targetPackage="com.android.tests.gating"/> </manifest> tests/PlatformCompatGating/AndroidTest.xml 0 → 100644 +30 −0 Original line number Original line Diff line number Diff line <!-- Copyright (C) 2018 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. --> <configuration description="Test compatibility change gating."> <target_preparer class="com.android.tradefed.targetprep.TestFilePushSetup"/> <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> <option name="test-file-name" value="PlatformCompatGating.apk"/> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"/> <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"/> <option name="test-suite-tag" value="apct"/> <option name="test-tag" value="Gating"/> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> <option name="package" value="com.android.tests.gating"/> <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/> <option name="hidden-api-checks" value="false"/> </test> </configuration> Loading
core/java/com/android/internal/compat/IPlatformCompat.aidl +9 −0 Original line number Original line Diff line number Diff line Loading @@ -170,6 +170,15 @@ interface IPlatformCompat */ */ void clearOverrides(in String packageName); void clearOverrides(in String packageName); /** * Revert overrides to compatibility changes. Doesn't kill the app, to be only used in tests. * * @param packageName The package name of the app whose overrides will be cleared. * */ void clearOverridesForTest(in String packageName); /** /** * Get configs for an application. * Get configs for an application. * * Loading
services/core/java/com/android/server/compat/PlatformCompat.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -125,6 +125,12 @@ public class PlatformCompat extends IPlatformCompat.Stub { killPackage(packageName); killPackage(packageName); } } @Override public void clearOverridesForTest(String packageName) { CompatConfig config = CompatConfig.get(); config.removePackageOverrides(packageName); } @Override @Override public boolean clearOverride(long changeId, String packageName) { public boolean clearOverride(long changeId, String packageName) { boolean existed = CompatConfig.get().removeOverride(changeId, packageName); boolean existed = CompatConfig.get().removeOverride(changeId, packageName); Loading
tests/PlatformCompatGating/Android.bp 0 → 100644 +33 −0 Original line number Original line Diff line number Diff line // // Copyright (C) 2019 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. // android_test { name: "PlatformCompatGating", // Only compile source java files in this apk. srcs: ["src/**/*.java"], certificate: "platform", libs: [ "android.test.runner", "android.test.base", ], static_libs: [ "junit", "android-support-test", "mockito-target-minus-junit4", "truth-prebuilt", "platform-compat-test-rules" ], }
tests/PlatformCompatGating/AndroidManifest.xml 0 → 100644 +11 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.tests.gating"> <application android:label="GatingTest"> <uses-library android:name="android.test.runner" /> </application> <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" android:targetPackage="com.android.tests.gating"/> </manifest>
tests/PlatformCompatGating/AndroidTest.xml 0 → 100644 +30 −0 Original line number Original line Diff line number Diff line <!-- Copyright (C) 2018 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. --> <configuration description="Test compatibility change gating."> <target_preparer class="com.android.tradefed.targetprep.TestFilePushSetup"/> <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> <option name="test-file-name" value="PlatformCompatGating.apk"/> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"/> <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"/> <option name="test-suite-tag" value="apct"/> <option name="test-tag" value="Gating"/> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> <option name="package" value="com.android.tests.gating"/> <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/> <option name="hidden-api-checks" value="false"/> </test> </configuration>