1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2023 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="Runs WindowManager Shell Flicker Tests {MODULE}">
18    <option name="test-tag" value="FlickerTests"/>
19    <!-- Needed for storing the perfetto trace files in the sdcard/test_results-->
20    <option name="isolated-storage" value="false"/>
21
22    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
23        <!-- disable DeprecatedTargetSdk warning -->
24        <option name="run-command" value="setprop debug.wm.disable_deprecated_target_sdk_dialog 1"/>
25        <!-- keeps the screen on during tests -->
26        <option name="screen-always-on" value="on"/>
27        <!-- prevents the phone from restarting -->
28        <option name="force-skip-system-props" value="true"/>
29        <!-- set WM tracing verbose level to all -->
30        <option name="run-command" value="cmd window tracing level all"/>
31        <!-- set WM tracing to frame (avoid incomplete states) -->
32        <option name="run-command" value="cmd window tracing frame"/>
33        <!-- disable betterbug as it's log collection dialogues cause flakes in e2e tests -->
34        <option name="run-command" value="pm disable com.google.android.internal.betterbug"/>
35        <!-- ensure lock screen mode is swipe -->
36        <option name="run-command" value="locksettings set-disabled false"/>
37        <!-- restart launcher to activate TAPL -->
38        <option name="run-command"
39                value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher"/>
40        <!-- Increase trace size: 20mb for WM and 80mb for SF -->
41        <option name="run-command" value="cmd window tracing size 20480"/>
42        <option name="run-command" value="su root service call SurfaceFlinger 1029 i32 81920"/>
43    </target_preparer>
44    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
45        <option name="test-user-token" value="%TEST_USER%"/>
46        <option name="run-command" value="rm -rf /data/user/%TEST_USER%/files/*"/>
47        <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1"/>
48        <option name="run-command" value="settings put system show_touches 1"/>
49        <option name="run-command" value="settings put system pointer_location 1"/>
50        <option name="teardown-command"
51                value="settings delete secure show_ime_with_hard_keyboard"/>
52        <option name="teardown-command" value="settings delete system show_touches"/>
53        <option name="teardown-command" value="settings delete system pointer_location"/>
54        <option name="teardown-command"
55                value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/>
56    </target_preparer>
57    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
58        <option name="cleanup-apks" value="true"/>
59        <option name="test-file-name" value="{MODULE}.apk"/>
60        <option name="test-file-name" value="FlickerTestApp.apk"/>
61    </target_preparer>
62    <!-- Enable mocking GPS location by the test app -->
63    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
64        <option name="run-command"
65                value="appops set com.android.wm.shell.flicker.pip.apps android:mock_location allow"/>
66        <option name="teardown-command"
67                value="appops set com.android.wm.shell.flicker.pip.apps android:mock_location deny"/>
68    </target_preparer>
69
70    <!-- Needed for pushing the trace config file -->
71    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
72    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
73        <option name="push-file"
74                key="trace_config.textproto"
75                value="/data/misc/perfetto-traces/trace_config.textproto"
76        />
77        <!--Install the content provider automatically when we push some file in sdcard folder.-->
78        <!--Needed to avoid the installation during the test suite.-->
79        <option name="push-file" key="trace_config.textproto" value="/sdcard/sample.textproto"/>
80    </target_preparer>
81    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
82        <option name="package" value="{PACKAGE}"/>
83        <option name="shell-timeout" value="6600s"/>
84        <option name="test-timeout" value="6000s"/>
85        <option name="hidden-api-checks" value="false"/>
86        <option name="device-listeners" value="android.device.collectors.PerfettoListener"/>
87        <!-- PerfettoListener related arguments -->
88        <option name="instrumentation-arg" key="perfetto_config_text_proto" value="true"/>
89        <option name="instrumentation-arg"
90                key="perfetto_config_file"
91                value="trace_config.textproto"
92        />
93        <option name="instrumentation-arg" key="per_run" value="true"/>
94        <option name="instrumentation-arg" key="perfetto_persist_pid_track" value="true"/>
95    </test>
96    <!-- Needed for pulling the collected trace config on to the host -->
97    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
98        <option name="pull-pattern-keys" value="perfetto_file_path"/>
99        <option name="directory-keys"
100                value="/data/user/0/com.android.wm.shell.flicker/files"/>
101        <option name="collect-on-run-ended-only" value="true"/>
102        <option name="clean-up" value="true"/>
103    </metrics_collector>
104</configuration>
105