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.inputmethod.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 })
39 public @interface UnbindReason {
40     /**
41      * Reason is not specified.
42      */
43     int UNSPECIFIED = 0;
44     /**
45      * When a new IME client becomes active, the previous IME client will unbound from the current
46      * IME.
47      */
48     int SWITCH_CLIENT = 1;
49     /**
50      * Before a new IME becomes active, the current IME client be unbound from the previous IME.
51      */
52     int SWITCH_IME = 2;
53     /**
54      * When the current IME is disconnected, the current IME client will be unbound.
55      */
56     int DISCONNECT_IME = 3;
57     /**
58      * When the system loses the last enabled IME, the current IME client will be unbound.
59      */
60     int NO_IME = 4;
61     /**
62      * When the system failed to switch to another IME, the current IME client will be unbound.
63      */
64     int SWITCH_IME_FAILED = 5;
65     /**
66      * When a new user becomes foreground, the previous IME client will be unbound from the previous
67      * user's active IME.
68      */
69     int SWITCH_USER = 6;
70 }
71