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

Commit 8426bd7d authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Rename InputConnectionWrapper to RemoteInputConnection

This is a purely mechanical refactoring with no behavior change.

An existing non-API class

  com.android.internal.view.InputConnectionWrapper

has been used only from another non-API class

  android.inputmethodservice.IInputMethodWrapper.

By moving it to android.inputmethodservice package we can make it a
package-private class, which is what this CL is intended
to achieve.

Furthermore, there is another public API class with the same name:

  android.view.inputmethod.InputConnectionWrapper

, which has been confusing with this internal one.  To avoid such a
confusion, this CL also renames this internal one to
RemoteInputConnection.

Other than those mechanical changes, there should be no observable
behavior changes.

Bug: 192412909
Test: atest CtsInputMethodTestCases
Change-Id: Ic0babecd34a6bc80b917050370abc2db5c03d84e
parent 6bd10151
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -47,7 +47,6 @@ import com.android.internal.view.IInputMethod;
import com.android.internal.view.IInputMethodSession;
import com.android.internal.view.IInputMethodSession;
import com.android.internal.view.IInputSessionCallback;
import com.android.internal.view.IInputSessionCallback;
import com.android.internal.view.InlineSuggestionsRequestInfo;
import com.android.internal.view.InlineSuggestionsRequestInfo;
import com.android.internal.view.InputConnectionWrapper;


import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
@@ -86,7 +85,7 @@ class IInputMethodWrapper extends IInputMethod.Stub


    /**
    /**
     * This is not {@null} only between {@link #bindInput(InputBinding)} and {@link #unbindInput()}
     * This is not {@null} only between {@link #bindInput(InputBinding)} and {@link #unbindInput()}
     * so that {@link InputConnectionWrapper} can query if {@link #unbindInput()} has already been
     * so that {@link RemoteInputConnection} can query if {@link #unbindInput()} has already been
     * called or not, mainly to avoid unnecessary blocking operations.
     * called or not, mainly to avoid unnecessary blocking operations.
     *
     *
     * <p>This field must be set and cleared only from the binder thread(s), where the system
     * <p>This field must be set and cleared only from the binder thread(s), where the system
@@ -192,7 +191,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
                final CancellationGroup cancellationGroup = (CancellationGroup) args.arg4;
                final CancellationGroup cancellationGroup = (CancellationGroup) args.arg4;
                SomeArgs moreArgs = (SomeArgs) args.arg5;
                SomeArgs moreArgs = (SomeArgs) args.arg5;
                final InputConnection ic = inputContext != null
                final InputConnection ic = inputContext != null
                        ? new InputConnectionWrapper(
                        ? new RemoteInputConnection(
                                mTarget, inputContext, moreArgs.argi3, cancellationGroup)
                                mTarget, inputContext, moreArgs.argi3, cancellationGroup)
                        : null;
                        : null;
                info.makeCompatible(mTargetSdkVersion);
                info.makeCompatible(mTargetSdkVersion);
@@ -302,7 +301,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
        mCancellationGroup = new CancellationGroup();
        mCancellationGroup = new CancellationGroup();
        // This IInputContext is guaranteed to implement all the methods.
        // This IInputContext is guaranteed to implement all the methods.
        final int missingMethodFlags = 0;
        final int missingMethodFlags = 0;
        InputConnection ic = new InputConnectionWrapper(mTarget,
        InputConnection ic = new RemoteInputConnection(mTarget,
                IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags,
                IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags,
                mCancellationGroup);
                mCancellationGroup);
        InputBinding nu = new InputBinding(ic, binding);
        InputBinding nu = new InputBinding(ic, binding);
+7 −6
Original line number Original line Diff line number Diff line
@@ -14,13 +14,12 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.internal.view;
package android.inputmethodservice;


import android.annotation.AnyThread;
import android.annotation.AnyThread;
import android.annotation.IntRange;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.inputmethodservice.AbstractInputMethodService;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.util.imetracing.ImeTracing;
import android.util.imetracing.ImeTracing;
@@ -40,11 +39,13 @@ import android.view.inputmethod.SurroundingText;
import com.android.internal.inputmethod.CancellationGroup;
import com.android.internal.inputmethod.CancellationGroup;
import com.android.internal.inputmethod.Completable;
import com.android.internal.inputmethod.Completable;
import com.android.internal.inputmethod.IInputContextInvoker;
import com.android.internal.inputmethod.IInputContextInvoker;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethod;


import java.lang.ref.WeakReference;
import java.lang.ref.WeakReference;


public class InputConnectionWrapper implements InputConnection {
final class RemoteInputConnection implements InputConnection {
    private static final String TAG = "InputConnectionWrapper";
    private static final String TAG = "RemoteInputConnection";


    private static final int MAX_WAIT_TIME_MILLIS = 2000;
    private static final int MAX_WAIT_TIME_MILLIS = 2000;


@@ -66,7 +67,7 @@ public class InputConnectionWrapper implements InputConnection {
    @NonNull
    @NonNull
    private final CancellationGroup mCancellationGroup;
    private final CancellationGroup mCancellationGroup;


    public InputConnectionWrapper(
    RemoteInputConnection(
            @NonNull WeakReference<AbstractInputMethodService> inputMethodService,
            @NonNull WeakReference<AbstractInputMethodService> inputMethodService,
            IInputContext inputContext, @MissingMethodFlags int missingMethods,
            IInputContext inputContext, @MissingMethodFlags int missingMethods,
            @NonNull CancellationGroup cancellationGroup) {
            @NonNull CancellationGroup cancellationGroup) {
@@ -424,7 +425,7 @@ public class InputConnectionWrapper implements InputConnection {
    @AnyThread
    @AnyThread
    @Override
    @Override
    public String toString() {
    public String toString() {
        return "InputConnectionWrapper{idHash=#"
        return "RemoteInputConnection{idHash=#"
                + Integer.toHexString(System.identityHashCode(this))
                + Integer.toHexString(System.identityHashCode(this))
                + " mMissingMethods="
                + " mMissingMethods="
                + InputConnectionInspector.getMissingMethodFlagsAsString(mMissingMethods) + "}";
                + InputConnectionInspector.getMissingMethodFlagsAsString(mMissingMethods) + "}";