Add dynamic-config to CtsCurrentApiSignatureTestCases This is required to enable the CTS 12 current api tests to pass on Android 12 devices with the Android 13 ART Module installed. A small number of changes were made in the Android 13 timeframe that changed a few APIs in (hopefully) inconsequential ways. API's are now frozen so these can not now be corrected. Earlier work enabled the use of dynamic-config in other signature tests (b/177303736). Bug: 177303736 Bug: 233719013 Test: atest CtsCurrentApiSignatureTestCases Change-Id: Ie0549990e1e250e86b0cd8a9318ba671b2f4ddbe
diff --git a/tests/signature/api-check/current-api/Android.bp b/tests/signature/api-check/current-api/Android.bp index 4114272..14210fc 100644 --- a/tests/signature/api-check/current-api/Android.bp +++ b/tests/signature/api-check/current-api/Android.bp
@@ -19,7 +19,7 @@ android_test { name: "CtsCurrentApiSignatureTestCases", defaults: [ - "signature-api-check-defaults", + "signature-api-check-dynamic-config-defaults", ], java_resources: [ ":cts-current-api-gz",
diff --git a/tests/signature/api-check/current-api/AndroidTest.xml b/tests/signature/api-check/current-api/AndroidTest.xml index 8d39bd7..8d84e88 100644 --- a/tests/signature/api-check/current-api/AndroidTest.xml +++ b/tests/signature/api-check/current-api/AndroidTest.xml
@@ -20,6 +20,11 @@ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" /> <option name="config-descriptor:metadata" key="parameter" value="secondary_user" /> <option name="not-shardable" value="true" /> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher"> + <option name="target" value="device" /> + <option name="config-filename" value="CtsCurrentApiSignatureTestCases" /> + <option name="version" value="1.0" /> + </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> <option name="cleanup-apks" value="true" /> <option name="test-file-name" value="CtsCurrentApiSignatureTestCases.apk" /> @@ -30,8 +35,11 @@ <option name="class" value="android.signature.cts.api.current.SignatureTest" /> <option name="instrumentation-arg" key="expected-api-files" value="current.api.gz" /> <option name="instrumentation-arg" key="unexpected-api-files" value="android-test-base-current.api.gz,android-test-mock-current.api.gz,android-test-runner-current.api.gz" /> + <option name="instrumentation-arg" key="dynamic-config-name" value="CtsCurrentApiSignatureTestCases" /> <option name="runtime-hint" value="30s" /> <!-- Disable hidden API checks (http://b/171459260). --> <option name="hidden-api-checks" value="false" /> + <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. --> + <option name="isolated-storage" value="false" /> </test> </configuration>
diff --git a/tests/signature/api-check/current-api/DynamicConfig.xml b/tests/signature/api-check/current-api/DynamicConfig.xml new file mode 100644 index 0000000..d26d3c9 --- /dev/null +++ b/tests/signature/api-check/current-api/DynamicConfig.xml
@@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2022 Google Inc. + + 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. +--> +<dynamicConfig> + <entry key ="expected_failures"> + <!-- + ! Each value in this section identifies an expected failure and is of the + ! form: + ! <failure-type>:<signature of class/member> + ! + ! These entries are loaded by AnnotationTest which uses them to construct + ! an ExpectedFailuresFilter which discards them. + ! + ! See go/triage-cts-signature-tests for more information and below for some examples. + !--> + <!-- Bug: 233719013 --> + <value>missing_method:java.util.Optional#flatMap(java.util.function.Function<? super T,java.util.Optional<U>>)</value> + <value>missing_method:java.util.OptionalDouble#orElseThrow(java.util.function.Supplier<X>)</value> + <value>missing_method:java.util.OptionalInt#orElseThrow(java.util.function.Supplier<X>)</value> + <value>missing_method:java.util.OptionalLong#orElseThrow(java.util.function.Supplier<X>)</value> + <value>mismatch_method:java.util.concurrent.ConcurrentHashMap.KeySetView#removeAll(java.util.Collection<?>)</value> + </entry> +</dynamicConfig> \ No newline at end of file
diff --git a/tests/signature/api-check/current-api/src/android/signature/cts/api/current/SignatureTest.java b/tests/signature/api-check/current-api/src/android/signature/cts/api/current/SignatureTest.java index 1eadd2f..b6a806a 100644 --- a/tests/signature/api-check/current-api/src/android/signature/cts/api/current/SignatureTest.java +++ b/tests/signature/api-check/current-api/src/android/signature/cts/api/current/SignatureTest.java
@@ -16,5 +16,7 @@ package android.signature.cts.api.current; -public class SignatureTest extends android.signature.cts.api.SignatureTest { +import java.android.signature.cts.api.dynamic.DynamicConfigSignatureTest; + +public class SignatureTest extends DynamicConfigSignatureTest { }