1 /*
2  * Copyright (C) 2024 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.systemui.inputmethod.data.model
18 
19 /**
20  * Models an input method editor (IME).
21  *
22  * @see android.view.inputmethod.InputMethodInfo
23  */
24 data class InputMethodModel(
25     /** A unique ID for the user associated with this input method. */
26     val userId: Int,
27     /** A unique ID for this input method. */
28     val imeId: String,
29     /** The subtypes of this IME (may be empty). */
30     val subtypes: List<Subtype>,
31 ) {
32     /**
33      * A Subtype can describe locale (e.g. en_US, fr_FR...) and mode (e.g. voice, keyboard), and is
34      * used for IME switch and settings.
35      *
36      * @see android.view.inputmethod.InputMethodSubtype
37      */
38     data class Subtype(
39         /** A unique ID for this IME subtype. */
40         val subtypeId: Int,
41         /**
42          * Whether this subtype is auxiliary. An auxiliary subtype will not be shown in the list of
43          * enabled IMEs for choosing the current IME in Settings, but it will be shown in the list
44          * of IMEs in the IME switcher to allow the user to tentatively switch to this subtype while
45          * an IME is shown.
46          *
47          * The intent of this flag is to allow for IMEs that are invoked in a one-shot way as
48          * auxiliary input mode, and return to the previous IME once it is finished (e.g. voice
49          * input).
50          */
51         val isAuxiliary: Boolean,
52     )
53 }
54