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
This commit is contained in:
Yohei Yukawa
2021-07-07 09:03:34 -07:00
parent 6bd10151af
commit 8426bd7d02
2 changed files with 10 additions and 10 deletions

View File

@@ -47,7 +47,6 @@ import com.android.internal.view.IInputMethod;
import com.android.internal.view.IInputMethodSession;
import com.android.internal.view.IInputSessionCallback;
import com.android.internal.view.InlineSuggestionsRequestInfo;
import com.android.internal.view.InputConnectionWrapper;
import java.io.FileDescriptor;
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()}
* 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.
*
* <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;
SomeArgs moreArgs = (SomeArgs) args.arg5;
final InputConnection ic = inputContext != null
? new InputConnectionWrapper(
? new RemoteInputConnection(
mTarget, inputContext, moreArgs.argi3, cancellationGroup)
: null;
info.makeCompatible(mTargetSdkVersion);
@@ -302,7 +301,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
mCancellationGroup = new CancellationGroup();
// This IInputContext is guaranteed to implement all the methods.
final int missingMethodFlags = 0;
InputConnection ic = new InputConnectionWrapper(mTarget,
InputConnection ic = new RemoteInputConnection(mTarget,
IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags,
mCancellationGroup);
InputBinding nu = new InputBinding(ic, binding);

View File

@@ -14,13 +14,12 @@
* limitations under the License.
*/
package com.android.internal.view;
package android.inputmethodservice;
import android.annotation.AnyThread;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.inputmethodservice.AbstractInputMethodService;
import android.os.Bundle;
import android.os.Handler;
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.Completable;
import com.android.internal.inputmethod.IInputContextInvoker;
import com.android.internal.view.IInputContext;
import com.android.internal.view.IInputMethod;
import java.lang.ref.WeakReference;
public class InputConnectionWrapper implements InputConnection {
private static final String TAG = "InputConnectionWrapper";
final class RemoteInputConnection implements InputConnection {
private static final String TAG = "RemoteInputConnection";
private static final int MAX_WAIT_TIME_MILLIS = 2000;
@@ -66,7 +67,7 @@ public class InputConnectionWrapper implements InputConnection {
@NonNull
private final CancellationGroup mCancellationGroup;
public InputConnectionWrapper(
RemoteInputConnection(
@NonNull WeakReference<AbstractInputMethodService> inputMethodService,
IInputContext inputContext, @MissingMethodFlags int missingMethods,
@NonNull CancellationGroup cancellationGroup) {
@@ -424,7 +425,7 @@ public class InputConnectionWrapper implements InputConnection {
@AnyThread
@Override
public String toString() {
return "InputConnectionWrapper{idHash=#"
return "RemoteInputConnection{idHash=#"
+ Integer.toHexString(System.identityHashCode(this))
+ " mMissingMethods="
+ InputConnectionInspector.getMissingMethodFlagsAsString(mMissingMethods) + "}";