From 89c197018e830a04c7c10a6608e595ccf1ed1d07 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Mon, 13 Sep 2021 15:43:48 -0700 Subject: [PATCH] Simplify IInputMethod#startInput() handler a bit This is a follow up CL to our previous CL [1], which introduced a nested SomeArgs to pass more integer parameters while handling IInputMethod#startInput() callback. Now that only 2 integers and 4 objects are required to handle IInputMethod#startInput(), single SomeArgs should be good enough to pack everything into a Message object. This CL does nothing other than applying such a mechanical code clean up. There should be no observable behavior difference. [1]: I1a6300fe167eb205ee2b4214a6e270a52ebae062 eadb1392f85f1ac8801018a02c31427801959b1c Bug: 192412909 Bug: 194110780 Test: presubmit Change-Id: I90eff3bfc5ed0f43472b0cd49aa532474a60c266 --- .../IInputMethodWrapper.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java index 90990b45e5525..8db6d9e1cd184 100644 --- a/core/java/android/inputmethodservice/IInputMethodWrapper.java +++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java @@ -189,19 +189,15 @@ class IInputMethodWrapper extends IInputMethod.Stub final IInputContext inputContext = (IInputContext) args.arg2; final EditorInfo info = (EditorInfo) args.arg3; final CancellationGroup cancellationGroup = (CancellationGroup) args.arg4; - SomeArgs moreArgs = (SomeArgs) args.arg5; + final boolean restarting = args.argi5 == 1; + final int missingMethod = args.argi6; final InputConnection ic = inputContext != null ? new RemoteInputConnection( - mTarget, inputContext, moreArgs.argi3, cancellationGroup) + mTarget, inputContext, missingMethod, cancellationGroup) : null; info.makeCompatible(mTargetSdkVersion); - inputMethod.dispatchStartInputWithToken( - ic, - info, - moreArgs.argi1 == 1 /* restarting */, - startInputToken); + inputMethod.dispatchStartInputWithToken(ic, info, restarting, startInputToken); args.recycle(); - moreArgs.recycle(); return; } case DO_CREATE_SESSION: { @@ -330,11 +326,8 @@ class IInputMethodWrapper extends IInputMethod.Stub Log.e(TAG, "startInput must be called after bindInput."); mCancellationGroup = new CancellationGroup(); } - SomeArgs args = SomeArgs.obtain(); - args.argi1 = restarting ? 1 : 0; - args.argi3 = missingMethods; - mCaller.executeOrSendMessage(mCaller.obtainMessageOOOOO(DO_START_INPUT, startInputToken, - inputContext, attribute, mCancellationGroup, args)); + mCaller.executeOrSendMessage(mCaller.obtainMessageOOOOII(DO_START_INPUT, startInputToken, + inputContext, attribute, mCancellationGroup, restarting ? 1 : 0, missingMethods)); } @BinderThread