1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2022 The Android Open Source Project
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~      http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License.
16  -->
17<configuration description="Config for functional SafetyCenter test cases">
18
19    <object
20        class="com.android.tradefed.testtype.suite.module.Sdk33ModuleController"
21        type="module_controller"/>
22
23    <option name="config-descriptor:metadata" key="component" value="framework"/>
24    <option name="config-descriptor:metadata" key="parameter"
25            value="not_instant_app"/>
26    <option name="config-descriptor:metadata" key="parameter"
27            value="not_multi_abi"/>
28    <option name="config-descriptor:metadata" key="parameter"
29            value="secondary_user"/>
30    <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.permission.apex" />
31    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
32
33    <option name="test-suite-tag" value="functional"/>
34
35    <target_preparer
36        class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
37        <option name="cleanup-apks" value="true"/>
38        <option name="test-file-name" value="SafetyCenterFunctionalTestCases.apk"/>
39    </target_preparer>
40
41    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
42        <!-- Ensure all broadcasts are dispatched prior to running our tests, to make sure they
43             aren't polluted by `BOOT_COMPLETED` or similar broadcasts still being delivered, which
44             causes our `ActivityManager#waitForBroadcastIdle()` calls to timeout. -->
45        <option name="run-command" value="am wait-for-broadcast-idle" />
46        <option name="run-command" value="am wait-for-broadcast-barrier" />
47        <!-- Disable syncing to prevent overwriting flags during testing. -->
48        <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" />
49        <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" />
50        <!-- TODO(b/379928062): Ensure device not on lockscreen. Reassess when keyguard bug is
51             closed -->
52        <option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
53        <option name="run-command" value="wm dismiss-keyguard" />
54        <!-- Dismiss any system dialogs (e.g. crashes, ANR). -->
55        <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground"  />
56    </target_preparer>
57
58    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
59        <option name="directory-keys" value="/data/user/0/android.safetycenter.functional/files" />
60        <option name="collect-on-run-ended-only" value="true" />
61    </metrics_collector>
62
63    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
64        <option name="package" value="android.safetycenter.functional"/>
65        <option name="exclude-annotation" value="org.junit.Ignore"/>
66        <option name="runtime-hint" value="10m"/>
67    </test>
68</configuration>
69