1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4  ~ Copyright (C) 2023 The Android Open Source Project
5  ~
6  ~ Licensed under the Apache License, Version 2.0 (the "License");
7  ~ you may not use this file except in compliance with the License.
8  ~ You may obtain a copy of the License at
9  ~
10  ~      http://www.apache.org/licenses/LICENSE-2.0
11  ~
12  ~ Unless required by applicable law or agreed to in writing, software
13  ~ distributed under the License is distributed on an "AS IS" BASIS,
14  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ~ See the License for the specific language governing permissions and
16  ~ limitations under the License.
17  -->
18
19<configuration description="Config for CTS permission multi-device test cases">
20
21    <option name="test-suite-tag" value="cts" />
22
23    <option name="config-descriptor:metadata" key="component" value="permissions" />
24    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
25    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
26    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
27    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
28    <option name="config-descriptor:metadata" key="parameter" value="run_on_sdk_sandbox" />
29    <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.permission.apex" />
30    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.Sdk34ModuleController" />
31
32    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
33        <option name="force-skip-system-props" value="true" /> <!-- avoid restarting device -->
34        <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" />
35        <option name="restore-settings" value="true" />
36        <option name="screen-always-on" value="on" />
37        <option name="disable-device-config-sync" value="true" />
38    </target_preparer>
39
40    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
41        <option name="cleanup-apks" value="true" />
42        <option name="test-file-name" value="CtsPermissionMultiDeviceTestCases.apk" />
43    </target_preparer>
44
45    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
46        <option name="push" value="CtsAccessRemoteDeviceCamera.apk->/data/local/tmp/cts-permissionmultidevice/CtsAccessRemoteDeviceCamera.apk" />
47    </target_preparer>
48
49    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
50        <option name="run-command" value="appops set android.permissionmultidevice.cts REQUEST_INSTALL_PACKAGES allow" />
51        <!-- disable DeprecatedAbi warning -->
52        <option name="run-command" value="setprop debug.wm.disable_deprecated_abi_dialog 1" />
53        <!-- disable DeprecatedTargetSdk warning -->
54        <option name="run-command" value="setprop debug.wm.disable_deprecated_target_sdk_dialog 1" />
55        <!-- Ensure all broadcasts are dispatched prior to running our tests, to make sure they
56     aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which
57     causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. -->
58        <option name="run-command" value="am wait-for-broadcast-idle" />
59        <option name="run-command" value="am wait-for-broadcast-barrier"  />
60        <!-- Dismiss any system dialogs (e.g. crashes, ANR). -->
61        <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground"  />
62        <!-- Ensure consistent Intent launch by overriding device provision and user setup status -->
63        <option name="run-command" value="settings put global device_provisioned 1" />
64        <option name="run-command" value="settings put secure user_setup_complete 1" />
65    </target_preparer>
66
67    <!-- Create place to store apks -->
68    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
69        <option name="run-command" value="mkdir -p /data/local/tmp/cts-permissionmultidevice" />
70        <option name="teardown-command" value="rm -rf /data/local/tmp/cts-permissionmultidevice"/>
71    </target_preparer>
72
73    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
74        <option name="package" value="android.permissionmultidevice.cts" />
75        <option name="runtime-hint" value="5m" />
76        <option name="device-listeners" value="android.device.collectors.ScreenshotOnFailureCollector"/>
77    </test>
78
79    <!-- Collect the dumped files for debugging -->
80    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
81        <option name="pull-pattern-keys" value="view_.*" />
82        <!-- Collect the files generated on error -->
83        <option name="pull-pattern-keys" value="android.device.collectors.ScreenshotOnFailureCollector.*\.png"/>
84        <option name="directory-keys" value="/data/user/0/android.permissionmultidevice.cts/files" />
85        <option name="collect-on-run-ended-only" value="false" />
86    </metrics_collector>
87
88</configuration>
89