Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a10176c authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Fix minor style issues in InputMethodService

This is a minor follow up CL to our previous CL [1], which migrated
IME to handle back with OnBackInvokedDispatcher.

Having SomeArgs within SomeArgs doesn't make sense unless we really
run out of arguments.

This CL also addresses minor style issues.

Basically this is a mechanical clean-up that has no behavior change.

 [1]: Ie207b63b11a56c9b2173f26b734a27b13ebccc60
      a6666f22

Bug: 228358882
Bug: 234882948
Test: presubmit
Change-Id: Ie14f66be0c9d66d221c5f9fae244df5487d65593
parent 1167085a
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -195,15 +195,14 @@ class IInputMethodWrapper extends IInputMethod.Stub
            case DO_START_INPUT: {
                final SomeArgs args = (SomeArgs) msg.obj;
                final IBinder startInputToken = (IBinder) args.arg1;
                final IRemoteInputConnection remoteIc =
                        (IRemoteInputConnection) ((SomeArgs) args.arg2).arg1;
                final ImeOnBackInvokedDispatcher imeDispatcher =
                        (ImeOnBackInvokedDispatcher) ((SomeArgs) args.arg2).arg2;
                final IRemoteInputConnection remoteIc = (IRemoteInputConnection) args.arg2;
                final EditorInfo info = (EditorInfo) args.arg3;
                final CancellationGroup cancellationGroup = (CancellationGroup) args.arg4;
                final boolean restarting = args.argi5 == 1;
                final ImeOnBackInvokedDispatcher imeDispatcher =
                        (ImeOnBackInvokedDispatcher) args.arg4;
                final CancellationGroup cancellationGroup = (CancellationGroup) args.arg5;
                final boolean restarting = args.argi1 == 1;
                @InputMethodNavButtonFlags
                final int navButtonFlags = args.argi6;
                final int navButtonFlags = args.argi2;
                final InputConnection ic = remoteIc != null
                        ? new RemoteInputConnection(mTarget, remoteIc, cancellationGroup)
                        : null;
@@ -359,11 +358,15 @@ class IInputMethodWrapper extends IInputMethod.Stub
            Log.e(TAG, "startInput must be called after bindInput.");
            mCancellationGroup = new CancellationGroup();
        }
        SomeArgs args = SomeArgs.obtain();
        args.arg1 = inputConnection;
        args.arg2 = imeDispatcher;
        mCaller.executeOrSendMessage(mCaller.obtainMessageOOOOII(DO_START_INPUT, startInputToken,
                args, attribute, mCancellationGroup, restarting ? 1 : 0, navButtonFlags));
        final SomeArgs args = SomeArgs.obtain();
        args.arg1 = startInputToken;
        args.arg2 = inputConnection;
        args.arg3 = attribute;
        args.argi1 = restarting ? 1 : 0;
        args.argi2 = navButtonFlags;
        args.arg4 = imeDispatcher;
        args.arg5 = mCancellationGroup;
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_START_INPUT, args));
    }

    @BinderThread
+1 −1
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ public class InputMethodService extends AbstractInputMethodService {
     **/
    private RingBuffer<MotionEvent> mPendingEvents;
    private ImeOnBackInvokedDispatcher mImeDispatcher;
    private Boolean mBackCallbackRegistered = false;
    private boolean mBackCallbackRegistered = false;
    private final CompatOnBackInvokedCallback mCompatBackCallback = this::compatHandleBack;
    private Runnable mImeSurfaceRemoverRunnable;
    private Runnable mFinishHwRunnable;
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public interface InputMethod {
     *                        long as your implementation of {@link InputMethod} relies on such
     *                        IPCs
     * @param navButtonFlags {@link InputMethodNavButtonFlags} in the initial state of this session.
     * @param imeDispatcher The {@link ImeOnBackInvokedDispatcher }} to be set on the
     * @param imeDispatcher The {@link ImeOnBackInvokedDispatcher} to be set on the
     *                      IME's {@link android.window.WindowOnBackInvokedDispatcher}, so that IME
     *                      {@link android.window.OnBackInvokedCallback}s can be forwarded to
     *                      the client requesting to start input.