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.os.ResultReceiver; 20 import android.view.inputmethod.InputMethodInfo; 21 import android.view.inputmethod.InputMethodSubtype; 22 import android.view.inputmethod.EditorInfo; 23 import android.window.ImeOnBackInvokedDispatcher; 24 25 import com.android.internal.inputmethod.InputBindResult; 26 import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection; 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 */ 34 interface IInputMethodManager { addClient(in IInputMethodClient client, in IInputContext inputContext, int untrustedDisplayId)35 void addClient(in IInputMethodClient client, in IInputContext inputContext, 36 int untrustedDisplayId); 37 38 // TODO: Use ParceledListSlice instead getInputMethodList(int userId)39 List<InputMethodInfo> getInputMethodList(int userId); getAwareLockedInputMethodList(int userId, int directBootAwareness)40 List<InputMethodInfo> getAwareLockedInputMethodList(int userId, int directBootAwareness); 41 // TODO: Use ParceledListSlice instead getEnabledInputMethodList(int userId)42 List<InputMethodInfo> getEnabledInputMethodList(int userId); getEnabledInputMethodSubtypeList(in String imiId, boolean allowsImplicitlySelectedSubtypes)43 List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in String imiId, 44 boolean allowsImplicitlySelectedSubtypes); getLastInputMethodSubtype()45 InputMethodSubtype getLastInputMethodSubtype(); 46 showSoftInput(in IInputMethodClient client, IBinder windowToken, int flags, in ResultReceiver resultReceiver, int reason)47 boolean showSoftInput(in IInputMethodClient client, IBinder windowToken, int flags, 48 in ResultReceiver resultReceiver, int reason); hideSoftInput(in IInputMethodClient client, IBinder windowToken, int flags, in ResultReceiver resultReceiver, int reason)49 boolean hideSoftInput(in IInputMethodClient client, IBinder windowToken, int flags, 50 in ResultReceiver resultReceiver, int reason); 51 // If windowToken is null, this just does startInput(). Otherwise this reports that a window 52 // has gained focus, and if 'attribute' is non-null then also does startInput. 53 // @NonNull startInputOrWindowGainedFocus( int startInputReason, in IInputMethodClient client, in IBinder windowToken, int startInputFlags, int softInputMode, int windowFlags, in EditorInfo attribute, in IInputContext inputContext, in IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, in ImeOnBackInvokedDispatcher imeDispatcher)54 InputBindResult startInputOrWindowGainedFocus( 55 /* @StartInputReason */ int startInputReason, 56 in IInputMethodClient client, in IBinder windowToken, 57 /* @StartInputFlags */ int startInputFlags, 58 /* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode, 59 int windowFlags, in EditorInfo attribute, in IInputContext inputContext, 60 in IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, 61 int unverifiedTargetSdkVersion, in ImeOnBackInvokedDispatcher imeDispatcher); 62 showInputMethodPickerFromClient(in IInputMethodClient client, int auxiliarySubtypeMode)63 void showInputMethodPickerFromClient(in IInputMethodClient client, 64 int auxiliarySubtypeMode); showInputMethodPickerFromSystem(in IInputMethodClient client, int auxiliarySubtypeMode, int displayId)65 void showInputMethodPickerFromSystem(in IInputMethodClient client, 66 int auxiliarySubtypeMode, int displayId); showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId)67 void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId); isInputMethodPickerShownForTest()68 boolean isInputMethodPickerShownForTest(); getCurrentInputMethodSubtype()69 InputMethodSubtype getCurrentInputMethodSubtype(); setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes)70 void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); 71 // This is kept due to @UnsupportedAppUsage. 72 // TODO(Bug 113914148): Consider removing this. getInputMethodWindowVisibleHeight(in IInputMethodClient client)73 int getInputMethodWindowVisibleHeight(in IInputMethodClient client); 74 reportVirtualDisplayGeometryAsync(in IInputMethodClient parentClient, int childDisplayId, in float[] matrixValues)75 oneway void reportVirtualDisplayGeometryAsync(in IInputMethodClient parentClient, 76 int childDisplayId, in float[] matrixValues); 77 reportPerceptibleAsync(in IBinder windowToken, boolean perceptible)78 oneway void reportPerceptibleAsync(in IBinder windowToken, boolean perceptible); 79 /** Remove the IME surface. Requires INTERNAL_SYSTEM_WINDOW permission. */ removeImeSurface()80 void removeImeSurface(); 81 /** Remove the IME surface. Requires passing the currently focused window. */ removeImeSurfaceFromWindowAsync(in IBinder windowToken)82 oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken); startProtoDump(in byte[] protoDump, int source, String where)83 void startProtoDump(in byte[] protoDump, int source, String where); isImeTraceEnabled()84 boolean isImeTraceEnabled(); 85 86 // Starts an ime trace. startImeTrace()87 void startImeTrace(); 88 // Stops an ime trace. stopImeTrace()89 void stopImeTrace(); 90 91 /** Start Stylus handwriting session **/ startStylusHandwriting(in IInputMethodClient client)92 void startStylusHandwriting(in IInputMethodClient client); 93 } 94