summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/IInputMethodWrapper.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2021-09-15 10:03:20 -0700
committerYohei Yukawa <yukawa@google.com>2021-09-15 10:03:20 -0700
commite8424ef6004ac39c5ba6af458b863d2e110ce8f9 (patch)
tree5ada5b8c97244a60b4575d84af961bf82ea9afbb /core/java/android/inputmethodservice/IInputMethodWrapper.java
parent37118263f951f9753bfdbf4dc049f4727bcd6553 (diff)
Deprecate MissingMethodFlags to preserve invocation order
This CL effectively replaces my previous CL [1], which made unimplemented methods in InputConnection not fatal errors, with a simplified implementation that still gracefully take care of unimplemented methods without causing app crashes. Instead of propagating missing method information from the IME client to the IME process, this CL will simply catch AbstractMethodError in the IME client process. Doing so enables us to 1. preserve the strict invocation order of InputConnection APIs, and 2. achieve the same goal with fewer lines of code. The additional cost of throwing (and catching) AbstractMethodError every time the IME calls an unimplemented InputConnection API can be justified as it is really an exceptional scenario, and avoiding it would require extra maintenance cost as seen in InputConnectionInspector. The above overhead (and complexity) due to AbstractMethodError can be avoided by adding default implementations to those InputConnection APIs, but doing so requires API signature update hence API council approval to go ahead, which is to be discussed in Bug 199934664. [1]: I3c58fadd924fad72cb984f0c23d3099fd0295c64 19a80a1e807acd00bec999eaac7812da6ffce954 Bug: 27407234 Bug: 27642734 Bug: 27650039 Bug: 194110780 Test: atest CtsInputMethodTestCases Change-Id: I9e801e92496a6e16cee37664870c97ed096f1413
Diffstat (limited to 'core/java/android/inputmethodservice/IInputMethodWrapper.java')
-rw-r--r--core/java/android/inputmethodservice/IInputMethodWrapper.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java
index 8db6d9e1cd18..e30594fb9da7 100644
--- a/core/java/android/inputmethodservice/IInputMethodWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java
@@ -32,7 +32,6 @@ import android.view.InputChannel;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputConnection;
-import android.view.inputmethod.InputConnectionInspector;
import android.view.inputmethod.InputMethod;
import android.view.inputmethod.InputMethodSession;
import android.view.inputmethod.InputMethodSubtype;
@@ -190,10 +189,8 @@ class IInputMethodWrapper extends IInputMethod.Stub
final EditorInfo info = (EditorInfo) args.arg3;
final CancellationGroup cancellationGroup = (CancellationGroup) args.arg4;
final boolean restarting = args.argi5 == 1;
- final int missingMethod = args.argi6;
final InputConnection ic = inputContext != null
- ? new RemoteInputConnection(
- mTarget, inputContext, missingMethod, cancellationGroup)
+ ? new RemoteInputConnection(mTarget, inputContext, cancellationGroup)
: null;
info.makeCompatible(mTargetSdkVersion);
inputMethod.dispatchStartInputWithToken(ic, info, restarting, startInputToken);
@@ -295,11 +292,8 @@ class IInputMethodWrapper extends IInputMethod.Stub
Log.e(TAG, "bindInput must be paired with unbindInput.");
}
mCancellationGroup = new CancellationGroup();
- // This IInputContext is guaranteed to implement all the methods.
- final int missingMethodFlags = 0;
InputConnection ic = new RemoteInputConnection(mTarget,
- IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags,
- mCancellationGroup);
+ IInputContext.Stub.asInterface(binding.getConnectionToken()), mCancellationGroup);
InputBinding nu = new InputBinding(ic, binding);
mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
}
@@ -320,14 +314,13 @@ class IInputMethodWrapper extends IInputMethod.Stub
@BinderThread
@Override
public void startInput(IBinder startInputToken, IInputContext inputContext,
- @InputConnectionInspector.MissingMethodFlags final int missingMethods,
EditorInfo attribute, boolean restarting) {
if (mCancellationGroup == null) {
Log.e(TAG, "startInput must be called after bindInput.");
mCancellationGroup = new CancellationGroup();
}
mCaller.executeOrSendMessage(mCaller.obtainMessageOOOOII(DO_START_INPUT, startInputToken,
- inputContext, attribute, mCancellationGroup, restarting ? 1 : 0, missingMethods));
+ inputContext, attribute, mCancellationGroup, restarting ? 1 : 0, 0 /* unused */));
}
@BinderThread