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="instant_app" />
22    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
23    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
24    <!--
25        TODO(yukawa): come up with a proper way to take care of devices that do not support
26        installable IMEs.  Ideally target_preparer should have an option to annotate required
27        features, e.g. android.software.input_methods so that we can conditionally install APKs
28        based on the feature supported in the target device.
29    -->
30    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
31        <option name="cleanup-apks" value="true" />
32        <!--
33            MockIME always needs to be instaleld as a full package, even when CTS is running
34            for instant apps.
35        -->
36        <option name="force-install-mode" value="FULL"/>
37        <option name="test-file-name" value="CtsMockInputMethod.apk" />
38    </target_preparer>
39    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
40        <option name="cleanup-apks" value="true" />
41        <!--
42            MockSpellChecker always needs to be instaleld as a full package, even when CTS is
43            running for instant apps.
44        -->
45        <option name="force-install-mode" value="FULL"/>
46        <option name="test-file-name" value="CtsMockSpellChecker.apk" />
47    </target_preparer>
48    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
49        <option name="cleanup-apks" value="true" />
50        <!--
51            SpellCheckingIme always needs to be instaleld as a full package, even when CTS is
52            running for instant apps.
53        -->
54        <option name="force-install-mode" value="FULL"/>
55        <option name="test-file-name" value="CtsSpellCheckingIme.apk" />
56    </target_preparer>
57    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
58        <option name="cleanup-apks" value="true" />
59        <!--
60            HiddenFromPickerIme always needs to be installed as a full package, even when CTS is
61            running for instant apps.
62        -->
63        <option name="force-install-mode" value="FULL"/>
64        <option name="test-file-name" value="CtsHiddenFromPickerIme.apk" />
65    </target_preparer>
66    <!--
67        TODO(yukawa): come up with a proper way to take care of devices that do not support
68        installable IMEs.  Ideally target_preparer should have an option to annotate required
69        features, e.g. android.software.input_methods so that we can conditionally install APKs
70        based on the feature supported in the target device.
71    -->
72
73    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
74        <option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
75        <option name="run-command" value="wm dismiss-keyguard" />
76    </target_preparer>
77
78    <!--
79        A (separate) standalone test app APK is needed to test implicit app-visibility from the IME
80        process to the IME target process, because if the IME target process is directly interacting
81        with MockIme process via MockImeSession, then the system would already give the MockIme an
82        implicit app-visibility back to the test app.  To fully test app-visibility scenario,
83        MockImeSession cannot be used in the process where the focused Activity is hosted.
84    -->
85    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
86        <option name="cleanup-apks" value="true" />
87        <!--
88            In order to simulate the scenario where the IME client process is normally
89            installed, explicitly set false here.  Otherwise, the test APP will be installed under
90            force-queryable mode, which makes the test useless.
91        -->
92        <option name="force-queryable" value="false" />
93        <option name="test-file-name" value="CtsInputMethodStandaloneTestApp.apk" />
94    </target_preparer>
95
96    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
97        <option name="cleanup-apks" value="true" />
98        <option name="test-file-name" value="CtsInputMethodTestCases.apk" />
99    </target_preparer>
100    <!-- Enabling change id ALLOW_TEST_API_ACCESS allows that package to access @TestApi methods -->
101    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
102        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS com.android.cts.mockime"  />
103        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS com.android.cts.mockime" />
104        <option name="run-command" value="am compat enable ALLOW_TEST_API_ACCESS android.view.inputmethod.ctstestapp"  />
105        <option name="teardown-command" value="am compat reset ALLOW_TEST_API_ACCESS android.view.inputmethod.ctstestapp" />
106    </target_preparer>
107    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
108        <option name="package" value="android.view.inputmethod.cts" />
109        <option name="runtime-hint" value="1m0s" />
110    </test>
111</configuration>
112