Search in sources :

Example 6 with InputConnectionWrapper

use of com.android.internal.view.InputConnectionWrapper in project android_frameworks_base by AOSPA.

the class IInputMethodWrapper method bindInput.

@Override
public void bindInput(InputBinding binding) {
    // This IInputContext is guaranteed to implement all the methods.
    final int missingMethodFlags = 0;
    InputConnection ic = new InputConnectionWrapper(mTarget, IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags);
    InputBinding nu = new InputBinding(ic, binding);
    mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
}
Also used : InputConnection(android.view.inputmethod.InputConnection) InputConnectionWrapper(com.android.internal.view.InputConnectionWrapper) InputBinding(android.view.inputmethod.InputBinding)

Example 7 with InputConnectionWrapper

use of com.android.internal.view.InputConnectionWrapper in project android_frameworks_base by crdroidandroid.

the class IInputMethodWrapper method bindInput.

@Override
public void bindInput(InputBinding binding) {
    // This IInputContext is guaranteed to implement all the methods.
    final int missingMethodFlags = 0;
    InputConnection ic = new InputConnectionWrapper(mTarget, IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags);
    InputBinding nu = new InputBinding(ic, binding);
    mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
}
Also used : InputConnection(android.view.inputmethod.InputConnection) InputConnectionWrapper(com.android.internal.view.InputConnectionWrapper) InputBinding(android.view.inputmethod.InputBinding)

Example 8 with InputConnectionWrapper

use of com.android.internal.view.InputConnectionWrapper in project android_frameworks_base by ParanoidAndroid.

the class IInputMethodWrapper method executeMessage.

@Override
public void executeMessage(Message msg) {
    InputMethod inputMethod = mInputMethod.get();
    // Need a valid reference to the inputMethod for everything except a dump.
    if (inputMethod == null && msg.what != DO_DUMP) {
        Log.w(TAG, "Input method reference was null, ignoring message: " + msg.what);
        return;
    }
    switch(msg.what) {
        case DO_DUMP:
            {
                AbstractInputMethodService target = mTarget.get();
                if (target == null) {
                    return;
                }
                SomeArgs args = (SomeArgs) msg.obj;
                try {
                    target.dump((FileDescriptor) args.arg1, (PrintWriter) args.arg2, (String[]) args.arg3);
                } catch (RuntimeException e) {
                    ((PrintWriter) args.arg2).println("Exception: " + e);
                }
                synchronized (args.arg4) {
                    ((CountDownLatch) args.arg4).countDown();
                }
                args.recycle();
                return;
            }
        case DO_ATTACH_TOKEN:
            {
                inputMethod.attachToken((IBinder) msg.obj);
                return;
            }
        case DO_SET_INPUT_CONTEXT:
            {
                inputMethod.bindInput((InputBinding) msg.obj);
                return;
            }
        case DO_UNSET_INPUT_CONTEXT:
            inputMethod.unbindInput();
            return;
        case DO_START_INPUT:
            {
                SomeArgs args = (SomeArgs) msg.obj;
                IInputContext inputContext = (IInputContext) args.arg1;
                InputConnection ic = inputContext != null ? new InputConnectionWrapper(inputContext) : null;
                EditorInfo info = (EditorInfo) args.arg2;
                info.makeCompatible(mTargetSdkVersion);
                inputMethod.startInput(ic, info);
                args.recycle();
                return;
            }
        case DO_RESTART_INPUT:
            {
                SomeArgs args = (SomeArgs) msg.obj;
                IInputContext inputContext = (IInputContext) args.arg1;
                InputConnection ic = inputContext != null ? new InputConnectionWrapper(inputContext) : null;
                EditorInfo info = (EditorInfo) args.arg2;
                info.makeCompatible(mTargetSdkVersion);
                inputMethod.restartInput(ic, info);
                args.recycle();
                return;
            }
        case DO_CREATE_SESSION:
            {
                SomeArgs args = (SomeArgs) msg.obj;
                inputMethod.createSession(new InputMethodSessionCallbackWrapper(mCaller.mContext, (InputChannel) args.arg1, (IInputSessionCallback) args.arg2));
                args.recycle();
                return;
            }
        case DO_SET_SESSION_ENABLED:
            inputMethod.setSessionEnabled((InputMethodSession) msg.obj, msg.arg1 != 0);
            return;
        case DO_REVOKE_SESSION:
            inputMethod.revokeSession((InputMethodSession) msg.obj);
            return;
        case DO_SHOW_SOFT_INPUT:
            inputMethod.showSoftInput(msg.arg1, (ResultReceiver) msg.obj);
            return;
        case DO_HIDE_SOFT_INPUT:
            inputMethod.hideSoftInput(msg.arg1, (ResultReceiver) msg.obj);
            return;
        case DO_CHANGE_INPUTMETHOD_SUBTYPE:
            inputMethod.changeInputMethodSubtype((InputMethodSubtype) msg.obj);
            return;
    }
    Log.w(TAG, "Unhandled message code: " + msg.what);
}
Also used : IInputContext(com.android.internal.view.IInputContext) InputConnectionWrapper(com.android.internal.view.InputConnectionWrapper) FileDescriptor(java.io.FileDescriptor) InputConnection(android.view.inputmethod.InputConnection) IBinder(android.os.IBinder) EditorInfo(android.view.inputmethod.EditorInfo) SomeArgs(com.android.internal.os.SomeArgs) IInputMethod(com.android.internal.view.IInputMethod) InputMethod(android.view.inputmethod.InputMethod) InputBinding(android.view.inputmethod.InputBinding) PrintWriter(java.io.PrintWriter)

