Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.internal.inputmethod; |
| 18 | |
| 19 | import static java.lang.annotation.RetentionPolicy.SOURCE; |
| 20 | |
| 21 | import android.annotation.IntDef; |
| 22 | |
| 23 | import 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 Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 30 | @IntDef(value = { |
| 31 | StartInputReason.UNSPECIFIED, |
| 32 | StartInputReason.WINDOW_FOCUS_GAIN, |
| 33 | StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, |
| 34 | StartInputReason.APP_CALLED_RESTART_INPUT_API, |
| 35 | StartInputReason.CHECK_FOCUS, |
| 36 | StartInputReason.BOUND_TO_IMMS, |
| 37 | StartInputReason.UNBOUND_FROM_IMMS, |
| 38 | StartInputReason.ACTIVATED_BY_IMMS, |
| 39 | StartInputReason.DEACTIVATED_BY_IMMS, |
| 40 | StartInputReason.SESSION_CREATED_BY_IME}) |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 41 | public @interface StartInputReason { |
| 42 | /** |
| 43 | * Reason is not specified. |
| 44 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 45 | int UNSPECIFIED = 0; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 46 | /** |
| 47 | * {@link android.view.Window} gained focus and it made the focused {@link android.view.View} |
| 48 | * to (re)start a new connection. |
| 49 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 50 | int WINDOW_FOCUS_GAIN = 1; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 51 | /** |
| 52 | * {@link android.view.Window} gained focus but there is no {@link android.view.View} that is |
Ming-Shin Lu | 6ecbf08 | 2020-06-01 17:42:32 +0800 | [diff] [blame] | 53 | * eligible to have IME focus, or the focused view is same as current served view and its |
| 54 | * input connection remains. {@link android.view.inputmethod.InputMethodManager} just reports |
| 55 | * this window focus change event to sync IME input target for system. |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 56 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 57 | int WINDOW_FOCUS_GAIN_REPORT_ONLY = 2; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 58 | /** |
| 59 | * {@link android.view.inputmethod.InputMethodManager#restartInput(android.view.View)} is |
| 60 | * either explicitly called by the application or indirectly called by some Framework class |
| 61 | * (e.g. {@link android.widget.EditText}). |
| 62 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 63 | int APP_CALLED_RESTART_INPUT_API = 3; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 64 | /** |
| 65 | * {@link android.view.View} requested a new connection because of view focus change. |
| 66 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 67 | int CHECK_FOCUS = 4; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 68 | /** |
| 69 | * {@link android.view.inputmethod.InputMethodManager} is responding to |
| 70 | * {@link com.android.internal.view.IInputMethodClient#onBindMethod}. |
| 71 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 72 | int BOUND_TO_IMMS = 5; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 73 | /** |
| 74 | * {@link android.view.inputmethod.InputMethodManager} is responding to |
| 75 | * {@link com.android.internal.view.IInputMethodClient#onUnbindMethod}. |
| 76 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 77 | int UNBOUND_FROM_IMMS = 6; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 78 | /** |
| 79 | * {@link android.view.inputmethod.InputMethodManager} is responding to |
| 80 | * {@link com.android.internal.view.IInputMethodClient#setActive}. |
| 81 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 82 | int ACTIVATED_BY_IMMS = 7; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 83 | /** |
| 84 | * {@link android.view.inputmethod.InputMethodManager} is responding to |
| 85 | * {@link com.android.internal.view.IInputMethodClient#setActive}. |
| 86 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 87 | int DEACTIVATED_BY_IMMS = 8; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 88 | /** |
| 89 | * {@link com.android.server.inputmethod.InputMethodManagerService} is responding to |
| 90 | * {@link com.android.internal.view.IInputSessionCallback#sessionCreated}. |
| 91 | */ |
Yohei Yukawa | 4219422 | 2018-10-21 20:14:40 -0700 | [diff] [blame] | 92 | int SESSION_CREATED_BY_IME = 9; |
Yohei Yukawa | c6632df | 2018-10-21 11:47:16 -0700 | [diff] [blame] | 93 | } |