1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.inputmethodservice.cts.common;
18 
19 /**
20  * Constants of IME command android.content.Intent.
21  */
22 public final class ImeCommandConstants {
23 
24     // This is constants holding class, can't instantiate.
ImeCommandConstants()25     private ImeCommandConstants() {}
26 
27     /** Intent action in order to record IME events. */
28     public static final String ACTION_IME_COMMAND =
29             "android.inputmethodservice.cts.action.IME_COMMAND";
30 
31     public static final String EXTRA_COMMAND = "command";
32 
33     public static final String EXTRA_ARG_CHARSEQUENCE1 = "arg_charsequence1";
34     public static final String EXTRA_ARG_STRING1 = "arg_string1";
35     public static final String EXTRA_ARG_INT1 = "arg_int1";
36 
37     /**
38      * This command has the mock IME call {@link
39      * android.view.inputmethod.InputConnection#commitText(CharSequence,int).
40      * <ul>
41      * <li>argument {@code text} needs to be specified by {@link #EXTRA_ARG_CHARSEQUENCE1}.</li>
42      * <li>argument {@code newCursorPosition} needs to be specified by {@link #EXTRA_ARG_INT1}.</li>
43      * </ul>
44      */
45     public static final String COMMAND_COMMIT_TEXT = "commitText";
46 
47     /**
48      * This command has the mock IME call {@link
49      * android.inputmethodservice.InputMethodService#switchInputMethod(String)}.
50      * <ul>
51      * <li>argument {@code imeId} needs to be specified by {@link #EXTRA_ARG_STRING1}.</li>
52      * </ul>
53      */
54     public static final String COMMAND_SWITCH_INPUT_METHOD = "switchInputMethod";
55 
56     /**
57      * This command has the mock IME call {@link
58      * android.inputmethodservice.InputMethodService#switchInputMethod(String,
59      * android.view.inputmethod.InputMethodSubtype)}.
60      * <ul>
61      * <li>argument {@code imeId} needs to be specified by {@link #EXTRA_ARG_STRING1}.</li>
62      * </ul>
63      */
64     public static final String COMMAND_SWITCH_INPUT_METHOD_WITH_SUBTYPE =
65             "switchInputMethodWithSubtype";
66 
67     /**
68      * This command has the mock IME call {@link
69      * android.inputmethodservice.InputMethodService#switchToNextInputMethod(boolean)}.
70      */
71     public static final String COMMAND_SWITCH_TO_NEXT_INPUT = "switchToNextInput";
72 
73     /**
74      * This command has the mock IME call {@link
75      * android.inputmethodservice.InputMethodService#switchToPreviousInputMethod()}.
76      */
77     public static final String COMMAND_SWITCH_TO_PREVIOUS_INPUT = "switchToPreviousInputMethod";
78 
79     /**
80      * This command has the mock IME call {@link
81      * android.inputmethodservice.InputMethodService#requestHideSelf(int)}.
82      * <ul>
83      * <li>argument {@code flags} needs to be specified by {@link #EXTRA_ARG_INT1}.</li>
84      * </ul>
85      */
86     public static final String COMMAND_REQUEST_HIDE_SELF = "requestHideSelf";
87 }
88