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
      eadb1392f8

Bug: 192412909
Bug: 194110780
Test: presubmit
Change-Id: I90eff3bfc5ed0f43472b0cd49aa532474a60c266
This commit is contained in:
Yohei Yukawa
2021-09-13 15:43:48 -07:00
parent 4d16327f62
commit 89c197018e

View File

@@ -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