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 
17 package com.android.internal.view;
18 
19 import android.net.Uri;
20 import android.os.ResultReceiver;
21 import android.text.style.SuggestionSpan;
22 import android.view.inputmethod.InputMethodInfo;
23 import android.view.inputmethod.InputMethodSubtype;
24 import android.view.inputmethod.EditorInfo;
25 import com.android.internal.inputmethod.IInputContentUriToken;
26 import com.android.internal.view.InputBindResult;
27 import com.android.internal.view.IInputContext;
28 import 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  */
36 interface IInputMethodManager {
37     // TODO: Use ParceledListSlice instead
getInputMethodList()38     List<InputMethodInfo> getInputMethodList();
getVrInputMethodList()39     List<InputMethodInfo> getVrInputMethodList();
40     // TODO: Use ParceledListSlice instead
getEnabledInputMethodList()41     List<InputMethodInfo> getEnabledInputMethodList();
getEnabledInputMethodSubtypeList(in String imiId, boolean allowsImplicitlySelectedSubtypes)42     List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in String imiId,
43             boolean allowsImplicitlySelectedSubtypes);
getLastInputMethodSubtype()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>
getShortcutInputMethodsAndSubtypes()47     List getShortcutInputMethodsAndSubtypes();
addClient(in IInputMethodClient client, in IInputContext inputContext, int uid, int pid)48     void addClient(in IInputMethodClient client,
49             in IInputContext inputContext, int uid, int pid);
removeClient(in IInputMethodClient client)50     void removeClient(in IInputMethodClient client);
51 
finishInput(in IInputMethodClient client)52     void finishInput(in IInputMethodClient client);
showSoftInput(in IInputMethodClient client, int flags, in ResultReceiver resultReceiver)53     boolean showSoftInput(in IInputMethodClient client, int flags,
54             in ResultReceiver resultReceiver);
hideSoftInput(in IInputMethodClient client, int flags, 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
startInputOrWindowGainedFocus( int startInputReason, in IInputMethodClient client, in IBinder windowToken, int controlFlags, int softInputMode, int windowFlags, in EditorInfo attribute, IInputContext inputContext, int missingMethodFlags, int unverifiedTargetSdkVersion)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 
showInputMethodPickerFromClient(in IInputMethodClient client, int auxiliarySubtypeMode)68     void showInputMethodPickerFromClient(in IInputMethodClient client,
69             int auxiliarySubtypeMode);
showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId)70     void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId);
isInputMethodPickerShownForTest()71     boolean isInputMethodPickerShownForTest();
setInputMethod(in IBinder token, String id)72     void setInputMethod(in IBinder token, String id);
setInputMethodAndSubtype(in IBinder token, String id, in InputMethodSubtype subtype)73     void setInputMethodAndSubtype(in IBinder token, String id, in InputMethodSubtype subtype);
hideMySoftInput(in IBinder token, int flags)74     void hideMySoftInput(in IBinder token, int flags);
showMySoftInput(in IBinder token, int flags)75     void showMySoftInput(in IBinder token, int flags);
updateStatusIcon(in IBinder token, String packageName, int iconId)76     void updateStatusIcon(in IBinder token, String packageName, int iconId);
setImeWindowStatus(in IBinder token, in IBinder startInputToken, int vis, int backDisposition)77     void setImeWindowStatus(in IBinder token, in IBinder startInputToken, int vis,
78             int backDisposition);
registerSuggestionSpansForNotification(in SuggestionSpan[] spans)79     void registerSuggestionSpansForNotification(in SuggestionSpan[] spans);
notifySuggestionPicked(in SuggestionSpan span, String originalString, int index)80     boolean notifySuggestionPicked(in SuggestionSpan span, String originalString, int index);
getCurrentInputMethodSubtype()81     InputMethodSubtype getCurrentInputMethodSubtype();
setCurrentInputMethodSubtype(in InputMethodSubtype subtype)82     boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype);
switchToPreviousInputMethod(in IBinder token)83     boolean switchToPreviousInputMethod(in IBinder token);
switchToNextInputMethod(in IBinder token, boolean onlyCurrentIme)84     boolean switchToNextInputMethod(in IBinder token, boolean onlyCurrentIme);
shouldOfferSwitchingToNextInputMethod(in IBinder token)85     boolean shouldOfferSwitchingToNextInputMethod(in IBinder token);
setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes)86     void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
getInputMethodWindowVisibleHeight()87     int getInputMethodWindowVisibleHeight();
clearLastInputMethodWindowForTransition(in IBinder token)88     void clearLastInputMethodWindowForTransition(in IBinder token);
89 
createInputContentUriToken(in IBinder token, in Uri contentUri, in String packageName)90     IInputContentUriToken createInputContentUriToken(in IBinder token, in Uri contentUri,
91             in String packageName);
92 
reportFullscreenMode(in IBinder token, boolean fullscreen)93     void reportFullscreenMode(in IBinder token, boolean fullscreen);
94 
notifyUserAction(int sequenceNumber)95     oneway void notifyUserAction(int sequenceNumber);
96 }
97