diff options
| author | Yohei Yukawa <yukawa@google.com> | 2021-07-09 09:46:58 -0700 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2021-07-13 15:54:10 +0000 |
| commit | a975bfc447b04fe90a5ec9c3d4757810f7d07af1 (patch) | |
| tree | 43527584fe64c505f2fc958e7bbd44876008fa02 /core/java/android/inputmethodservice/AbstractInputMethodService.java | |
| parent | 26b594af104352c397200de2f0f40b8e2d1a1f04 (diff) | |
Introduce InputMethodServiceInternal for better abstraction
This is a mechanical refactoring CL that has no behavior change.
This CL removes the direct dependency on AbstractInputMethodService
from whenever possible. As a result, the following classes no longer
directly depend on AbstractInputMethodService.
* android.inputmethodservice.IInputMethodWrapper
* android.inputmethodservice.RemoteInputConnection
* com.android.internal.inputmethod.ImeTracing
* com.android.internal.inputmethod.ImeTracingClientImpl
* com.android.internal.inputmethod.ImeTracingServerImpl
This is still a purely mechanical refactoring. There should be no
observable behavior change.
Bug: 192412909
Test: atest CtsInputMethodTestCases
Test: Manually verified that IME tracing still works
Change-Id: I2aeeeacd27195ce10059d6590e098a4a969e774d
Diffstat (limited to 'core/java/android/inputmethodservice/AbstractInputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/AbstractInputMethodService.java | 73 |
1 files changed, 29 insertions, 44 deletions
diff --git a/core/java/android/inputmethodservice/AbstractInputMethodService.java b/core/java/android/inputmethodservice/AbstractInputMethodService.java index b359465c4738..9db41c41c31c 100644 --- a/core/java/android/inputmethodservice/AbstractInputMethodService.java +++ b/core/java/android/inputmethodservice/AbstractInputMethodService.java @@ -25,13 +25,10 @@ import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; -import android.util.proto.ProtoOutputStream; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.WindowManager; import android.view.WindowManagerGlobal; -import android.view.inputmethod.InputConnection; -import android.view.inputmethod.InputContentInfo; import android.view.inputmethod.InputMethod; import android.view.inputmethod.InputMethodSession; import android.window.WindowProviderService; @@ -216,16 +213,6 @@ public abstract class AbstractInputMethodService extends WindowProviderService public abstract AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface(); /** - * Dumps the internal state of IME to a protocol buffer output stream. - * - * @param proto ProtoOutputStream to dump data to. - * @param icProto {@link InputConnection} call data in proto format. - * @hide - */ - @SuppressWarnings("HiddenAbstractMethod") - public abstract void dumpProtoInternal(ProtoOutputStream proto, @Nullable byte[] icProto); - - /** * Implement this to handle {@link android.os.Binder#dump Binder.dump()} * calls on your input method. */ @@ -238,9 +225,36 @@ public abstract class AbstractInputMethodService extends WindowProviderService if (mInputMethod == null) { mInputMethod = onCreateInputMethodInterface(); } - return new IInputMethodWrapper(this, mInputMethod); + return new IInputMethodWrapper(createInputMethodServiceInternal(), mInputMethod); } - + + /** + * Used to inject custom {@link InputMethodServiceInternal}. + * + * @return the {@link InputMethodServiceInternal} to be used. + */ + @NonNull + InputMethodServiceInternal createInputMethodServiceInternal() { + return new InputMethodServiceInternal() { + /** + * {@inheritDoc} + */ + @NonNull + @Override + public Context getContext() { + return AbstractInputMethodService.this; + } + + /** + * {@inheritDoc} + */ + @Override + public void dump(FileDescriptor fd, PrintWriter fout, String[] args) { + AbstractInputMethodService.this.dump(fd, fout, args); + } + }; + } + /** * Implement this to handle trackball events on your input method. * @@ -263,35 +277,6 @@ public abstract class AbstractInputMethodService extends WindowProviderService return false; } - /** - * Allow the receiver of {@link InputContentInfo} to obtain a temporary read-only access - * permission to the content. - * - * <p>Default implementation does nothing.</p> - * - * @param inputContentInfo Content to be temporarily exposed from the input method to the - * application. - * This cannot be {@code null}. - * @param inputConnection {@link InputConnection} with which - * {@link InputConnection#commitContent(InputContentInfo, int, android.os.Bundle)} will be - * called. - * @return {@code false} if we cannot allow a temporary access permission. - * @hide - */ - public void exposeContent(@NonNull InputContentInfo inputContentInfo, - @NonNull InputConnection inputConnection) { - return; - } - - /** - * Called when the user took some actions that should be taken into consideration to update the - * MRU list for input method rotation. - * - * @hide - */ - public void notifyUserActionIfNecessary() { - } - // TODO(b/149463653): remove it in T. We missed the API deadline in S. /** @hide */ @Override |
