/**@class android.view.inputmethod.InputMethodManager @extends java.lang.Object Central system API to the overall input method framework (IMF) architecture, which arbitrates interaction between applications and the current input method. <p>Topics covered here: <ol> <li><a href="#ArchitectureOverview">Architecture Overview</a> <li><a href="#Applications">Applications</a> <li><a href="#InputMethods">Input Methods</a> <li><a href="#Security">Security</a> </ol> <a name="ArchitectureOverview"></a> <h3>Architecture Overview</h3> <p>There are three primary parties involved in the input method framework (IMF) architecture:</p> <ul> <li> The <strong>input method manager</strong> as expressed by this class is the central point of the system that manages interaction between all other parts. It is expressed as the client-side API here which exists in each application context and communicates with a global system service that manages the interaction across all processes. <li> An <strong>input method (IME)</strong> implements a particular interaction model allowing the user to generate text. The system binds to the current input method that is in use, causing it to be created and run, and tells it when to hide and show its UI. Only one IME is running at a time. <li> Multiple <strong>client applications</strong> arbitrate with the input method manager for input focus and control over the state of the IME. Only one such client is ever active (working with the IME) at a time. </ul> <a name="Applications"></a> <h3>Applications</h3> <p>In most cases, applications that are using the standard {@link android.widget.TextView} or its subclasses will have little they need to do to work well with soft input methods. The main things you need to be aware of are:</p> <ul> <li> Properly set the {@link android.R.attr#inputType} in your editable text views, so that the input method will have enough context to help the user in entering text into them. <li> Deal well with losing screen space when the input method is displayed. Ideally an application should handle its window being resized smaller, but it can rely on the system performing panning of the window if needed. You should set the {@link android.R.attr#windowSoftInputMode} attribute on your activity or the corresponding values on windows you create to help the system determine whether to pan or resize (it will try to determine this automatically but may get it wrong). <li> You can also control the preferred soft input state (open, closed, etc) for your window using the same {@link android.R.attr#windowSoftInputMode} attribute. </ul> <p>More finer-grained control is available through the APIs here to directly interact with the IMF and its IME -- either showing or hiding the input area, letting the user pick an input method, etc.</p> <p>For the rare people amongst us writing their own text editors, you will need to implement {@link android.view.View#onCreateInputConnection} to return a new instance of your own {@link android.view.inputmethod.InputConnection} interface allowing the IME to interact with your editor.</p> <a name="InputMethods"></a> <h3>Input Methods</h3> <p>An input method (IME) is implemented as a {@link android.app.Service}, typically deriving from {@link android.inputmethodservice.InputMethodService}. It must provide the core {@link android.view.inputmethod.InputMethod} interface, though this is normally handled by {@link android.inputmethodservice.InputMethodService} and implementors will only need to deal with the higher-level API there.</p> See the {@link android.inputmethodservice.InputMethodService} class for more information on implementing IMEs. <a name="Security"></a> <h3>Security</h3> <p>There are a lot of security issues associated with input methods, since they essentially have freedom to completely drive the UI and monitor everything the user enters. The Android input method framework also allows arbitrary third party IMEs, so care must be taken to restrict their selection and interactions.</p> <p>Here are some key points about the security architecture behind the IMF:</p> <ul> <li> <p>Only the system is allowed to directly access an IME's {@link android.view.inputmethod.InputMethod} interface, via the {@link android.Manifest.permission#BIND_INPUT_METHOD} permission. This is enforced in the system by not binding to an input method service that does not require this permission, so the system can guarantee no other untrusted clients are accessing the current input method outside of its control.</p> <li> <p>There may be many client processes of the IMF, but only one may be active at a time. The inactive clients can not interact with key parts of the IMF through the mechanisms described below.</p> <li> <p>Clients of an input method are only given access to its {@link android.view.inputmethod.InputMethodSession} interface. One instance of this interface is created for each client, and only calls from the session associated with the active client will be processed by the current IME. This is enforced by {@link android.inputmethodservice.AbstractInputMethodService} for normal IMEs, but must be explicitly handled by an IME that is customizing the raw {@link android.view.inputmethod.InputMethodSession} implementation.</p> <li> <p>Only the active client's {@link android.view.inputmethod.InputConnection} will accept operations. The IMF tells each client process whether it is active, and the framework enforces that in inactive processes calls on to the current InputConnection will be ignored. This ensures that the current IME can only deliver events and text edits to the UI that the user sees as being in focus.</p> <li> <p>An IME can never interact with an {@link android.view.inputmethod.InputConnection} while the screen is off. This is enforced by making all clients inactive while the screen is off, and prevents bad IMEs from driving the UI when the user can not be aware of its behavior.</p> <li> <p>A client application can ask that the system let the user pick a new IME, but can not programmatically switch to one itself. This avoids malicious applications from switching the user to their own IME, which remains running when the user navigates away to another application. An IME, on the other hand, <em>is</em> allowed to programmatically switch the system to another IME, since it already has full control of user input.</p> <li> <p>The user must explicitly enable a new IME in settings before they can switch to it, to confirm with the system that they know about it and want to make it available for use.</p> </ul> */ var InputMethodManager = { /**@hide */ DISPATCH_IN_PROGRESS : "-1", /**@hide */ DISPATCH_NOT_HANDLED : "0", /**@hide */ DISPATCH_HANDLED : "1", /**@hide */ SHOW_IM_PICKER_MODE_AUTO : "0", /**@hide */ SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES : "1", /**@hide */ SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES : "2", /** Flag for {@link #showSoftInput} to indicate that this is an implicit request to show the input window, not as the result of a direct request by the user. The window may not be shown in this case. */ SHOW_IMPLICIT : "1", /** Flag for {@link #showSoftInput} to indicate that the user has forced the input method open (such as by long-pressing menu) so it should not be closed until they explicitly do so. */ SHOW_FORCED : "2", /** Flag for the {@link ResultReceiver} result code from {@link #showSoftInput(View, int, ResultReceiver)} and {@link #hideSoftInputFromWindow(IBinder, int, ResultReceiver)}: the state of the soft input window was unchanged and remains shown. */ RESULT_UNCHANGED_SHOWN : "0", /** Flag for the {@link ResultReceiver} result code from {@link #showSoftInput(View, int, ResultReceiver)} and {@link #hideSoftInputFromWindow(IBinder, int, ResultReceiver)}: the state of the soft input window was unchanged and remains hidden. */ RESULT_UNCHANGED_HIDDEN : "1", /** Flag for the {@link ResultReceiver} result code from {@link #showSoftInput(View, int, ResultReceiver)} and {@link #hideSoftInputFromWindow(IBinder, int, ResultReceiver)}: the state of the soft input window changed from hidden to shown. */ RESULT_SHOWN : "2", /** Flag for the {@link ResultReceiver} result code from {@link #showSoftInput(View, int, ResultReceiver)} and {@link #hideSoftInputFromWindow(IBinder, int, ResultReceiver)}: the state of the soft input window changed from shown to hidden. */ RESULT_HIDDEN : "3", /** Flag for {@link #hideSoftInputFromWindow} and {@link android.view.inputmethod.InputMethodService#requestHideSelf(int)} to indicate that the soft input window should only be hidden if it was not explicitly shown by the user. */ HIDE_IMPLICIT_ONLY : "1", /** Flag for {@link #hideSoftInputFromWindow} and {@link android.view.inputmethod.InputMethodService#requestShowSelf(int)} to indicate that the soft input window should normally be hidden, unless it was originally shown with {@link #SHOW_FORCED}. */ HIDE_NOT_ALWAYS : "2", /**Ensures that {@link #sInstance} becomes non-{@code null} for application that have directly or indirectly relied on {@link #sInstance} via reflection or something like that. <p>Here are scenarios we know and there could be more scenarios we are not aware of right know.</p> <ul> <li>Apps that directly access {@link #sInstance} via reflection, which is currently allowed because of {@link UnsupportedAppUsage} annotation. Currently {@link android.view.WindowManagerGlobal#getWindowSession()} is likely to guarantee that {@link #sInstance} is not {@code null} when such an app is accessing it, but removing that code from {@link android.view.WindowManagerGlobal#getWindowSession()} can reveal untested code paths in their apps, which probably happen in an early startup time of that app.</li> <li>Apps that directly access {@link #peekInstance}() via reflection, which is currently allowed because of {@link UnsupportedAppUsage} annotation. Currently {@link android.view.WindowManagerGlobal#getWindowSession()} is likely to guarantee that {@link #peekInstance}() returns non-{@code null} object when such an app is calling {@link #peekInstance}(), but removing that code from {@link android.view.WindowManagerGlobal#getWindowSession()} can reveal untested code paths in their apps, which probably happen in an early startup time of that app. The good news is that unlike {@link #sInstance}'s case we can at least work around this scenario by changing the semantics of {@link #peekInstance}(), which is currently defined as "retrieve the global {@link android.view.inputmethod.InputMethodManager} instance, if it exists" to something that always returns non-{@code null} {@link android.view.inputmethod.InputMethodManager}. However, introducing such an workaround can also trigger different compatibility issues if {@link #peekInstance}() was called before {@link android.view.WindowManagerGlobal#getWindowSession()} and it expected {@link #peekInstance}() to return {@code null} as written in the JavaDoc.</li> </ul> <p>Since this is purely a compatibility hack, this method must be used only from {@link android.view.WindowManagerGlobal#getWindowSession()} and {@link #getInstance}().</p> <p>TODO(Bug 116157766): Remove this method once we clean up {@link UnsupportedAppUsage}.</p> @hide */ ensureDefaultInstanceForDefaultDisplayIfNecessary : function( ) {}, /**Retrieve an instance for the given {@link Context}, creating it if it doesn't already exist. @param {Object {Context}} context {@link Context} for which IME APIs need to work @return {Object {android.view.inputmethod.InputMethodManager}} {@link InputMethodManager} instance @hide */ forContext : function( ) {}, /**Deprecated. Do not use. @return {Object {android.view.inputmethod.InputMethodManager}} global {@link InputMethodManager} instance @deprecated Use {@link Context#getSystemService(Class)} instead. This method cannot fully support multi-display scenario. @hide */ getInstance : function( ) {}, /**Deprecated. Do not use. @return {Object {android.view.inputmethod.InputMethodManager}} {@link #sInstance} @deprecated Use {@link Context#getSystemService(Class)} instead. This method cannot fully support multi-display scenario. @hide */ peekInstance : function( ) {}, /** @hide */ getClient : function( ) {}, /** @hide */ getInputContext : function( ) {}, /**Returns the list of installed input methods. <p>On multi user environment, this API returns a result for the calling process user.</p> @return {Object {java.util.List}} {@link List} of {@link InputMethodInfo}. */ getInputMethodList : function( ) {}, /**Returns the list of installed input methods for the specified user. @param {Number} userId user ID to query @return {Object {java.util.List}} {@link List} of {@link InputMethodInfo}. @hide */ getInputMethodListAsUser : function( ) {}, /**Returns the list of enabled input methods. <p>On multi user environment, this API returns a result for the calling process user.</p> @return {Object {java.util.List}} {@link List} of {@link InputMethodInfo}. */ getEnabledInputMethodList : function( ) {}, /**Returns the list of enabled input methods for the specified user. @param {Number} userId user ID to query @return {Object {java.util.List}} {@link List} of {@link InputMethodInfo}. @hide */ getEnabledInputMethodListAsUser : function( ) {}, /**Returns a list of enabled input method subtypes for the specified input method info. <p>On multi user environment, this API returns a result for the calling process user.</p> @param {Object {InputMethodInfo}} imi An input method info whose subtypes list will be returned. @param {Boolean} allowsImplicitlySelectedSubtypes A boolean flag to allow to return the implicitly selected subtypes. If an input method info doesn't have enabled subtypes, the framework will implicitly enable subtypes according to the current system language. */ getEnabledInputMethodSubtypeList : function( ) {}, /** @deprecated Use {@link InputMethodService#showStatusIcon(int)} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ showStatusIcon : function( ) {}, /** @deprecated Use {@link InputMethodService#hideStatusIcon()} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ hideStatusIcon : function( ) {}, /**This hidden API is deprecated in {@link android.os.Build.VERSION_CODES#Q}. Does nothing. @param {Object {android.text.style.SuggestionSpan[]}} spans will be ignored. @deprecated Do not use. @hide */ registerSuggestionSpansForNotification : function( ) {}, /**This hidden API is deprecated in {@link android.os.Build.VERSION_CODES#Q}. Does nothing. @deprecated Do not use. @hide */ notifySuggestionPicked : function( ) {}, /**Allows you to discover whether the attached input method is running in fullscreen mode. Return true if it is fullscreen, entirely covering your UI, else returns false. */ isFullscreenMode : function( ) {}, /**Return true if the given view is the currently active view for the input method. */ isActive : function( ) {}, /**Return true if any view is currently active in the input method. */ isActive : function( ) {}, /**Return true if the currently served view is accepting full text edits. If false, it has no input connection, so can only handle raw key events. */ isAcceptingText : function( ) {}, /** */ displayCompletions : function( ) {}, /** */ updateExtractedText : function( ) {}, /**Synonym for {@link #showSoftInput(View, int, ResultReceiver)} without a result receiver: explicitly request that the current input method's soft input area be shown to the user, if needed. @param {Object {View}} view The currently focused view, which would like to receive soft keyboard input. @param {Number} flags Provides additional operating flags. Currently may be 0 or have the {@link #SHOW_IMPLICIT} bit set. */ showSoftInput : function( ) {}, /**Explicitly request that the current input method's soft input area be shown to the user, if needed. Call this if the user interacts with your view in such a way that they have expressed they would like to start performing input into it. <p><strong>Caveat:</strong> {@link ResultReceiver} instance passed to this method can be a long-lived object, because it may not be garbage-collected until all the corresponding {@link ResultReceiver} objects transferred to different processes get garbage-collected. Follow the general patterns to avoid memory leaks in Android. Consider to use {@link java.lang.ref.WeakReference} so that application logic objects such as {@link android.app.Activity} and {@link Context} can be garbage collected regardless of the lifetime of {@link ResultReceiver}. @param {Object {View}} view The currently focused view, which would like to receive soft keyboard input. @param {Number} flags Provides additional operating flags. Currently may be 0 or have the {@link #SHOW_IMPLICIT} bit set. @param {Object {ResultReceiver}} resultReceiver If non-null, this will be called by the IME when it has processed your request to tell you what it has done. The result code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or {@link #RESULT_HIDDEN}. */ showSoftInput : function( ) {}, /**This method is still kept for a while until android.support.v7.widget.SearchView ver. 26.0 is publicly released because previous implementations of that class had relied on this method via reflection. @deprecated This is a hidden API. You should never use this. @hide */ showSoftInputUnchecked : function( ) {}, /**Synonym for {@link #hideSoftInputFromWindow(IBinder, int, ResultReceiver)} without a result: request to hide the soft input window from the context of the window that is currently accepting input. @param {Object {IBinder}} windowToken The token of the window that is making the request, as returned by {@link View#getWindowToken() View.getWindowToken()}. @param {Number} flags Provides additional operating flags. Currently may be 0 or have the {@link #HIDE_IMPLICIT_ONLY} bit set. */ hideSoftInputFromWindow : function( ) {}, /**Request to hide the soft input window from the context of the window that is currently accepting input. This should be called as a result of the user doing some actually than fairly explicitly requests to have the input window hidden. <p><strong>Caveat:</strong> {@link ResultReceiver} instance passed to this method can be a long-lived object, because it may not be garbage-collected until all the corresponding {@link ResultReceiver} objects transferred to different processes get garbage-collected. Follow the general patterns to avoid memory leaks in Android. Consider to use {@link java.lang.ref.WeakReference} so that application logic objects such as {@link android.app.Activity} and {@link Context} can be garbage collected regardless of the lifetime of {@link ResultReceiver}. @param {Object {IBinder}} windowToken The token of the window that is making the request, as returned by {@link View#getWindowToken() View.getWindowToken()}. @param {Number} flags Provides additional operating flags. Currently may be 0 or have the {@link #HIDE_IMPLICIT_ONLY} bit set. @param {Object {ResultReceiver}} resultReceiver If non-null, this will be called by the IME when it has processed your request to tell you what it has done. The result code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or {@link #RESULT_HIDDEN}. */ hideSoftInputFromWindow : function( ) {}, /**This method toggles the input method window display. If the input window is already displayed, it gets hidden. If not the input window will be displayed. @param {Object {IBinder}} windowToken The token of the window that is making the request, as returned by {@link View#getWindowToken() View.getWindowToken()}. @param {Number} showFlags Provides additional operating flags. May be 0 or have the {@link #SHOW_IMPLICIT}, {@link #SHOW_FORCED} bit set. @param {Number} hideFlags Provides additional operating flags. May be 0 or have the {@link #HIDE_IMPLICIT_ONLY}, {@link #HIDE_NOT_ALWAYS} bit set. */ toggleSoftInputFromWindow : function( ) {}, /**This method toggles the input method window display. If the input window is already displayed, it gets hidden. If not the input window will be displayed. @param {Number} showFlags Provides additional operating flags. May be 0 or have the {@link #SHOW_IMPLICIT}, {@link #SHOW_FORCED} bit set. @param {Number} hideFlags Provides additional operating flags. May be 0 or have the {@link #HIDE_IMPLICIT_ONLY}, {@link #HIDE_NOT_ALWAYS} bit set. */ toggleSoftInput : function( ) {}, /**If the input method is currently connected to the given view, restart it with its new contents. You should call this when the text within your view changes outside of the normal input method or key input flow, such as when an application calls TextView.setText(). @param {Object {View}} view The view whose text has changed. */ restartInput : function( ) {}, /**When the focused window is dismissed, this method is called to finish the input method started before. @hide */ windowDismissed : function( ) {}, /**Call this when a view receives focus. @hide */ focusIn : function( ) {}, /**Call this when a view loses focus. @hide */ focusOut : function( ) {}, /**Call this when a view is being detached from a {@link android.view.Window}. @hide */ onViewDetachedFromWindow : function( ) {}, /** @hide */ checkFocus : function( ) {}, /**Called by ViewAncestor when its window gets input focus. @hide */ onPostWindowFocus : function( ) {}, /** @hide */ onPreWindowFocus : function( ) {}, /**Register for IME state callbacks and applying visibility in {@link android.view.ImeInsetsSourceConsumer}. @hide */ registerImeConsumer : function( ) {}, /**Unregister for IME state callbacks and applying visibility in {@link android.view.ImeInsetsSourceConsumer}. @hide */ unregisterImeConsumer : function( ) {}, /**Call showSoftInput with currently focused view. @return {Boolean} {@code true} if IME can be shown. @hide */ requestImeShow : function( ) {}, /**Notify IME directly that it is no longer visible. @hide */ notifyImeHidden : function( ) {}, /**Report the current selection range. <p><strong>Editor authors</strong>, you need to call this method whenever the cursor moves in your editor. Remember that in addition to doing this, your editor needs to always supply current cursor values in {@link android.view.inputmethod.EditorInfo#initialSelStart} and {@link android.view.inputmethod.EditorInfo#initialSelEnd} every time {@link android.view.View#onCreateInputConnection(EditorInfo)} is called, which happens whenever the keyboard shows up or the focus changes to a text field, among other cases.</p> */ updateSelection : function( ) {}, /**Notify the event when the user tapped or clicked the text view. @param {Object {View}} view {@link View} which is being clicked. @see InputMethodService#onViewClicked(boolean) @deprecated The semantics of this method can never be defined well for composite {@link View} that works as a giant "Canvas", which can host its own UI hierarchy and sub focus state. {@link android.webkit.WebView} is a good example. Application / IME developers should not rely on this method. */ viewClicked : function( ) {}, /**Return true if the current input method wants to watch the location of the input editor's cursor in its window. @deprecated Use {@link InputConnection#requestCursorUpdates(int)} instead. */ isWatchingCursor : function( ) {}, /**Return true if the current input method wants to be notified when cursor/anchor location is changed. @hide */ isCursorAnchorInfoEnabled : function( ) {}, /**Set the requested mode for {@link #updateandroid.view.inputmethod.CursorAnchorInfo(View, android.view.inputmethod.CursorAnchorInfo)}. @hide */ setUpdateCursorAnchorInfoMode : function( ) {}, /**Report the current cursor location in its window. @deprecated Use {@link #updateCursorAnchorInfo(View, CursorAnchorInfo)} instead. */ updateCursor : function( ) {}, /**Report positional change of the text insertion point and/or characters in the composition string. */ updateCursorAnchorInfo : function( ) {}, /**Call {@link android.view.inputmethod.InputMethodSession#appPrivateCommand(String, Bundle) android.view.inputmethod.InputMethodSession.appPrivateCommand()} on the current Input Method. @param {Object {View}} view Optional View that is sending the command, or null if you want to send the command regardless of the view that is attached to the input method. @param {String} action Name of the command to be performed. This <em>must</em> be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting commands. @param {Object {Bundle}} data Any data to include with the command. */ sendAppPrivateCommand : function( ) {}, /**Force switch to a new input method component. This can only be called from an application or a service which has a token of the currently active input method. <p>On Android {@link Build.VERSION_CODES#Q} and later devices, the undocumented behavior that token can be {@code null} when the caller has {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} is deprecated. Instead, update {@link android.provider.Settings.Secure#DEFAULT_INPUT_METHOD} and {@link android.provider.Settings.Secure#SELECTED_INPUT_METHOD_SUBTYPE} directly.</p> @param {Object {IBinder}} token Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @param {String} id The unique identifier for the new input method to be switched to. @deprecated Use {@link InputMethodService#switchInputMethod(String)} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ setInputMethod : function( ) {}, /**Force switch to a new input method and subtype. This can only be called from an application or a service which has a token of the currently active input method. <p>On Android {@link Build.VERSION_CODES#Q} and later devices, {@code token} cannot be {@code null} even with {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}. Instead, update {@link android.provider.Settings.Secure#DEFAULT_INPUT_METHOD} and {@link android.provider.Settings.Secure#SELECTED_INPUT_METHOD_SUBTYPE} directly.</p> @param {Object {IBinder}} token Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @param {String} id The unique identifier for the new input method to be switched to. @param {Object {InputMethodSubtype}} subtype The new subtype of the new input method to be switched to. @deprecated Use {@link InputMethodService#switchInputMethod(String, InputMethodSubtype)} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ setInputMethodAndSubtype : function( ) {}, /**Close/hide the input method's soft input area, so the user no longer sees it or can interact with it. This can only be called from the currently active input method, as validated by the given token. @param {Object {IBinder}} token Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @param {Number} flags Provides additional operating flags. Currently may be 0 or have the {@link #HIDE_IMPLICIT_ONLY}, {@link #HIDE_NOT_ALWAYS} bit set. @deprecated Use {@link InputMethodService#requestHideSelf(int)} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ hideSoftInputFromInputMethod : function( ) {}, /**Show the input method's soft input area, so the user sees the input method window and can interact with it. This can only be called from the currently active input method, as validated by the given token. @param {Object {IBinder}} token Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @param {Number} flags Provides additional operating flags. Currently may be 0 or have the {@link #SHOW_IMPLICIT} or {@link #SHOW_FORCED} bit set. @deprecated Use {@link InputMethodService#requestShowSelf(int)} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ showSoftInputFromInputMethod : function( ) {}, /**Dispatches an input event to the IME. Returns {@link #DISPATCH_HANDLED} if the event was handled. Returns {@link #DISPATCH_NOT_HANDLED} if the event was not handled. Returns {@link #DISPATCH_IN_PROGRESS} if the event is in progress and the callback will be invoked later. @hide */ dispatchInputEvent : function( ) {}, /**Provides the default implementation of {@link android.view.inputmethod.InputConnection#sendKeyEvent(KeyEvent)}, which is expected to dispatch an keyboard event sent from the IME to an appropriate event target depending on the given {@link View} and the current focus state. <p>CAUTION: This method is provided only for the situation where {@link android.view.inputmethod.InputConnection#sendKeyEvent(KeyEvent)} needs to be implemented without relying on {@link android.view.inputmethod.BaseInputConnection}. Do not use this API for anything else.</p> @param {Object {View}} targetView the default target view. If {@code null} is specified, then this method tries to find a good event target based on the current focus state. @param {Object {KeyEvent}} event the key event to be dispatched. */ dispatchKeyEventFromInputMethod : function( ) {}, /**Show IME picker popup window. <p>Requires the {@link PackageManager#FEATURE_INPUT_METHODS} feature which can be detected using {@link PackageManager#hasSystemFeature(String)}. */ showInputMethodPicker : function( ) {}, /**Shows the input method chooser dialog from system. @param {Boolean} showAuxiliarySubtypes Set true to show auxiliary input methods. @param {Number} displayId The ID of the display where the chooser dialog should be shown. @hide */ showInputMethodPickerFromSystem : function( ) {}, /**A test API for CTS to make sure that {@link #showInputMethodPicker}() works as expected. <p>When customizing the implementation of {@link #showInputMethodPicker}() API, make sure that this test API returns when and only while and only while {@link #showInputMethodPicker}() is showing UI. Otherwise your OS implementation may not pass CTS.</p> @return {Boolean} {@code true} while and only while {@link #showInputMethodPicker()} is showing UI. @hide */ isInputMethodPickerShown : function( ) {}, /**Show the settings for enabling subtypes of the specified input method. @param {String} imiId An input method, whose subtypes settings will be shown. If imiId is null, subtypes of all input methods will be shown. */ showInputMethodAndSubtypeEnabler : function( ) {}, /**Returns the current input method subtype. This subtype is one of the subtypes in the current input method. This method returns null when the current input method doesn't have any input method subtype. */ getCurrentInputMethodSubtype : function( ) {}, /**Switch to a new input method subtype of the current input method. @param {Object {InputMethodSubtype}} subtype A new input method subtype to switch. @return {Boolean} true if the current subtype was successfully switched. When the specified subtype is null, this method returns false. @deprecated If the calling process is an IME, use {@link InputMethodService#switchInputMethod(String, InputMethodSubtype)}, which does not require any permission as long as the caller is the current IME. If the calling process is some privileged app that already has {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission, just directly update {@link Settings.Secure#SELECTED_INPUT_METHOD_SUBTYPE}. */ setCurrentInputMethodSubtype : function( ) {}, /**Notify that a user took some action with this input method. @deprecated Just kept to avoid possible app compat issue. @hide */ notifyUserAction : function( ) {}, /**Returns a map of all shortcut input method info and their subtypes. */ getShortcutInputMethodsAndSubtypes : function( ) {}, /**This is kept due to {@link android.annotation.UnsupportedAppUsage}. <p>TODO(Bug 113914148): Check if we can remove this. We have accidentally exposed WindowManagerInternal#getInputMethodWindowVisibleHeight to app developers and some of them started relying on it.</p> @return {Number} Something that is not well-defined. @hide */ getInputMethodWindowVisibleHeight : function( ) {}, /**An internal API for {@link android.app.ActivityView} to report where its embedded virtual display is placed. @param {Number} childDisplayId Display ID of the embedded virtual display. @param {Object {Matrix}} matrix {@link Matrix} to convert virtual display screen coordinates to the host screen coordinates. {@code null} to clear the relationship. @hide */ reportActivityView : function( ) {}, /**Force switch to the last used input method and subtype. If the last input method didn't have any subtypes, the framework will simply switch to the last input method with no subtype specified. @param {Object {IBinder}} imeToken Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @return {Boolean} true if the current input method and subtype was successfully switched to the last used input method and subtype. @deprecated Use {@link InputMethodService#switchToPreviousInputMethod()} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ switchToLastInputMethod : function( ) {}, /**Force switch to the next input method and subtype. If there is no IME enabled except current IME and subtype, do nothing. @param {Object {IBinder}} imeToken Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @param {Boolean} onlyCurrentIme if true, the framework will find the next subtype which belongs to the current IME @return {Boolean} true if the current input method and subtype was successfully switched to the next input method and subtype. @deprecated Use {@link InputMethodService#switchToNextInputMethod(boolean)} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ switchToNextInputMethod : function( ) {}, /**Returns true if the current IME needs to offer the users ways to switch to a next input method (e.g. a globe key.). When an IME sets supportsSwitchingToNextInputMethod and this method returns true, the IME has to offer ways to to invoke {@link #switchToNextInputMethod} accordingly. <p> Note that the system determines the most appropriate next input method and subtype in order to provide the consistent user experience in switching between IMEs and subtypes. @param {Object {IBinder}} imeToken Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself. @deprecated Use {@link InputMethodService#shouldOfferSwitchingToNextInputMethod()} instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME. */ shouldOfferSwitchingToNextInputMethod : function( ) {}, /**Set additional input method subtypes. Only a process which shares the same uid with the IME can add additional input method subtypes to the IME. Please note that a subtype's status is stored in the system. For example, enabled subtypes are remembered by the framework even after they are removed by using this method. If you re-add the same subtypes again, they will just get enabled. If you want to avoid such conflicts, for instance, you may want to create a "different" new subtype even with the same locale and mode, by changing its extra value. The different subtype won't get affected by the stored past status. (You may want to take a look at {@link android.view.inputmethod.InputMethodSubtype#hashCode()} to refer to the current implementation.) <p>NOTE: If the same subtype exists in both the manifest XML file and additional subtypes specified by {@code subtypes}, those multiple instances are automatically merged into one instance.</p> <p>CAVEAT: In API Level 23 and prior, the system may do nothing if an empty {@link android.view.inputmethod.InputMethodSubtype} is specified in {@code subtypes}, which prevents you from removing the last one entry of additional subtypes. If your IME statically defines one or more subtypes in the manifest XML file, you may be able to work around this limitation by specifying one of those statically defined subtypes in {@code subtypes}.</p> @param {String} imiId Id of InputMethodInfo which additional input method subtypes will be added to. @param {Object {android.view.inputmethod.InputMethodSubtype[]}} subtypes subtypes will be added as additional subtypes of the current input method. @deprecated For IMEs that have already implemented features like customizable/downloadable keyboard layouts/languages, please start migration to other approaches. One idea would be exposing only one unified {@link InputMethodSubtype} then implement IME's own language switching mechanism within that unified subtype. The support of "Additional Subtype" may be completely dropped in a future version of Android. */ setAdditionalInputMethodSubtypes : function( ) {}, /** */ getLastInputMethodSubtype : function( ) {}, /**<p>This is used for CTS test only. Do not use this method outside of CTS package.<p/> @return {Number} the ID of this display which this {@link InputMethodManager} resides @hide */ getDisplayId : function( ) {}, };