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