1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  Copyright (C) 2017 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
18<configuration description="Config for CTS InputMethod test cases">
19    <option name="test-suite-tag" value="cts" />
20    <option name="config-descriptor:metadata" key="component" value="inputmethod" />
21    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
22    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
23    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
24    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
25    <option name="config-descriptor:metadata" key="parameter" value="secondary_user_on_secondary_display" />
26    <option name="config-descriptor:metadata" key="parameter" value="run_on_sdk_sandbox" />
27    <!--
28        TODO(yukawa): come up with a proper way to take care of devices that do not support
29        installable IMEs.  Ideally target_preparer should have an option to annotate required
30        features, e.g. android.software.input_methods so that we can conditionally install APKs
31        based on the feature supported in the target device.
32    -->
33    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
34        <option name="cleanup-apks" value="true" />
35        <!--
36            MockIME always needs to be instaleld as a full package, even when CTS is running
37            for instant apps.
38        -->
39        <option name="force-install-mode" value="FULL"/>
40        <!--
41            Enabling force-queryable makes package visibility tests impossible. So opt it out.
42        -->
43        <option name="force-queryable" value="false" />
44        <option name="test-file-name" value="CtsMockInputMethod.apk" />
45    </target_preparer>
46    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
47        <option name="cleanup-apks" value="true" />
48        <!--
49            MockIME always needs to be installed as a full package, even when CTS is running
50            for instant apps.
51        -->
52        <option name="force-install-mode" value="FULL"/>
53        <!--
54            Enabling force-queryable makes package visibility tests impossible. So opt it out.
55        -->
56        <option name="force-queryable" value="false" />
57        <option name="test-file-name" value="CtsMockInputMethod2.apk" />
58    </target_preparer>
59    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
60        <option name="cleanup-apks" value="true" />
61        <!--
62            MockSpellChecker always needs to be instaleld as a full package, even when CTS is
63            running for instant apps.
64        -->
65        <option name="force-install-mode" value="FULL"/>
66        <!--
67            Enabling force-queryable makes package visibility tests impossible. So opt it out.
68        -->
69        <option name="force-queryable" value="false" />
70        <option name="test-file-name" value="CtsMockSpellChecker.apk" />
71    </target_preparer>
72    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
73        <option name="cleanup-apks" value="true" />
74        <!--
75            SpellCheckingIme always needs to be instaleld as a full package, even when CTS is
76            running for instant apps.
77        -->
78        <option name="force-install-mode" value="FULL"/>
79        <option name="test-file-name" value="CtsSpellCheckingIme.apk" />
80    </target_preparer>
81    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
82        <option name="cleanup-apks" value="true" />
83        <!--
84            HiddenFromPickerIme always needs to be installed as a full package, even when CTS is
85            running for instant apps.
86        -->
87        <option name="force-install-mode" value="FULL"/>
88        <!--
89            Enabling force-queryable makes package visibility tests impossible. So opt it out.
90        -->
91        <option name="force-queryable" value="false" />
92        <option name="test-file-name" value="CtsHiddenFromPickerIme.apk" />
93    </target_preparer>
94    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
95        <option name="cleanup-apks" value="true" />
96        <!--
97            CtsMockA11yInputMethod always needs to be instaleld as a full package, even when CTS is
98            running for instant apps.
99        -->
100        <option name="force-install-mode" value="FULL"/>
101        <!--
102            Enabling force-queryable makes package visibility tests impossible. So opt it out.
103        -->
104        <option name="force-queryable" value="false" />
105        <option name="test-file-name" value="CtsMockA11yInputMethod.apk" />
106    </target_preparer>
107    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
108        <option name="cleanup" value="true" />
109        <!--
110            CtsMockLargeResourceInputMethod should not always be installed, but the apk must be
111            available.
112        -->
113        <option name="push" value="CtsMockLargeResourceInputMethod.apk->/data/local/tmp/cts/inputmethod/CtsMockLargeResourceInputMethod.apk" />
114    </target_preparer>
115    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
116        <option name="cleanup-apks" value="true" />
117        <!--
118            CtsMockInputMethodWithSubtypes always needs to be installed as a full package, even when
119            CTS is running for instant apps.
120        -->
121        <option name="force-install-mode" value="FULL"/>
122        <!--
123            Enabling force-queryable makes package visibility tests impossible. So opt it out.
124        -->
125        <option name="force-queryable" value="false" />
126        <option name="test-file-name" value="CtsMockInputMethodWithSubtypes.apk" />
127    </target_preparer>
128    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
129        <option name="cleanup-apks" value="true" />
130        <!--
131            TestIme always needs to be installed as a full package, even when CTS is running for
132            instant apps.
133        -->
134        <option name="force-install-mode" value="FULL"/>
135        <!--
136            Enabling force-queryable makes package visibility tests impossible. So opt it out.
137        -->
138        <option name="force-queryable" value="false" />
139        <option name="test-file-name" value="TestIme.apk" />
140    </target_preparer>
141
142    <!--
143        TODO(yukawa): come up with a proper way to take care of devices that do not support
144        installable IMEs.  Ideally target_preparer should have an option to annotate required
145        features, e.g. android.software.input_methods so that we can conditionally install APKs
146        based on the feature supported in the target device.
147    -->
148
149    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
150        <option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
151        <option name="run-command" value="wm dismiss-keyguard" />
152    </target_preparer>
153
154    <!--
155        A (separate) standalone test app APK is needed to test implicit app-visibility from the IME
156        process to the IME target process, because if the IME target process is directly interacting
157        with MockIme process via MockImeSession, then the system would already give the MockIme an
158        implicit app-visibility back to the test app.  To fully test app-visibility scenario,
159        MockImeSession cannot be used in the process where the focused Activity is hosted.
160    -->
161    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
162        <option name="cleanup-apks" value="true" />
163        <!--
164            In order to simulate the scenario where the IME client process is normally
165            installed, explicitly set false here.  Otherwise, the test APP will be installed under
166            force-queryable mode, which makes the test useless.
167        -->
168        <option name="force-queryable" value="false" />
169        <option name="test-file-name" value="CtsInputMethodStandaloneTestApp.apk" />
170    </target_preparer>
171
172    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
173        <option name="cleanup-apks" value="true" />
174        <option name="test-file-name" value="CtsInputMethodTestLauncher.apk" />
175    </target_preparer>
176
177    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
178        <option name="cleanup-apks" value="true" />
179        <option name="install-arg" value="-t" />
180        <option name="test-file-name" value="CtsInputMethodTestCases.apk" />
181    </target_preparer>
182    <!-- Enabling change id ALLOW_TEST_API_ACCESS allows that package to access @TestApi methods -->
183    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
184        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS com.android.cts.mockime"  />
185        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS com.android.cts.mockime" />
186        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS com.android.cts.mockime2"  />
187        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS com.android.cts.mockime2" />
188        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS com.android.cts.mocka11yime"  />
189        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS com.android.cts.mocka11yime" />
190        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS android.view.inputmethod.ctstestapp"  />
191        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS android.view.inputmethod.ctstestapp" />
192        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS android.view.inputmethod.mocklargeresourceime"  />
193        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS android.view.inputmethod.mocklargeresourceime" />
194        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS android.view.inputmethod.mockimewithsubtypes" />
195
196        <!-- Wait for PACKAGE_ADDED broadcasts to be delivered to InputMethodManagerService. -->
197        <option name="run-command" value="am wait-for-broadcast-barrier"  />
198        <!-- Dismiss any system dialogs (e.g. crashes, ANR). -->
199        <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground"  />
200    </target_preparer>
201
202    <!-- Create a place to store files for DumpOnFailure -->
203    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
204        <option name="run-command" value="mkdir -p /sdcard/DumpOnFailure" />
205    </target_preparer>
206    <!-- Collect the files from DumpOnFailure. -->
207    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
208        <option name="directory-keys" value="/sdcard/DumpOnFailure" />
209        <option name="collect-on-run-ended-only" value="true" />
210    </metrics_collector>
211
212    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
213        <option name="package" value="android.view.inputmethod.cts" />
214        <option name="runtime-hint" value="1m0s" />
215    </test>
216</configuration>
217