InputMethodManagerpublic final class InputMethodManager extends Object Central system API to the overall input method framework (IMF) architecture,
which arbitrates interaction between applications and the current input method.
You can retrieve an instance of this interface with
{@link Context#getSystemService(String) Context.getSystemService()}.
Topics covered here:
- Architecture Overview
- Applications
- Input Methods
- Security
Architecture Overview
There are three primary parties involved in the input method
framework (IMF) architecture:
- The input method manager 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.
- An input method (IME) implements a particular
interaction model allowing the user to generate text. The system binds
to the current input method that is 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.
- Multiple client applications 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.
Applications
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:
- 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.
- 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).
- You can also control the preferred soft input state (open, closed, etc)
for your window using the same {@link android.R.attr#windowSoftInputMode}
attribute.
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.
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 InputConnection} interface
allowing the IME to interact with your editor.
Input Methods
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 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.
See the {@link android.inputmethodservice.InputMethodService} class for
more information on implementing IMEs.
Security
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.
Here are some key points about the security architecture behind the
IMF:
-
Only the system is allowed to directly access an IME's
{@link 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.
-
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.
-
Clients of an input method are only given access to its
{@link 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 InputMethodSession} implementation.
-
Only the active client's {@link 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.
-
An IME can never interact with an {@link 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.
-
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, is allowed to programmatically switch
the system to another IME, since it already has full control of user
input.
-
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.
|
Fields Summary |
---|
static final boolean | DEBUG | static final String | TAG | static final String | PENDING_EVENT_COUNTER | static InputMethodManager | sInstance | public static final int | CONTROL_WINDOW_VIEW_HAS_FOCUS | public static final int | CONTROL_WINDOW_IS_TEXT_EDITOR | public static final int | CONTROL_WINDOW_FIRST | public static final int | CONTROL_START_INITIAL | static final long | INPUT_METHOD_NOT_RESPONDING_TIMEOUTTimeout in milliseconds for delivering a key to an IME. | public static final int | DISPATCH_IN_PROGRESS | public static final int | DISPATCH_NOT_HANDLED | public static final int | DISPATCH_HANDLED | final com.android.internal.view.IInputMethodManager | mService | final android.os.Looper | mMainLooper | final H | mH | final com.android.internal.view.IInputContext | mIInputContext | boolean | mActiveTrue if this input method client is active, initially false. | boolean | mHasBeenInactiveSet whenever this client becomes inactive, to know we need to reset
state with the IME the next time we receive focus. | boolean | mFullscreenModeAs reported by IME through InputConnection. | android.view.View | mCurRootViewThis is the root view of the overall window that currently has input
method focus. | android.view.View | mServedViewThis is the view that should currently be served by an input method,
regardless of the state of setting that up. | android.view.View | mNextServedViewThis is then next view that will be served by the input method, when
we get around to updating things. | boolean | mServedConnectingThis is set when we are in the process of connecting, to determine
when we have actually finished. | EditorInfo | mCurrentTextBoxAttributeThis is non-null when we have connected the served view; it holds
the attributes that were last retrieved from the served view and given
to the input connection. | InputConnection | mServedInputConnectionThe InputConnection that was last retrieved from the served view. | ControlledInputConnectionWrapper | mServedInputConnectionWrapper | CompletionInfo[] | mCompletionsThe completions that were last provided by the served view. | android.graphics.Rect | mTmpCursorRect | android.graphics.Rect | mCursorRect | int | mCursorSelStart | int | mCursorSelEnd | int | mCursorCandStart | int | mCursorCandEnd | private static final int | NOT_AN_ACTION_NOTIFICATION_SEQUENCE_NUMBERRepresents an invalid action notification sequence number. {@link InputMethodManagerService}
always issues a positive integer for action notification sequence numbers. Thus -1 is
guaranteed to be different from any valid sequence number. | private int | mNextUserActionNotificationSequenceNumberThe next sequence number that is to be sent to {@link InputMethodManagerService} via
{@link IInputMethodManager#notifyUserAction(int)} at once when a user action is observed. | private int | mLastSentUserActionNotificationSequenceNumberThe last sequence number that is already sent to {@link InputMethodManagerService}. | private CursorAnchorInfo | mCursorAnchorInfoThe instance that has previously been sent to the input method. | private final int[] | mViewTopLeftThe buffer to retrieve the view location in screen coordinates in {@link #updateCursor}. | private final android.graphics.Matrix | mViewToScreenMatrixThe matrix to convert the view location into screen coordinates in {@link #updateCursor}. | int | mBindSequenceSequence number of this binding, as returned by the server. | String | mCurIdID of the method we are bound to. | com.android.internal.view.IInputMethodSession | mCurMethodThe actual instance of the method to make calls on it. | android.view.InputChannel | mCurChannel | ImeInputEventSender | mCurSender | private static final int | REQUEST_UPDATE_CURSOR_ANCHOR_INFO_NONE | private int | mRequestUpdateCursorAnchorInfoMonitorModeThe monitor mode for {@link #updateCursorAnchorInfo(View, CursorAnchorInfo)}. | final android.util.Pools.Pool | mPendingEventPool | final android.util.SparseArray | mPendingEvents | static final int | MSG_DUMP | static final int | MSG_BIND | static final int | MSG_UNBIND | static final int | MSG_SET_ACTIVE | static final int | MSG_SEND_INPUT_EVENT | static final int | MSG_TIMEOUT_INPUT_EVENT | static final int | MSG_FLUSH_INPUT_EVENT | static final int | MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER | final IInputMethodClient.Stub | mClient | final InputConnection | mDummyInputConnection | public static final int | SHOW_IMPLICITFlag 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. | public static final int | SHOW_FORCEDFlag 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. | public static final int | RESULT_UNCHANGED_SHOWNFlag 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. | public static final int | RESULT_UNCHANGED_HIDDENFlag 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. | public static final int | RESULT_SHOWNFlag 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. | public static final int | RESULT_HIDDENFlag 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. | public static final int | HIDE_IMPLICIT_ONLYFlag for {@link #hideSoftInputFromWindow} to indicate that the soft
input window should only be hidden if it was not explicitly shown
by the user. | public static final int | HIDE_NOT_ALWAYSFlag for {@link #hideSoftInputFromWindow} to indicate that the soft
input window should normally be hidden, unless it was originally
shown with {@link #SHOW_FORCED}. |
Methods Summary |
---|
public void | checkFocus()
if (checkFocusNoStartInput(false, true)) {
startInputInner(null, 0, 0, 0);
}
| private boolean | checkFocusNoStartInput(boolean forceNewFocus, boolean finishComposingText)
// This is called a lot, so short-circuit before locking.
if (mServedView == mNextServedView && !forceNewFocus) {
return false;
}
InputConnection ic = null;
synchronized (mH) {
if (mServedView == mNextServedView && !forceNewFocus) {
return false;
}
if (DEBUG) Log.v(TAG, "checkFocus: view=" + mServedView
+ " next=" + mNextServedView
+ " forceNewFocus=" + forceNewFocus
+ " package="
+ (mServedView != null ? mServedView.getContext().getPackageName() : "<none>"));
if (mNextServedView == null) {
finishInputLocked();
// In this case, we used to have a focused view on the window,
// but no longer do. We should make sure the input method is
// no longer shown, since it serves no purpose.
closeCurrentInput();
return false;
}
ic = mServedInputConnection;
mServedView = mNextServedView;
mCurrentTextBoxAttribute = null;
mCompletions = null;
mServedConnecting = true;
}
if (finishComposingText && ic != null) {
ic.finishComposingText();
}
return true;
| void | clearBindingLocked()Reset all of the state associated with being bound to an input method.
if (DEBUG) Log.v(TAG, "Clearing binding!");
clearConnectionLocked();
setInputChannelLocked(null);
mBindSequence = -1;
mCurId = null;
mCurMethod = null;
| void | clearConnectionLocked()Reset all of the state associated with a served view being connected
to an input method
mCurrentTextBoxAttribute = null;
mServedInputConnection = null;
if (mServedInputConnectionWrapper != null) {
mServedInputConnectionWrapper.deactivate();
mServedInputConnectionWrapper = null;
}
| void | closeCurrentInput()
try {
mService.hideSoftInput(mClient, HIDE_NOT_ALWAYS, null);
} catch (RemoteException e) {
}
| public int | dispatchInputEvent(android.view.InputEvent event, java.lang.Object token, android.view.inputmethod.InputMethodManager$FinishedInputEventCallback callback, android.os.Handler handler)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.
synchronized (mH) {
if (mCurMethod != null) {
if (event instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent)event;
if (keyEvent.getAction() == KeyEvent.ACTION_DOWN
&& keyEvent.getKeyCode() == KeyEvent.KEYCODE_SYM
&& keyEvent.getRepeatCount() == 0) {
showInputMethodPickerLocked();
return DISPATCH_HANDLED;
}
}
if (DEBUG) Log.v(TAG, "DISPATCH INPUT EVENT: " + mCurMethod);
PendingEvent p = obtainPendingEventLocked(
event, token, mCurId, callback, handler);
if (mMainLooper.isCurrentThread()) {
// Already running on the IMM thread so we can send the event immediately.
return sendInputEventOnMainLooperLocked(p);
}
// Post the event to the IMM thread.
Message msg = mH.obtainMessage(MSG_SEND_INPUT_EVENT, p);
msg.setAsynchronous(true);
mH.sendMessage(msg);
return DISPATCH_IN_PROGRESS;
}
}
return DISPATCH_NOT_HANDLED;
| public void | displayCompletions(android.view.View view, CompletionInfo[] completions)
checkFocus();
synchronized (mH) {
if (mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view))) {
return;
}
mCompletions = completions;
if (mCurMethod != null) {
try {
mCurMethod.displayCompletions(mCompletions);
} catch (RemoteException e) {
}
}
}
| void | doDump(java.io.FileDescriptor fd, java.io.PrintWriter fout, java.lang.String[] args)
final Printer p = new PrintWriterPrinter(fout);
p.println("Input method client state for " + this + ":");
p.println(" mService=" + mService);
p.println(" mMainLooper=" + mMainLooper);
p.println(" mIInputContext=" + mIInputContext);
p.println(" mActive=" + mActive
+ " mHasBeenInactive=" + mHasBeenInactive
+ " mBindSequence=" + mBindSequence
+ " mCurId=" + mCurId);
p.println(" mCurMethod=" + mCurMethod);
p.println(" mCurRootView=" + mCurRootView);
p.println(" mServedView=" + mServedView);
p.println(" mNextServedView=" + mNextServedView);
p.println(" mServedConnecting=" + mServedConnecting);
if (mCurrentTextBoxAttribute != null) {
p.println(" mCurrentTextBoxAttribute:");
mCurrentTextBoxAttribute.dump(p, " ");
} else {
p.println(" mCurrentTextBoxAttribute: null");
}
p.println(" mServedInputConnection=" + mServedInputConnection);
p.println(" mCompletions=" + mCompletions);
p.println(" mCursorRect=" + mCursorRect);
p.println(" mCursorSelStart=" + mCursorSelStart
+ " mCursorSelEnd=" + mCursorSelEnd
+ " mCursorCandStart=" + mCursorCandStart
+ " mCursorCandEnd=" + mCursorCandEnd);
p.println(" mNextUserActionNotificationSequenceNumber="
+ mNextUserActionNotificationSequenceNumber
+ " mLastSentUserActionNotificationSequenceNumber="
+ mLastSentUserActionNotificationSequenceNumber);
| void | finishInputLocked()Disconnect any existing input connection, clearing the served view.
mCurRootView = null;
mNextServedView = null;
if (mServedView != null) {
if (DEBUG) Log.v(TAG, "FINISH INPUT: " + mServedView);
if (mCurrentTextBoxAttribute != null) {
try {
mService.finishInput(mClient);
} catch (RemoteException e) {
}
}
notifyInputConnectionFinished();
mServedView = null;
mCompletions = null;
mServedConnecting = false;
clearConnectionLocked();
}
| void | finishedInputEvent(int seq, boolean handled, boolean timeout)
final PendingEvent p;
synchronized (mH) {
int index = mPendingEvents.indexOfKey(seq);
if (index < 0) {
return; // spurious, event already finished or timed out
}
p = mPendingEvents.valueAt(index);
mPendingEvents.removeAt(index);
Trace.traceCounter(Trace.TRACE_TAG_INPUT, PENDING_EVENT_COUNTER, mPendingEvents.size());
if (timeout) {
Log.w(TAG, "Timeout waiting for IME to handle input event after "
+ INPUT_METHOD_NOT_RESPONDING_TIMEOUT + " ms: " + p.mInputMethodId);
} else {
mH.removeMessages(MSG_TIMEOUT_INPUT_EVENT, p);
}
}
invokeFinishedInputEventCallback(p, handled);
| private void | flushPendingEventsLocked()
mH.removeMessages(MSG_FLUSH_INPUT_EVENT);
final int count = mPendingEvents.size();
for (int i = 0; i < count; i++) {
int seq = mPendingEvents.keyAt(i);
Message msg = mH.obtainMessage(MSG_FLUSH_INPUT_EVENT, seq, 0);
msg.setAsynchronous(true);
msg.sendToTarget();
}
| public void | focusIn(android.view.View view)Call this when a view receives focus.
synchronized (mH) {
focusInLocked(view);
}
| void | focusInLocked(android.view.View view)
if (DEBUG) Log.v(TAG, "focusIn: " + view);
if (mCurRootView != view.getRootView()) {
// This is a request from a window that isn't in the window with
// IME focus, so ignore it.
if (DEBUG) Log.v(TAG, "Not IME target window, ignoring");
return;
}
mNextServedView = view;
scheduleCheckFocusLocked(view);
| public void | focusOut(android.view.View view)Call this when a view loses focus.
synchronized (mH) {
if (DEBUG) Log.v(TAG, "focusOut: " + view
+ " mServedView=" + mServedView
+ " winFocus=" + view.hasWindowFocus());
if (mServedView != view) {
// The following code would auto-hide the IME if we end up
// with no more views with focus. This can happen, however,
// whenever we go into touch mode, so it ends up hiding
// at times when we don't really want it to. For now it
// seems better to just turn it all off.
if (false && view.hasWindowFocus()) {
mNextServedView = null;
scheduleCheckFocusLocked(view);
}
}
}
| public com.android.internal.view.IInputMethodClient | getClient()
return mClient;
| public InputMethodSubtype | getCurrentInputMethodSubtype()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.
synchronized (mH) {
try {
return mService.getCurrentInputMethodSubtype();
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return null;
}
}
| public java.util.List | getEnabledInputMethodList()
try {
return mService.getEnabledInputMethodList();
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public java.util.List | getEnabledInputMethodSubtypeList(InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes)Returns a list of enabled input method subtypes for the specified input method info.
try {
return mService.getEnabledInputMethodSubtypeList(
imi == null ? null : imi.getId(), allowsImplicitlySelectedSubtypes);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public com.android.internal.view.IInputContext | getInputContext()
return mIInputContext;
| public java.util.List | getInputMethodList()
try {
return mService.getInputMethodList();
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public int | getInputMethodWindowVisibleHeight()
synchronized (mH) {
try {
return mService.getInputMethodWindowVisibleHeight();
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return 0;
}
}
| public static android.view.inputmethod.InputMethodManager | getInstance()Retrieve the global InputMethodManager instance, creating it if it
doesn't already exist.
synchronized (InputMethodManager.class) {
if (sInstance == null) {
IBinder b = ServiceManager.getService(Context.INPUT_METHOD_SERVICE);
IInputMethodManager service = IInputMethodManager.Stub.asInterface(b);
sInstance = new InputMethodManager(service, Looper.getMainLooper());
}
return sInstance;
}
| public InputMethodSubtype | getLastInputMethodSubtype()
synchronized (mH) {
try {
return mService.getLastInputMethodSubtype();
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return null;
}
}
| public java.util.Map | getShortcutInputMethodsAndSubtypes()Returns a map of all shortcut input method info and their subtypes.
synchronized (mH) {
HashMap<InputMethodInfo, List<InputMethodSubtype>> ret =
new HashMap<InputMethodInfo, List<InputMethodSubtype>>();
try {
// TODO: We should change the return type from List<Object> to List<Parcelable>
List<Object> info = mService.getShortcutInputMethodsAndSubtypes();
// "info" has imi1, subtype1, subtype2, imi2, subtype2, imi3, subtype3..in the list
ArrayList<InputMethodSubtype> subtypes = null;
final int N = info.size();
if (info != null && N > 0) {
for (int i = 0; i < N; ++i) {
Object o = info.get(i);
if (o instanceof InputMethodInfo) {
if (ret.containsKey(o)) {
Log.e(TAG, "IMI list already contains the same InputMethod.");
break;
}
subtypes = new ArrayList<InputMethodSubtype>();
ret.put((InputMethodInfo)o, subtypes);
} else if (subtypes != null && o instanceof InputMethodSubtype) {
subtypes.add((InputMethodSubtype)o);
}
}
}
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
return ret;
}
| public void | hideSoftInputFromInputMethod(android.os.IBinder token, int flags)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.
try {
mService.hideMySoftInput(token, flags);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public boolean | hideSoftInputFromWindow(android.os.IBinder windowToken, int flags)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.
return hideSoftInputFromWindow(windowToken, flags, null);
| public boolean | hideSoftInputFromWindow(android.os.IBinder windowToken, int flags, android.os.ResultReceiver resultReceiver)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.
checkFocus();
synchronized (mH) {
if (mServedView == null || mServedView.getWindowToken() != windowToken) {
return false;
}
try {
return mService.hideSoftInput(mClient, flags, resultReceiver);
} catch (RemoteException e) {
}
return false;
}
| public void | hideStatusIcon(android.os.IBinder imeToken)
try {
mService.updateStatusIcon(imeToken, null, 0);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| void | invokeFinishedInputEventCallback(android.view.inputmethod.InputMethodManager$PendingEvent p, boolean handled)
p.mHandled = handled;
if (p.mHandler.getLooper().isCurrentThread()) {
// Already running on the callback handler thread so we can send the
// callback immediately.
p.run();
} else {
// Post the event to the callback handler thread.
// In this case, the callback will be responsible for recycling the event.
Message msg = Message.obtain(p.mHandler, p);
msg.setAsynchronous(true);
msg.sendToTarget();
}
| public boolean | isAcceptingText()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.
checkFocus();
return mServedInputConnection != null;
| public boolean | isActive(android.view.View view)Return true if the given view is the currently active view for the
input method.
checkFocus();
synchronized (mH) {
return (mServedView == view
|| (mServedView != null
&& mServedView.checkInputConnectionProxy(view)))
&& mCurrentTextBoxAttribute != null;
}
| public boolean | isActive()Return true if any view is currently active in the input method.
checkFocus();
synchronized (mH) {
return mServedView != null && mCurrentTextBoxAttribute != null;
}
| public boolean | isCursorAnchorInfoEnabled()Return true if the current input method wants to be notified when cursor/anchor location
is changed.
synchronized (mH) {
final boolean isImmediate = (mRequestUpdateCursorAnchorInfoMonitorMode &
InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0;
final boolean isMonitoring = (mRequestUpdateCursorAnchorInfoMonitorMode &
InputConnection.CURSOR_UPDATE_MONITOR) != 0;
return isImmediate || isMonitoring;
}
| public boolean | isFullscreenMode()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.
return mFullscreenMode;
| public boolean | isWatchingCursor(android.view.View view)Return true if the current input method wants to watch the location
of the input editor's cursor in its window.
return false;
| private void | notifyInputConnectionFinished()Notifies the served view that the current InputConnection will no longer be used.
if (mServedView != null && mServedInputConnection != null) {
// We need to tell the previously served view that it is no
// longer the input target, so it can reset its state. Schedule
// this call on its window's Handler so it will be on the correct
// thread and outside of our lock.
ViewRootImpl viewRootImpl = mServedView.getViewRootImpl();
if (viewRootImpl != null) {
// This will result in a call to reportFinishInputConnection() below.
viewRootImpl.dispatchFinishInputConnection(mServedInputConnection);
}
}
| public void | notifySuggestionPicked(android.text.style.SuggestionSpan span, java.lang.String originalString, int index)
try {
mService.notifySuggestionPicked(span, originalString, index);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public void | notifyUserAction()Notify that a user took some action with this input method.
synchronized (mH) {
if (mLastSentUserActionNotificationSequenceNumber ==
mNextUserActionNotificationSequenceNumber) {
if (DEBUG) {
Log.w(TAG, "Ignoring notifyUserAction as it has already been sent."
+ " mLastSentUserActionNotificationSequenceNumber: "
+ mLastSentUserActionNotificationSequenceNumber
+ " mNextUserActionNotificationSequenceNumber: "
+ mNextUserActionNotificationSequenceNumber);
}
return;
}
try {
if (DEBUG) {
Log.w(TAG, "notifyUserAction: "
+ " mLastSentUserActionNotificationSequenceNumber: "
+ mLastSentUserActionNotificationSequenceNumber
+ " mNextUserActionNotificationSequenceNumber: "
+ mNextUserActionNotificationSequenceNumber);
}
mService.notifyUserAction(mNextUserActionNotificationSequenceNumber);
mLastSentUserActionNotificationSequenceNumber =
mNextUserActionNotificationSequenceNumber;
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
| private android.view.inputmethod.InputMethodManager$PendingEvent | obtainPendingEventLocked(android.view.InputEvent event, java.lang.Object token, java.lang.String inputMethodId, android.view.inputmethod.InputMethodManager$FinishedInputEventCallback callback, android.os.Handler handler)
PendingEvent p = mPendingEventPool.acquire();
if (p == null) {
p = new PendingEvent();
}
p.mEvent = event;
p.mToken = token;
p.mInputMethodId = inputMethodId;
p.mCallback = callback;
p.mHandler = handler;
return p;
| public void | onWindowFocus(android.view.View rootView, android.view.View focusedView, int softInputMode, boolean first, int windowFlags)Called by ViewAncestor when its window gets input focus.
boolean forceNewFocus = false;
synchronized (mH) {
if (DEBUG) Log.v(TAG, "onWindowFocus: " + focusedView
+ " softInputMode=" + softInputMode
+ " first=" + first + " flags=#"
+ Integer.toHexString(windowFlags));
if (mHasBeenInactive) {
if (DEBUG) Log.v(TAG, "Has been inactive! Starting fresh");
mHasBeenInactive = false;
forceNewFocus = true;
}
focusInLocked(focusedView != null ? focusedView : rootView);
}
int controlFlags = 0;
if (focusedView != null) {
controlFlags |= CONTROL_WINDOW_VIEW_HAS_FOCUS;
if (focusedView.onCheckIsTextEditor()) {
controlFlags |= CONTROL_WINDOW_IS_TEXT_EDITOR;
}
}
if (first) {
controlFlags |= CONTROL_WINDOW_FIRST;
}
if (checkFocusNoStartInput(forceNewFocus, true)) {
// We need to restart input on the current focus view. This
// should be done in conjunction with telling the system service
// about the window gaining focus, to help make the transition
// smooth.
if (startInputInner(rootView.getWindowToken(),
controlFlags, softInputMode, windowFlags)) {
return;
}
}
// For some reason we didn't do a startInput + windowFocusGain, so
// we'll just do a window focus gain and call it a day.
synchronized (mH) {
try {
if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput");
mService.windowGainedFocus(mClient, rootView.getWindowToken(),
controlFlags, softInputMode, windowFlags, null, null);
} catch (RemoteException e) {
}
}
| public static android.view.inputmethod.InputMethodManager | peekInstance()Private optimization: retrieve the global InputMethodManager instance,
if it exists.
return sInstance;
| private void | recyclePendingEventLocked(android.view.inputmethod.InputMethodManager$PendingEvent p)
p.recycle();
mPendingEventPool.release(p);
| public void | registerSuggestionSpansForNotification(android.text.style.SuggestionSpan[] spans)
try {
mService.registerSuggestionSpansForNotification(spans);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public void | reportFinishInputConnection(InputConnection ic)Called from the FINISH_INPUT_CONNECTION message above.
if (mServedInputConnection != ic) {
ic.finishComposingText();
// To avoid modifying the public InputConnection interface
if (ic instanceof BaseInputConnection) {
((BaseInputConnection) ic).reportFinish();
}
}
| public void | restartInput(android.view.View view)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().
checkFocus();
synchronized (mH) {
if (mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view))) {
return;
}
mServedConnecting = true;
}
startInputInner(null, 0, 0, 0);
| static void | scheduleCheckFocusLocked(android.view.View view)
ViewRootImpl viewRootImpl = view.getViewRootImpl();
if (viewRootImpl != null) {
viewRootImpl.dispatchCheckFocus();
}
| public void | sendAppPrivateCommand(android.view.View view, java.lang.String action, android.os.Bundle data)Call {@link InputMethodSession#appPrivateCommand(String, Bundle)
InputMethodSession.appPrivateCommand()} on the current Input Method.
checkFocus();
synchronized (mH) {
if ((mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view)))
|| mCurrentTextBoxAttribute == null || mCurMethod == null) {
return;
}
try {
if (DEBUG) Log.v(TAG, "APP PRIVATE COMMAND " + action + ": " + data);
mCurMethod.appPrivateCommand(action, data);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
| void | sendInputEventAndReportResultOnMainLooper(android.view.inputmethod.InputMethodManager$PendingEvent p)
final boolean handled;
synchronized (mH) {
int result = sendInputEventOnMainLooperLocked(p);
if (result == DISPATCH_IN_PROGRESS) {
return;
}
handled = (result == DISPATCH_HANDLED);
}
invokeFinishedInputEventCallback(p, handled);
| int | sendInputEventOnMainLooperLocked(android.view.inputmethod.InputMethodManager$PendingEvent p)
if (mCurChannel != null) {
if (mCurSender == null) {
mCurSender = new ImeInputEventSender(mCurChannel, mH.getLooper());
}
final InputEvent event = p.mEvent;
final int seq = event.getSequenceNumber();
if (mCurSender.sendInputEvent(seq, event)) {
mPendingEvents.put(seq, p);
Trace.traceCounter(Trace.TRACE_TAG_INPUT, PENDING_EVENT_COUNTER,
mPendingEvents.size());
Message msg = mH.obtainMessage(MSG_TIMEOUT_INPUT_EVENT, p);
msg.setAsynchronous(true);
mH.sendMessageDelayed(msg, INPUT_METHOD_NOT_RESPONDING_TIMEOUT);
return DISPATCH_IN_PROGRESS;
}
Log.w(TAG, "Unable to send input event to IME: "
+ mCurId + " dropping: " + event);
}
return DISPATCH_NOT_HANDLED;
| public void | setAdditionalInputMethodSubtypes(java.lang.String imiId, InputMethodSubtype[] subtypes)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 InputMethodSubtype#hashCode()} to refer
to the current implementation.)
synchronized (mH) {
try {
mService.setAdditionalInputMethodSubtypes(imiId, subtypes);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
| public boolean | setCurrentInputMethodSubtype(InputMethodSubtype subtype)Switch to a new input method subtype of the current input method.
synchronized (mH) {
try {
return mService.setCurrentInputMethodSubtype(subtype);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return false;
}
}
| public void | setFullscreenMode(boolean fullScreen)
mFullscreenMode = fullScreen;
| public void | setImeWindowStatus(android.os.IBinder imeToken, int vis, int backDisposition)
try {
mService.setImeWindowStatus(imeToken, vis, backDisposition);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| void | setInputChannelLocked(android.view.InputChannel channel)
if (mCurChannel != channel) {
if (mCurSender != null) {
flushPendingEventsLocked();
mCurSender.dispose();
mCurSender = null;
}
if (mCurChannel != null) {
mCurChannel.dispose();
}
mCurChannel = channel;
}
| public void | setInputMethod(android.os.IBinder token, java.lang.String id)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.
try {
mService.setInputMethod(token, id);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public void | setInputMethodAndSubtype(android.os.IBinder token, java.lang.String id, InputMethodSubtype subtype)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.
try {
mService.setInputMethodAndSubtype(token, id, subtype);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public void | setUpdateCursorAnchorInfoMode(int flags)Set the requested mode for {@link #updateCursorAnchorInfo(View, CursorAnchorInfo)}.
synchronized (mH) {
mRequestUpdateCursorAnchorInfoMonitorMode = flags;
}
| public boolean | shouldOfferSwitchingToNextInputMethod(android.os.IBinder imeToken)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.
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.
synchronized (mH) {
try {
return mService.shouldOfferSwitchingToNextInputMethod(imeToken);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return false;
}
}
| public void | showInputMethodAndSubtypeEnabler(java.lang.String imiId)Show the settings for enabling subtypes of the specified input method.
synchronized (mH) {
try {
mService.showInputMethodAndSubtypeEnablerFromClient(mClient, imiId);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
| public void | showInputMethodPicker()
synchronized (mH) {
showInputMethodPickerLocked();
}
| private void | showInputMethodPickerLocked()
try {
mService.showInputMethodPickerFromClient(mClient);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
| public boolean | showSoftInput(android.view.View view, int flags)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.
return showSoftInput(view, flags, null);
| public boolean | showSoftInput(android.view.View view, int flags, android.os.ResultReceiver resultReceiver)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.
checkFocus();
synchronized (mH) {
if (mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view))) {
return false;
}
try {
return mService.showSoftInput(mClient, flags, resultReceiver);
} catch (RemoteException e) {
}
return false;
}
| public void | showSoftInputFromInputMethod(android.os.IBinder token, int flags)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.
try {
mService.showMySoftInput(token, flags);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public void | showSoftInputUnchecked(int flags, android.os.ResultReceiver resultReceiver)
try {
mService.showSoftInput(mClient, flags, resultReceiver);
} catch (RemoteException e) {
}
| public void | showStatusIcon(android.os.IBinder imeToken, java.lang.String packageName, int iconId)
try {
mService.updateStatusIcon(imeToken, packageName, iconId);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
| public void | startGettingWindowFocus(android.view.View rootView)
synchronized (mH) {
mCurRootView = rootView;
}
| boolean | startInputInner(android.os.IBinder windowGainingFocus, int controlFlags, int softInputMode, int windowFlags)
final View view;
synchronized (mH) {
view = mServedView;
// Make sure we have a window token for the served view.
if (DEBUG) Log.v(TAG, "Starting input: view=" + view);
if (view == null) {
if (DEBUG) Log.v(TAG, "ABORT input: no served view!");
return false;
}
}
// Now we need to get an input connection from the served view.
// This is complicated in a couple ways: we can't be holding our lock
// when calling out to the view, and we need to make sure we call into
// the view on the same thread that is driving its view hierarchy.
Handler vh = view.getHandler();
if (vh == null) {
// If the view doesn't have a handler, something has changed out
// from under us, so just close the current input.
// If we don't close the current input, the current input method can remain on the
// screen without a connection.
if (DEBUG) Log.v(TAG, "ABORT input: no handler for view! Close current input.");
closeCurrentInput();
return false;
}
if (vh.getLooper() != Looper.myLooper()) {
// The view is running on a different thread than our own, so
// we need to reschedule our work for over there.
if (DEBUG) Log.v(TAG, "Starting input: reschedule to view thread");
vh.post(new Runnable() {
@Override
public void run() {
startInputInner(null, 0, 0, 0);
}
});
return false;
}
// Okay we are now ready to call into the served view and have it
// do its stuff.
// Life is good: let's hook everything up!
EditorInfo tba = new EditorInfo();
tba.packageName = view.getContext().getPackageName();
tba.fieldId = view.getId();
InputConnection ic = view.onCreateInputConnection(tba);
if (DEBUG) Log.v(TAG, "Starting input: tba=" + tba + " ic=" + ic);
synchronized (mH) {
// Now that we are locked again, validate that our state hasn't
// changed.
if (mServedView != view || !mServedConnecting) {
// Something else happened, so abort.
if (DEBUG) Log.v(TAG,
"Starting input: finished by someone else (view="
+ mServedView + " conn=" + mServedConnecting + ")");
return false;
}
// If we already have a text box, then this view is already
// connected so we want to restart it.
if (mCurrentTextBoxAttribute == null) {
controlFlags |= CONTROL_START_INITIAL;
}
// Hook 'em up and let 'er rip.
mCurrentTextBoxAttribute = tba;
mServedConnecting = false;
// Notify the served view that its previous input connection is finished
notifyInputConnectionFinished();
mServedInputConnection = ic;
ControlledInputConnectionWrapper servedContext;
if (ic != null) {
mCursorSelStart = tba.initialSelStart;
mCursorSelEnd = tba.initialSelEnd;
mCursorCandStart = -1;
mCursorCandEnd = -1;
mCursorRect.setEmpty();
mCursorAnchorInfo = null;
servedContext = new ControlledInputConnectionWrapper(vh.getLooper(), ic, this);
} else {
servedContext = null;
}
if (mServedInputConnectionWrapper != null) {
mServedInputConnectionWrapper.deactivate();
}
mServedInputConnectionWrapper = servedContext;
try {
if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic="
+ ic + " tba=" + tba + " controlFlags=#"
+ Integer.toHexString(controlFlags));
InputBindResult res;
if (windowGainingFocus != null) {
res = mService.windowGainedFocus(mClient, windowGainingFocus,
controlFlags, softInputMode, windowFlags,
tba, servedContext);
} else {
res = mService.startInput(mClient,
servedContext, tba, controlFlags);
}
if (DEBUG) Log.v(TAG, "Starting input: Bind result=" + res);
if (res != null) {
if (res.id != null) {
setInputChannelLocked(res.channel);
mBindSequence = res.sequence;
mCurMethod = res.method;
mCurId = res.id;
mNextUserActionNotificationSequenceNumber =
res.userActionNotificationSequenceNumber;
} else {
if (res.channel != null && res.channel != mCurChannel) {
res.channel.dispose();
}
if (mCurMethod == null) {
// This means there is no input method available.
if (DEBUG) Log.v(TAG, "ABORT input: no input method!");
return true;
}
}
}
if (mCurMethod != null && mCompletions != null) {
try {
mCurMethod.displayCompletions(mCompletions);
} catch (RemoteException e) {
}
}
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
return true;
| public boolean | switchToLastInputMethod(android.os.IBinder imeToken)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.
synchronized (mH) {
try {
return mService.switchToLastInputMethod(imeToken);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return false;
}
}
| public boolean | switchToNextInputMethod(android.os.IBinder imeToken, boolean onlyCurrentIme)Force switch to the next input method and subtype. If there is no IME enabled except
current IME and subtype, do nothing.
synchronized (mH) {
try {
return mService.switchToNextInputMethod(imeToken, onlyCurrentIme);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
return false;
}
}
| public void | toggleSoftInput(int showFlags, int hideFlags)
if (mCurMethod != null) {
try {
mCurMethod.toggleSoftInput(showFlags, hideFlags);
} catch (RemoteException e) {
}
}
| public void | toggleSoftInputFromWindow(android.os.IBinder windowToken, int showFlags, int hideFlags)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.
synchronized (mH) {
if (mServedView == null || mServedView.getWindowToken() != windowToken) {
return;
}
if (mCurMethod != null) {
try {
mCurMethod.toggleSoftInput(showFlags, hideFlags);
} catch (RemoteException e) {
}
}
}
| public void | updateCursor(android.view.View view, int left, int top, int right, int bottom)Report the current cursor location in its window.
checkFocus();
synchronized (mH) {
if ((mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view)))
|| mCurrentTextBoxAttribute == null || mCurMethod == null) {
return;
}
mTmpCursorRect.set(left, top, right, bottom);
if (!mCursorRect.equals(mTmpCursorRect)) {
if (DEBUG) Log.d(TAG, "updateCursor");
try {
if (DEBUG) Log.v(TAG, "CURSOR CHANGE: " + mCurMethod);
mCurMethod.updateCursor(mTmpCursorRect);
mCursorRect.set(mTmpCursorRect);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
}
| public void | updateCursorAnchorInfo(android.view.View view, CursorAnchorInfo cursorAnchorInfo)Report positional change of the text insertion point and/or characters in the composition
string.
if (view == null || cursorAnchorInfo == null) {
return;
}
checkFocus();
synchronized (mH) {
if ((mServedView != view &&
(mServedView == null || !mServedView.checkInputConnectionProxy(view)))
|| mCurrentTextBoxAttribute == null || mCurMethod == null) {
return;
}
// If immediate bit is set, we will call updateCursorAnchorInfo() even when the data has
// not been changed from the previous call.
final boolean isImmediate = (mRequestUpdateCursorAnchorInfoMonitorMode &
InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0;
if (!isImmediate && Objects.equals(mCursorAnchorInfo, cursorAnchorInfo)) {
// TODO: Consider always emitting this message once we have addressed redundant
// calls of this method from android.widget.Editor.
if (DEBUG) {
Log.w(TAG, "Ignoring redundant updateCursorAnchorInfo: info="
+ cursorAnchorInfo);
}
return;
}
if (DEBUG) Log.v(TAG, "updateCursorAnchorInfo: " + cursorAnchorInfo);
try {
mCurMethod.updateCursorAnchorInfo(cursorAnchorInfo);
mCursorAnchorInfo = cursorAnchorInfo;
// Clear immediate bit (if any).
mRequestUpdateCursorAnchorInfoMonitorMode &=
~InputConnection.CURSOR_UPDATE_IMMEDIATE;
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
| public void | updateExtractedText(android.view.View view, int token, ExtractedText text)
checkFocus();
synchronized (mH) {
if (mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view))) {
return;
}
if (mCurMethod != null) {
try {
mCurMethod.updateExtractedText(token, text);
} catch (RemoteException e) {
}
}
}
| public void | updateSelection(android.view.View view, int selStart, int selEnd, int candidatesStart, int candidatesEnd)Report the current selection range.
Editor authors, 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 EditorInfo#initialSelStart} and {@link 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.
checkFocus();
synchronized (mH) {
if ((mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view)))
|| mCurrentTextBoxAttribute == null || mCurMethod == null) {
return;
}
if (mCursorSelStart != selStart || mCursorSelEnd != selEnd
|| mCursorCandStart != candidatesStart
|| mCursorCandEnd != candidatesEnd) {
if (DEBUG) Log.d(TAG, "updateSelection");
try {
if (DEBUG) Log.v(TAG, "SELECTION CHANGE: " + mCurMethod);
final int oldSelStart = mCursorSelStart;
final int oldSelEnd = mCursorSelEnd;
// Update internal values before sending updateSelection to the IME, because
// if it changes the text within its onUpdateSelection handler in a way that
// does not move the cursor we don't want to call it again with the same values.
mCursorSelStart = selStart;
mCursorSelEnd = selEnd;
mCursorCandStart = candidatesStart;
mCursorCandEnd = candidatesEnd;
mCurMethod.updateSelection(oldSelStart, oldSelEnd,
selStart, selEnd, candidatesStart, candidatesEnd);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
}
| public void | viewClicked(android.view.View view)Notify the event when the user tapped or clicked the text view.
final boolean focusChanged = mServedView != mNextServedView;
checkFocus();
synchronized (mH) {
if ((mServedView != view && (mServedView == null
|| !mServedView.checkInputConnectionProxy(view)))
|| mCurrentTextBoxAttribute == null || mCurMethod == null) {
return;
}
try {
if (DEBUG) Log.v(TAG, "onViewClicked: " + focusChanged);
mCurMethod.viewClicked(focusChanged);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}
}
| public void | windowDismissed(android.os.IBinder appWindowToken)When the focused window is dismissed, this method is called to finish the
input method started before.
checkFocus();
synchronized (mH) {
if (mServedView != null &&
mServedView.getWindowToken() == appWindowToken) {
finishInputLocked();
}
}
|
|