blob: 79397b81ace7da59c1b4278d587b2df9094570b1 [file] [log] [blame]
lumarkd85e1582019-12-29 20:20:41 +08001/*
2 * Copyright (C) 2020 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
17package com.android.internal.inputmethod;
18
19import static java.lang.annotation.RetentionPolicy.SOURCE;
20
21import android.annotation.IntDef;
22import android.view.WindowManager.LayoutParams;
23
24import java.lang.annotation.Retention;
25
26/**
27 * Describes the reason why Soft input window visible / hidden.
28 */
29@Retention(SOURCE)
30@IntDef(value = {
31 SoftInputShowHideReason.SHOW_SOFT_INPUT,
32 SoftInputShowHideReason.ATTACH_NEW_INPUT,
33 SoftInputShowHideReason.SHOW_MY_SOFT_INPUT,
34 SoftInputShowHideReason.HIDE_SOFT_INPUT,
35 SoftInputShowHideReason.HIDE_MY_SOFT_INPUT,
36 SoftInputShowHideReason.SHOW_AUTO_EDITOR_FORWARD_NAV,
37 SoftInputShowHideReason.SHOW_STATE_VISIBLE_FORWARD_NAV,
38 SoftInputShowHideReason.SHOW_STATE_ALWAYS_VISIBLE,
39 SoftInputShowHideReason.SHOW_SETTINGS_ON_CHANGE,
40 SoftInputShowHideReason.HIDE_SWITCH_USER,
41 SoftInputShowHideReason.HIDE_INVALID_USER,
42 SoftInputShowHideReason.HIDE_UNSPECIFIED_WINDOW,
43 SoftInputShowHideReason.HIDE_STATE_HIDDEN_FORWARD_NAV,
44 SoftInputShowHideReason.HIDE_ALWAYS_HIDDEN_STATE,
45 SoftInputShowHideReason.HIDE_RESET_SHELL_COMMAND,
46 SoftInputShowHideReason.HIDE_SETTINGS_ON_CHANGE,
47 SoftInputShowHideReason.HIDE_POWER_BUTTON_GO_HOME,
48 SoftInputShowHideReason.HIDE_DOCKED_STACK_ATTACHED,
49 SoftInputShowHideReason.HIDE_RECENTS_ANIMATION})
50public @interface SoftInputShowHideReason {
51 /** Show soft input by {@link android.view.inputmethod.InputMethodManager#showSoftInput}. */
52 int SHOW_SOFT_INPUT = 0;
53
54 /** Show soft input when {@code InputMethodManagerService#attachNewInputLocked} called. */
55 int ATTACH_NEW_INPUT = 1;
56
57 /** Show soft input by {@code InputMethodManagerService#showMySoftInput}. */
58 int SHOW_MY_SOFT_INPUT = 2;
59
60 /**
61 * Hide soft input by
62 * {@link android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow}.
63 */
64 int HIDE_SOFT_INPUT = 3;
65
66 /** Hide soft input by {@code InputMethodManagerService#hideMySoftInput}. */
67 int HIDE_MY_SOFT_INPUT = 4;
68
69 /**
70 * Show soft input when navigated forward to the window (with
71 * {@link LayoutParams#SOFT_INPUT_IS_FORWARD_NAVIGATION}} which the focused view is text
72 * editor and system will auto-show the IME when the window can resize or running on a large
73 * screen.
74 */
75 int SHOW_AUTO_EDITOR_FORWARD_NAV = 5;
76
77 /**
78 * Show soft input when navigated forward to the window with
79 * {@link LayoutParams#SOFT_INPUT_IS_FORWARD_NAVIGATION} and
80 * {@link LayoutParams#SOFT_INPUT_STATE_VISIBLE}.
81 */
82 int SHOW_STATE_VISIBLE_FORWARD_NAV = 6;
83
84 /**
85 * Show soft input when the window with {@link LayoutParams#SOFT_INPUT_STATE_ALWAYS_VISIBLE}.
86 */
87 int SHOW_STATE_ALWAYS_VISIBLE = 7;
88
89 /**
90 * Show soft input during {@code InputMethodManagerService} receive changes from
91 * {@code SettingsProvider}.
92 */
93 int SHOW_SETTINGS_ON_CHANGE = 8;
94
95 /** Hide soft input during switching user. */
96 int HIDE_SWITCH_USER = 9;
97
98 /** Hide soft input when the user is invalid. */
99 int HIDE_INVALID_USER = 10;
100
101 /**
102 * Hide soft input when the window with {@link LayoutParams#SOFT_INPUT_STATE_UNSPECIFIED} which
103 * the focused view is not text editor.
104 */
105 int HIDE_UNSPECIFIED_WINDOW = 11;
106
107 /**
108 * Hide soft input when navigated forward to the window with
109 * {@link LayoutParams#SOFT_INPUT_IS_FORWARD_NAVIGATION} and
110 * {@link LayoutParams#SOFT_INPUT_STATE_HIDDEN}.
111 */
112 int HIDE_STATE_HIDDEN_FORWARD_NAV = 12;
113
114 /**
115 * Hide soft input when the window with {@link LayoutParams#SOFT_INPUT_STATE_ALWAYS_HIDDEN}.
116 */
117 int HIDE_ALWAYS_HIDDEN_STATE = 13;
118
119 /** Hide soft input when "adb shell ime <command>" called. */
120 int HIDE_RESET_SHELL_COMMAND = 14;
121
122 /**
123 * Hide soft input during {@code InputMethodManagerService} receive changes from
124 * {@code SettingsProvider}.
125 */
126 int HIDE_SETTINGS_ON_CHANGE = 15;
127
128 /**
129 * Hide soft input from {@link com.android.server.policy.PhoneWindowManager} when setting
130 * {@link com.android.internal.R.integer#config_shortPressOnPowerBehavior} in config.xml as
131 * dismiss IME.
132 */
133 int HIDE_POWER_BUTTON_GO_HOME = 16;
134
135 /** Hide soft input when attaching docked stack. */
136 int HIDE_DOCKED_STACK_ATTACHED = 17;
137
138 /**
139 * Hide soft input when {@link com.android.server.wm.RecentsAnimationController} starts
140 * intercept touch from app window.
141 */
142 int HIDE_RECENTS_ANIMATION = 18;
143}