Example 9 with InputConnectionWrapper

use of com.android.internal.view.InputConnectionWrapper in project platform_frameworks_base by android.

the class IInputMethodWrapper method bindInput.

@Override
public void bindInput(InputBinding binding) {
    // This IInputContext is guaranteed to implement all the methods.
    final int missingMethodFlags = 0;
    InputConnection ic = new InputConnectionWrapper(mTarget, IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags);
    InputBinding nu = new InputBinding(ic, binding);
    mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
}
Also used : InputConnection(android.view.inputmethod.InputConnection) InputConnectionWrapper(com.android.internal.view.InputConnectionWrapper) InputBinding(android.view.inputmethod.InputBinding)

Example 10 with InputConnectionWrapper

use of com.android.internal.view.InputConnectionWrapper in project android_frameworks_base by AOSPA.

the class IInputMethodWrapper method executeMessage.

@Override
public void executeMessage(Message msg) {
    InputMethod inputMethod = mInputMethod.get();
    // Need a valid reference to the inputMethod for everything except a dump.
    if (inputMethod == null && msg.what != DO_DUMP) {
        Log.w(TAG, "Input method reference was null, ignoring message: " + msg.what);
        return;
    }
    switch(msg.what) {
        case DO_DUMP:
            {
                AbstractInputMethodService target = mTarget.get();
                if (target == null) {
                    return;
                }
                SomeArgs args = (SomeArgs) msg.obj;
                try {
                    target.dump((FileDescriptor) args.arg1, (PrintWriter) args.arg2, (String[]) args.arg3);
                } catch (RuntimeException e) {
                    ((PrintWriter) args.arg2).println("Exception: " + e);
                }
                synchronized (args.arg4) {
                    ((CountDownLatch) args.arg4).countDown();
                }
                args.recycle();
                return;
            }
        case DO_ATTACH_TOKEN:
            {
                inputMethod.attachToken((IBinder) msg.obj);
                return;
            }
        case DO_SET_INPUT_CONTEXT:
            {
                inputMethod.bindInput((InputBinding) msg.obj);
                return;
            }
        case DO_UNSET_INPUT_CONTEXT:
            inputMethod.unbindInput();
            return;
        case DO_START_INPUT:
            {
                SomeArgs args = (SomeArgs) msg.obj;
                int missingMethods = msg.arg1;
                IInputContext inputContext = (IInputContext) args.arg1;
                InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
                EditorInfo info = (EditorInfo) args.arg2;
                info.makeCompatible(mTargetSdkVersion);
                inputMethod.startInput(ic, info);
                args.recycle();
                return;
            }
        case DO_RESTART_INPUT:
            {
                SomeArgs args = (SomeArgs) msg.obj;
                int missingMethods = msg.arg1;
                IInputContext inputContext = (IInputContext) args.arg1;
                InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null;
                EditorInfo info = (EditorInfo) args.arg2;
                info.makeCompatible(mTargetSdkVersion);
                inputMethod.restartInput(ic, info);
                args.recycle();
                return;
            }
        case DO_CREATE_SESSION:
            {
                SomeArgs args = (SomeArgs) msg.obj;
                inputMethod.createSession(new InputMethodSessionCallbackWrapper(mContext, (InputChannel) args.arg1, (IInputSessionCallback) args.arg2));
                args.recycle();
                return;
            }
        case DO_SET_SESSION_ENABLED:
            inputMethod.setSessionEnabled((InputMethodSession) msg.obj, msg.arg1 != 0);
            return;
        case DO_REVOKE_SESSION:
            inputMethod.revokeSession((InputMethodSession) msg.obj);
            return;
        case DO_SHOW_SOFT_INPUT:
            inputMethod.showSoftInput(msg.arg1, (ResultReceiver) msg.obj);
            return;
        case DO_HIDE_SOFT_INPUT:
            inputMethod.hideSoftInput(msg.arg1, (ResultReceiver) msg.obj);
            return;
        case DO_CHANGE_INPUTMETHOD_SUBTYPE:
            inputMethod.changeInputMethodSubtype((InputMethodSubtype) msg.obj);
            return;
    }
    Log.w(TAG, "Unhandled message code: " + msg.what);
}
Also used : IInputContext(com.android.internal.view.IInputContext) InputConnectionWrapper(com.android.internal.view.InputConnectionWrapper) FileDescriptor(java.io.FileDescriptor) InputConnection(android.view.inputmethod.InputConnection) IBinder(android.os.IBinder) EditorInfo(android.view.inputmethod.EditorInfo) SomeArgs(com.android.internal.os.SomeArgs) IInputMethod(com.android.internal.view.IInputMethod) InputMethod(android.view.inputmethod.InputMethod) InputBinding(android.view.inputmethod.InputBinding) PrintWriter(java.io.PrintWriter)

Aggregations

InputBinding (android.view.inputmethod.InputBinding)14 InputConnection (android.view.inputmethod.InputConnection)14 InputConnectionWrapper (com.android.internal.view.InputConnectionWrapper)14 IBinder (android.os.IBinder)7 EditorInfo (android.view.inputmethod.EditorInfo)7 InputMethod (android.view.inputmethod.InputMethod)7 IInputContext (com.android.internal.view.IInputContext)7 IInputMethod (com.android.internal.view.IInputMethod)7 FileDescriptor (java.io.FileDescriptor)7 PrintWriter (java.io.PrintWriter)7 SomeArgs (com.android.internal.os.SomeArgs)6 HandlerCaller (com.android.internal.os.HandlerCaller)1