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 android.view.inputmethod.InputConnection#commitText(CharSequence,int) InputConnection#commitText(CharSequence text, int newCursorPosition)}.
39      * <ul>
40      * <li>argument {@code text} needs to be specified by {@link #EXTRA_ARG_CHARSEQUENCE1}.</li>
41      * <li>argument {@code newCursorPosition} needs to be specified by {@link #EXTRA_ARG_INT1}.</li>
42      * </ul>
43      */
44     public static final String COMMAND_COMMIT_TEXT = "commitText";
45 
46     /**
47      * This command has the mock IME call {@link android.inputmethodservice.InputMethodService#switchInputMethod(String)} InputMethodService#switchInputMethod(String imeId)}.
48      * <ul>
49      * <li>argument {@code imeId} needs to be specified by {@link #EXTRA_ARG_STRING1}.</li>
50      * </ul>
51      */
52     public static final String COMMAND_SWITCH_INPUT_METHOD = "switchInputMethod";
53 
54     /**
55      * This command has the mock IME call {@link android.inputmethodservice.InputMethodService#switchInputMethod(String, InputMethodSubtype)} InputMethodService#switchInputMethod(String imeId, InputMethodSubtype subtype)}.
56      * <ul>
57      * <li>argument {@code imeId} needs to be specified by {@link #EXTRA_ARG_STRING1}.</li>
58      * </ul>
59      */
60     public static final String COMMAND_SWITCH_INPUT_METHOD_WITH_SUBTYPE = "switchInputMethodWithSubtype";
61 
62     /**
63      * This command has the mock IME call {@link android.inputmethodservice.InputMethodService#switchToNextInputMethod(boolean)} InputMethodService#switchToNextInputMethod(boolean onlyCurrentIme)}.
64      */
65     public static final String COMMAND_SWITCH_TO_NEXT_INPUT = "switchToNextInput";
66 
67     /**
68      * This command has the mock IME call {@link android.inputmethodservice.InputMethodService#switchToPreviousInputMethod()} InputMethodService#switchToPreviousInputMethod()}.
69      */
70     public static final String COMMAND_SWITCH_TO_PREVIOUS_INPUT = "switchToPreviousInputMethod";
71 
72     /**
73      * This command has the mock IME call {@link android.inputmethodservice.InputMethodService#requestHideSelf(int)} InputMethodService#requestHideSelf(int flags)}.
74      * <ul>
75      * <li>argument {@code flags} needs to be specified by {@link #EXTRA_ARG_INT1}.</li>
76      * </ul>
77      */
78     public static final String COMMAND_REQUEST_HIDE_SELF = "requestHideSelf";
79 }
80