diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-09-15 22:35:11 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-09-15 22:35:11 +0000 |
| commit | 6676af25d03d2fd023f453c8d70752ea8b70b13c (patch) | |
| tree | a1755e4cd7da40d886bd1bd54aba17cd915ce31e /core/java/android/inputmethodservice | |
| parent | 0ad1e6c852ec297bfdadae8bd77fc7bc4d11fd7d (diff) | |
| parent | e8424ef6004ac39c5ba6af458b863d2e110ce8f9 (diff) | |
Merge "Deprecate MissingMethodFlags to preserve invocation order"
Diffstat (limited to 'core/java/android/inputmethodservice')
| -rw-r--r-- | core/java/android/inputmethodservice/IInputMethodWrapper.java | 13 | ||||
| -rw-r--r-- | core/java/android/inputmethodservice/RemoteInputConnection.java | 48 |
2 files changed, 5 insertions, 56 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 diff --git a/core/java/android/inputmethodservice/RemoteInputConnection.java b/core/java/android/inputmethodservice/RemoteInputConnection.java index 589dd7255a62..657f8428179f 100644 --- a/core/java/android/inputmethodservice/RemoteInputConnection.java +++ b/core/java/android/inputmethodservice/RemoteInputConnection.java @@ -29,8 +29,6 @@ import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; -import android.view.inputmethod.InputConnectionInspector; -import android.view.inputmethod.InputConnectionInspector.MissingMethodFlags; import android.view.inputmethod.InputContentInfo; import android.view.inputmethod.SurroundingText; @@ -87,9 +85,6 @@ final class RemoteInputConnection implements InputConnection { @NonNull private final InputMethodServiceInternalHolder mImsInternal; - @MissingMethodFlags - private final int mMissingMethods; - /** * Signaled when the system decided to take away IME focus from the target app. * @@ -101,11 +96,9 @@ final class RemoteInputConnection implements InputConnection { RemoteInputConnection( @NonNull WeakReference<InputMethodServiceInternal> inputMethodService, - IInputContext inputContext, @MissingMethodFlags int missingMethods, - @NonNull CancellationGroup cancellationGroup) { + IInputContext inputContext, @NonNull CancellationGroup cancellationGroup) { mImsInternal = new InputMethodServiceInternalHolder(inputMethodService); mInvoker = IInputContextInvoker.create(inputContext); - mMissingMethods = missingMethods; mCancellationGroup = cancellationGroup; } @@ -163,10 +156,6 @@ final class RemoteInputConnection implements InputConnection { return null; } - if (isMethodMissing(MissingMethodFlags.GET_SELECTED_TEXT)) { - // This method is not implemented. - return null; - } final CompletableFuture<CharSequence> value = mInvoker.getSelectedText(flags); final CharSequence result = CompletableFutureUtil.getResultOrNull( value, TAG, "getSelectedText()", mCancellationGroup, MAX_WAIT_TIME_MILLIS); @@ -200,10 +189,6 @@ final class RemoteInputConnection implements InputConnection { return null; } - if (isMethodMissing(MissingMethodFlags.GET_SURROUNDING_TEXT)) { - // This method is not implemented. - return null; - } final CompletableFuture<SurroundingText> value = mInvoker.getSurroundingText(beforeLength, afterLength, flags); final SurroundingText result = CompletableFutureUtil.getResultOrNull( @@ -284,10 +269,6 @@ final class RemoteInputConnection implements InputConnection { @AnyThread public boolean commitCorrection(CorrectionInfo correctionInfo) { - if (isMethodMissing(MissingMethodFlags.COMMIT_CORRECTION)) { - // This method is not implemented. - return false; - } return mInvoker.commitCorrection(correctionInfo); } @@ -308,10 +289,6 @@ final class RemoteInputConnection implements InputConnection { @AnyThread public boolean setComposingRegion(int start, int end) { - if (isMethodMissing(MissingMethodFlags.SET_COMPOSING_REGION)) { - // This method is not implemented. - return false; - } return mInvoker.setComposingRegion(start, end); } @@ -360,10 +337,6 @@ final class RemoteInputConnection implements InputConnection { @AnyThread public boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) { - if (isMethodMissing(MissingMethodFlags.DELETE_SURROUNDING_TEXT_IN_CODE_POINTS)) { - // This method is not implemented. - return false; - } return mInvoker.deleteSurroundingTextInCodePoints(beforeLength, afterLength); } @@ -389,11 +362,6 @@ final class RemoteInputConnection implements InputConnection { return false; } - if (isMethodMissing(MissingMethodFlags.REQUEST_CURSOR_UPDATES)) { - // This method is not implemented. - return false; - } - final InputMethodServiceInternal ims = mImsInternal.getAndWarnIfNull(); if (ims == null) { return false; @@ -423,11 +391,6 @@ final class RemoteInputConnection implements InputConnection { return false; } - if (isMethodMissing(MissingMethodFlags.COMMIT_CONTENT)) { - // This method is not implemented. - return false; - } - if ((flags & InputConnection.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) { final InputMethodServiceInternal imsInternal = mImsInternal.getAndWarnIfNull(); if (imsInternal == null) { @@ -451,16 +414,9 @@ final class RemoteInputConnection implements InputConnection { } @AnyThread - private boolean isMethodMissing(@MissingMethodFlags final int methodFlag) { - return (mMissingMethods & methodFlag) == methodFlag; - } - - @AnyThread @Override public String toString() { return "RemoteInputConnection{idHash=#" - + Integer.toHexString(System.identityHashCode(this)) - + " mMissingMethods=" - + InputConnectionInspector.getMissingMethodFlagsAsString(mMissingMethods) + "}"; + + Integer.toHexString(System.identityHashCode(this)) + "}"; } } |
