diff options
| author | Yohei Yukawa <yukawa@google.com> | 2017-10-18 20:19:53 -0700 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2017-10-18 20:19:53 -0700 |
| commit | 930328ca97bd1ea6e1d56743712fb937492c34b7 (patch) | |
| tree | 8e8771582e8c71aefdec1e12f66e33349b9f345f /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | 16f040770814f000f407026dea337f9ec15f5fc0 (diff) | |
Annotate threads for some IME handling methods
This is a preparation to work on Bug 36897707.
For instance, the reason why most of IME-related callbacks in
InputMethodService get called on the main thread is because
IInputMethodWrapper keeps forwarding incoming IPCs into the
main looper of the IME process as follows:
InputMethodManagerService (IMMS)
------
-> one-way binder IPCs over IInputMethod
------
-> IInputMethodWrapper (on the binder thread(s))
-> Handler (to dispatch tasks to main thread)
-> InputMethodImpl.* (on the main thread)
-> InputMethodService.* (on the main thread)
By adding explicit annotations such as @BinderThread and @MainThread
in relevant methods, this CL makes that kind of investigation much
easier than before.
Bug: 36897707
Test: compile
Change-Id: I8f9afe9a1986a9fa41fb66fdc64e8f0f67e45c2e
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 96535d950c06..223ed73bb15a 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -384,6 +384,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * {@inheritDoc} */ + @MainThread @Override public void attachToken(IBinder token) { if (mToken == null) { @@ -397,6 +398,7 @@ public class InputMethodService extends AbstractInputMethodService { * * <p>Calls {@link InputMethodService#onBindInput()} when done.</p> */ + @MainThread @Override public void bindInput(InputBinding binding) { mInputBinding = binding; @@ -415,6 +417,7 @@ public class InputMethodService extends AbstractInputMethodService { * * <p>Calls {@link InputMethodService#onUnbindInput()} when done.</p> */ + @MainThread @Override public void unbindInput() { if (DEBUG) Log.v(TAG, "unbindInput(): binding=" + mInputBinding @@ -427,6 +430,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * {@inheritDoc} */ + @MainThread @Override public void startInput(InputConnection ic, EditorInfo attribute) { if (DEBUG) Log.v(TAG, "startInput(): editor=" + attribute); @@ -436,6 +440,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * {@inheritDoc} */ + @MainThread @Override public void restartInput(InputConnection ic, EditorInfo attribute) { if (DEBUG) Log.v(TAG, "restartInput(): editor=" + attribute); @@ -446,6 +451,7 @@ public class InputMethodService extends AbstractInputMethodService { * {@inheritDoc} * @hide */ + @MainThread @Override public void dispatchStartInputWithToken(@Nullable InputConnection inputConnection, @NonNull EditorInfo editorInfo, boolean restarting, @@ -462,6 +468,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * {@inheritDoc} */ + @MainThread @Override public void hideSoftInput(int flags, ResultReceiver resultReceiver) { if (DEBUG) Log.v(TAG, "hideSoftInput()"); @@ -481,6 +488,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * {@inheritDoc} */ + @MainThread @Override public void showSoftInput(int flags, ResultReceiver resultReceiver) { if (DEBUG) Log.v(TAG, "showSoftInput()"); @@ -513,6 +521,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * {@inheritDoc} */ + @MainThread @Override public void changeInputMethodSubtype(InputMethodSubtype subtype) { onCurrentInputMethodSubtypeChanged(subtype); |
