blob: 946ce858c12dff8f40349b03ac5e2fa84a8313b4 [file] [log] [blame]
Yohei Yukawac6632df2018-10-21 11:47:16 -07001/*
2 * Copyright (C) 2018 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;
22
23import java.lang.annotation.Retention;
24
25/**
26 * Describes the reason why {@link android.view.inputmethod.InputMethodManager} is calling
27 * {@link com.android.internal.view.IInputMethodManager#startInputOrWindowGainedFocus}.
28 */
29@Retention(SOURCE)
Yohei Yukawa42194222018-10-21 20:14:40 -070030@IntDef(value = {
31 StartInputReason.UNSPECIFIED,
32 StartInputReason.WINDOW_FOCUS_GAIN,
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080033 StartInputReason.WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR,
34 StartInputReason.WINDOW_FOCUS_GAIN_REPORT_WITHOUT_EDITOR,
Yohei Yukawa42194222018-10-21 20:14:40 -070035 StartInputReason.APP_CALLED_RESTART_INPUT_API,
36 StartInputReason.CHECK_FOCUS,
37 StartInputReason.BOUND_TO_IMMS,
38 StartInputReason.UNBOUND_FROM_IMMS,
39 StartInputReason.ACTIVATED_BY_IMMS,
40 StartInputReason.DEACTIVATED_BY_IMMS,
41 StartInputReason.SESSION_CREATED_BY_IME})
Yohei Yukawac6632df2018-10-21 11:47:16 -070042public @interface StartInputReason {
43 /**
44 * Reason is not specified.
45 */
Yohei Yukawa42194222018-10-21 20:14:40 -070046 int UNSPECIFIED = 0;
Yohei Yukawac6632df2018-10-21 11:47:16 -070047 /**
48 * {@link android.view.Window} gained focus and it made the focused {@link android.view.View}
49 * to (re)start a new connection.
50 */
Yohei Yukawa42194222018-10-21 20:14:40 -070051 int WINDOW_FOCUS_GAIN = 1;
Yohei Yukawac6632df2018-10-21 11:47:16 -070052 /**
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080053 * {@link android.view.Window} gained focus and the focused view is same as current served
54 * view and its input connection remains. {@link android.view.inputmethod.InputMethodManager}
55 * just reports this window focus change event to sync IME input target for system.
Yohei Yukawac6632df2018-10-21 11:47:16 -070056 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080057 int WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR = 2;
58 /**
59 * {@link android.view.Window} gained focus but there is no {@link android.view.View} that is
60 * eligible to have IME focus. {@link android.view.inputmethod.InputMethodManager} just reports
61 * this window focus change event for logging.
62 */
63 int WINDOW_FOCUS_GAIN_REPORT_WITHOUT_EDITOR = 3;
Yohei Yukawac6632df2018-10-21 11:47:16 -070064 /**
65 * {@link android.view.inputmethod.InputMethodManager#restartInput(android.view.View)} is
66 * either explicitly called by the application or indirectly called by some Framework class
67 * (e.g. {@link android.widget.EditText}).
68 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080069 int APP_CALLED_RESTART_INPUT_API = 4;
Yohei Yukawac6632df2018-10-21 11:47:16 -070070 /**
71 * {@link android.view.View} requested a new connection because of view focus change.
72 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080073 int CHECK_FOCUS = 5;
Yohei Yukawac6632df2018-10-21 11:47:16 -070074 /**
75 * {@link android.view.inputmethod.InputMethodManager} is responding to
76 * {@link com.android.internal.view.IInputMethodClient#onBindMethod}.
77 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080078 int BOUND_TO_IMMS = 6;
Yohei Yukawac6632df2018-10-21 11:47:16 -070079 /**
80 * {@link android.view.inputmethod.InputMethodManager} is responding to
81 * {@link com.android.internal.view.IInputMethodClient#onUnbindMethod}.
82 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080083 int UNBOUND_FROM_IMMS = 7;
Yohei Yukawac6632df2018-10-21 11:47:16 -070084 /**
85 * {@link android.view.inputmethod.InputMethodManager} is responding to
86 * {@link com.android.internal.view.IInputMethodClient#setActive}.
87 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080088 int ACTIVATED_BY_IMMS = 8;
Yohei Yukawac6632df2018-10-21 11:47:16 -070089 /**
90 * {@link android.view.inputmethod.InputMethodManager} is responding to
91 * {@link com.android.internal.view.IInputMethodClient#setActive}.
92 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080093 int DEACTIVATED_BY_IMMS = 9;
Yohei Yukawac6632df2018-10-21 11:47:16 -070094 /**
95 * {@link com.android.server.inputmethod.InputMethodManagerService} is responding to
96 * {@link com.android.internal.view.IInputSessionCallback#sessionCreated}.
97 */
Ming-Shin Lu48bfc312020-06-15 20:06:09 +080098 int SESSION_CREATED_BY_IME = 10;
Yohei Yukawac6632df2018-10-21 11:47:16 -070099}