FileDocCategorySizeDatePackage
IInputMethodSessionWrapper.javaAPI DocAndroid 5.1 API9154Thu Mar 12 22:22:10 GMT 2015android.inputmethodservice

IInputMethodSessionWrapper

public class IInputMethodSessionWrapper extends IInputMethodSession.Stub implements HandlerCaller.Callback

Fields Summary
private static final String
TAG
private static final int
DO_FINISH_INPUT
private static final int
DO_DISPLAY_COMPLETIONS
private static final int
DO_UPDATE_EXTRACTED_TEXT
private static final int
DO_UPDATE_SELECTION
private static final int
DO_UPDATE_CURSOR
private static final int
DO_UPDATE_CURSOR_ANCHOR_INFO
private static final int
DO_APP_PRIVATE_COMMAND
private static final int
DO_TOGGLE_SOFT_INPUT
private static final int
DO_FINISH_SESSION
private static final int
DO_VIEW_CLICKED
com.android.internal.os.HandlerCaller
mCaller
android.view.inputmethod.InputMethodSession
mInputMethodSession
android.view.InputChannel
mChannel
ImeInputEventReceiver
mReceiver
Constructors Summary
public IInputMethodSessionWrapper(android.content.Context context, android.view.inputmethod.InputMethodSession inputMethodSession, android.view.InputChannel channel)


      
                
        mCaller = new HandlerCaller(context, null,
                this, true /*asyncHandler*/);
        mInputMethodSession = inputMethodSession;
        mChannel = channel;
        if (channel != null) {
            mReceiver = new ImeInputEventReceiver(channel, context.getMainLooper());
        }
    
Methods Summary
public voidappPrivateCommand(java.lang.String action, android.os.Bundle data)

        mCaller.executeOrSendMessage(
                mCaller.obtainMessageOO(DO_APP_PRIVATE_COMMAND, action, data));
    
public voiddisplayCompletions(android.view.inputmethod.CompletionInfo[] completions)

        mCaller.executeOrSendMessage(mCaller.obtainMessageO(
                DO_DISPLAY_COMPLETIONS, completions));
    
private voiddoFinishSession()

        mInputMethodSession = null;
        if (mReceiver != null) {
            mReceiver.dispose();
            mReceiver = null;
        }
        if (mChannel != null) {
            mChannel.dispose();
            mChannel = null;
        }
    
public voidexecuteMessage(android.os.Message msg)

        if (mInputMethodSession == null) {
            // The session has been finished. Args needs to be recycled
            // for cases below.
            switch (msg.what) {
                case DO_UPDATE_SELECTION:
                case DO_APP_PRIVATE_COMMAND: {
                    SomeArgs args = (SomeArgs)msg.obj;
                    args.recycle();
                }
            }
            return;
        }

        switch (msg.what) {
            case DO_FINISH_INPUT:
                mInputMethodSession.finishInput();
                return;
            case DO_DISPLAY_COMPLETIONS:
                mInputMethodSession.displayCompletions((CompletionInfo[])msg.obj);
                return;
            case DO_UPDATE_EXTRACTED_TEXT:
                mInputMethodSession.updateExtractedText(msg.arg1,
                        (ExtractedText)msg.obj);
                return;
            case DO_UPDATE_SELECTION: {
                SomeArgs args = (SomeArgs)msg.obj;
                mInputMethodSession.updateSelection(args.argi1, args.argi2,
                        args.argi3, args.argi4, args.argi5, args.argi6);
                args.recycle();
                return;
            }
            case DO_UPDATE_CURSOR: {
                mInputMethodSession.updateCursor((Rect)msg.obj);
                return;
            }
            case DO_UPDATE_CURSOR_ANCHOR_INFO: {
                mInputMethodSession.updateCursorAnchorInfo((CursorAnchorInfo)msg.obj);
                return;
            }
            case DO_APP_PRIVATE_COMMAND: {
                SomeArgs args = (SomeArgs)msg.obj;
                mInputMethodSession.appPrivateCommand((String)args.arg1,
                        (Bundle)args.arg2);
                args.recycle();
                return;
            }
            case DO_TOGGLE_SOFT_INPUT: {
                mInputMethodSession.toggleSoftInput(msg.arg1, msg.arg2);
                return;
            }
            case DO_FINISH_SESSION: {
                doFinishSession();
                return;
            }
            case DO_VIEW_CLICKED: {
                mInputMethodSession.viewClicked(msg.arg1 == 1);
                return;
            }
        }
        Log.w(TAG, "Unhandled message code: " + msg.what);
    
public voidfinishInput()

        mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_INPUT));
    
public voidfinishSession()

        mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_SESSION));
    
public android.view.inputmethod.InputMethodSessiongetInternalInputMethodSession()

        return mInputMethodSession;
    
public voidtoggleSoftInput(int showFlags, int hideFlags)

        mCaller.executeOrSendMessage(
                mCaller.obtainMessageII(DO_TOGGLE_SOFT_INPUT, showFlags, hideFlags));
    
public voidupdateCursor(android.graphics.Rect newCursor)

        mCaller.executeOrSendMessage(
                mCaller.obtainMessageO(DO_UPDATE_CURSOR, newCursor));
    
public voidupdateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo cursorAnchorInfo)

        mCaller.executeOrSendMessage(
                mCaller.obtainMessageO(DO_UPDATE_CURSOR_ANCHOR_INFO, cursorAnchorInfo));
    
public voidupdateExtractedText(int token, android.view.inputmethod.ExtractedText text)

        mCaller.executeOrSendMessage(mCaller.obtainMessageIO(
                DO_UPDATE_EXTRACTED_TEXT, token, text));
    
public voidupdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd)

        mCaller.executeOrSendMessage(mCaller.obtainMessageIIIIII(DO_UPDATE_SELECTION,
                oldSelStart, oldSelEnd, newSelStart, newSelEnd,
                candidatesStart, candidatesEnd));
    
public voidviewClicked(boolean focusChanged)

        mCaller.executeOrSendMessage(
                mCaller.obtainMessageI(DO_VIEW_CLICKED, focusChanged ? 1 : 0));