1/*
2 * Copyright (C) 2008 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.view;
18
19import android.net.Uri;
20import android.os.ResultReceiver;
21import android.text.style.SuggestionSpan;
22import android.view.inputmethod.InputMethodInfo;
23import android.view.inputmethod.InputMethodSubtype;
24import android.view.inputmethod.EditorInfo;
25import com.android.internal.inputmethod.IInputContentUriToken;
26import com.android.internal.view.InputBindResult;
27import com.android.internal.view.IInputContext;
28import com.android.internal.view.IInputMethodClient;
29
30/**
31 * Public interface to the global input method manager, used by all client
32 * applications.
33 * You need to update BridgeIInputMethodManager.java as well when changing
34 * this file.
35 */
36interface IInputMethodManager {
37    // TODO: Use ParceledListSlice instead
38    List<InputMethodInfo> getInputMethodList();
39    List<InputMethodInfo> getVrInputMethodList();
40    // TODO: Use ParceledListSlice instead
41    List<InputMethodInfo> getEnabledInputMethodList();
42    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in String imiId,
43            boolean allowsImplicitlySelectedSubtypes);
44    InputMethodSubtype getLastInputMethodSubtype();
45    // TODO: We should change the return type from List to List<Parcelable>
46    // Currently there is a bug that aidl doesn't accept List<Parcelable>
47    List getShortcutInputMethodsAndSubtypes();
48    void addClient(in IInputMethodClient client,
49            in IInputContext inputContext, int uid, int pid);
50    void removeClient(in IInputMethodClient client);
51
52    void finishInput(in IInputMethodClient client);
53    boolean showSoftInput(in IInputMethodClient client, int flags,
54            in ResultReceiver resultReceiver);
55    boolean hideSoftInput(in IInputMethodClient client, int flags,
56            in ResultReceiver resultReceiver);
57    // If windowToken is null, this just does startInput().  Otherwise this reports that a window
58    // has gained focus, and if 'attribute' is non-null then also does startInput.
59    // @NonNull
60    InputBindResult startInputOrWindowGainedFocus(
61            /* @InputMethodClient.StartInputReason */ int startInputReason,
62            in IInputMethodClient client, in IBinder windowToken, int controlFlags,
63            /* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
64            int windowFlags, in EditorInfo attribute, IInputContext inputContext,
65            /* @InputConnectionInspector.MissingMethodFlags */ int missingMethodFlags,
66            int unverifiedTargetSdkVersion);
67
68    void showInputMethodPickerFromClient(in IInputMethodClient client,
69            int auxiliarySubtypeMode);
70    void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId);
71    boolean isInputMethodPickerShownForTest();
72    void setInputMethod(in IBinder token, String id);
73    void setInputMethodAndSubtype(in IBinder token, String id, in InputMethodSubtype subtype);
74    void hideMySoftInput(in IBinder token, int flags);
75    void showMySoftInput(in IBinder token, int flags);
76    void updateStatusIcon(in IBinder token, String packageName, int iconId);
77    void setImeWindowStatus(in IBinder token, in IBinder startInputToken, int vis,
78            int backDisposition);
79    void registerSuggestionSpansForNotification(in SuggestionSpan[] spans);
80    boolean notifySuggestionPicked(in SuggestionSpan span, String originalString, int index);
81    InputMethodSubtype getCurrentInputMethodSubtype();
82    boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype);
83    boolean switchToPreviousInputMethod(in IBinder token);
84    boolean switchToNextInputMethod(in IBinder token, boolean onlyCurrentIme);
85    boolean shouldOfferSwitchingToNextInputMethod(in IBinder token);
86    void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
87    int getInputMethodWindowVisibleHeight();
88    void clearLastInputMethodWindowForTransition(in IBinder token);
89
90    IInputContentUriToken createInputContentUriToken(in IBinder token, in Uri contentUri,
91            in String packageName);
92
93    void reportFullscreenMode(in IBinder token, boolean fullscreen);
94
95    oneway void notifyUserAction(int sequenceNumber);
96}
97