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 com.android.server.inputmethod.InputMethodManagerService} is 27 * calling {@link com.android.internal.view.IInputMethodClient#onUnbindMethod}. 28 */ 29 @Retention(SOURCE) 30 @IntDef(value = { 31 UnbindReason.UNSPECIFIED, 32 UnbindReason.SWITCH_CLIENT, 33 UnbindReason.SWITCH_IME, 34 UnbindReason.DISCONNECT_IME, 35 UnbindReason.NO_IME, 36 UnbindReason.SWITCH_IME_FAILED, 37 UnbindReason.SWITCH_USER}) 38 public @interface UnbindReason { 39 /** 40 * Reason is not specified. 41 */ 42 int UNSPECIFIED = 0; 43 /** 44 * When a new IME client becomes active, the previous IME client will unbound from the current 45 * IME. 46 */ 47 int SWITCH_CLIENT = 1; 48 /** 49 * Before a new IME becomes active, the current IME client be unbound from the previous IME. 50 */ 51 int SWITCH_IME = 2; 52 /** 53 * When the current IME is disconnected, the current IME client will be unbound. 54 */ 55 int DISCONNECT_IME = 3; 56 /** 57 * When the system loses the last enabled IME, the current IME client will be unbound. 58 */ 59 int NO_IME = 4; 60 /** 61 * When the system failed to switch to another IME, the current IME client will be unbound. 62 */ 63 int SWITCH_IME_FAILED = 5; 64 /** 65 * When a new user becomes foreground, the previous IME client will be unbound from the previous 66 * user's active IME. 67 */ 68 int SWITCH_USER = 6; 69 } 70