1<!--
2  ~ Copyright (C) 2023 The Android Open Source Project
3  ~
4  ~ Licensed under the Apache License, Version 2.0 (the "License");
5  ~ you may not use this file except in compliance with the License.
6  ~ You may obtain a copy of the License at
7  ~
8  ~      http://www.apache.org/licenses/LICENSE-2.0
9  ~
10  ~ Unless required by applicable law or agreed to in writing, software
11  ~ distributed under the License is distributed on an "AS IS" BASIS,
12  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ~ See the License for the specific language governing permissions and
14  ~ limitations under the License.
15  -->
16<configuration description="Config for SdkSandbox UI tests">
17    <option name="test-tag" value="SdkSandboxUiTests" />
18    <option name="config-descriptor:metadata" key="component" value="framework"/>
19    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
20    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
21    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
22    <option name="test-user-token" value="%TEST_USER%"/>
23
24    <!-- IMPORTANT: This needs to come before SuiteApkInstaller
25
26      SuiteApkInstaller is not able to uninstall the Sdk-Provider.apk because the test
27      app that requires it is still installed at that point. This means the apk would
28      stay on the test device after the test ends.
29
30      This preparer, during tear down, runs after SuiteApkInstaller and will finally
31      uninstall the provider, leaving the device in a clean state.
32
33      See b/314294893 for more details.
34     -->
35    <target_preparer
36        class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
37        <option name="teardown-command"
38                value="pm uninstall --user %TEST_USER% com.android.sdksandbox.uiprovider"/>
39    </target_preparer>
40
41    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
42        <option name="cleanup-apks" value="true"/>
43        <option name="test-file-name" value="SdkSandboxUiProvider.apk"/>
44        <option name="test-file-name" value="SdkSandboxUiTests.apk"/>
45    </target_preparer>
46
47    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
48        <option name="hidden-api-checks" value="false" />
49        <option name="package" value="com.android.tests.sdksandbox.ui"/>
50    </test>
51
52    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
53        <option name="run-command" value="cmd sdk_sandbox set-state --enabled" />
54        <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" />
55        <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" />
56        <option name="teardown-command" value="cmd sdk_sandbox set-state --reset" />
57    </target_preparer>
58
59    <object type="module_controller"
60            class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
61        <option name="mainline-module-package-name" value="com.google.android.adservices"/>
62    </object>
63
64    <option name="config-descriptor:metadata" key="mainline-param"
65            value="com.google.android.adservices.apex" />
66</configuration>
67
68