summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/AbstractInputMethodService.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2017-10-18 20:19:53 -0700
committerYohei Yukawa <yukawa@google.com>2017-10-18 20:19:53 -0700
commit930328ca97bd1ea6e1d56743712fb937492c34b7 (patch)
tree8e8771582e8c71aefdec1e12f66e33349b9f345f /core/java/android/inputmethodservice/AbstractInputMethodService.java
parent16f040770814f000f407026dea337f9ec15f5fc0 (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/AbstractInputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/AbstractInputMethodService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/AbstractInputMethodService.java b/core/java/android/inputmethodservice/AbstractInputMethodService.java
index 29177b6b47cf..185215a5ce75 100644
--- a/core/java/android/inputmethodservice/AbstractInputMethodService.java
+++ b/core/java/android/inputmethodservice/AbstractInputMethodService.java
@@ -16,6 +16,7 @@
package android.inputmethodservice;
+import android.annotation.MainThread;
import android.annotation.NonNull;
import android.app.Service;
import android.content.Intent;
@@ -62,6 +63,7 @@ public abstract class AbstractInputMethodService extends Service
* back to {@link AbstractInputMethodService#onCreateInputMethodSessionInterface()
* AbstractInputMethodService.onCreateInputMethodSessionInterface()}.
*/
+ @MainThread
public void createSession(SessionCallback callback) {
callback.sessionCreated(onCreateInputMethodSessionInterface());
}
@@ -71,6 +73,7 @@ public abstract class AbstractInputMethodService extends Service
* {@link AbstractInputMethodSessionImpl#revokeSelf()
* AbstractInputMethodSessionImpl.setEnabled()} method.
*/
+ @MainThread
public void setSessionEnabled(InputMethodSession session, boolean enabled) {
((AbstractInputMethodSessionImpl)session).setEnabled(enabled);
}
@@ -80,6 +83,7 @@ public abstract class AbstractInputMethodService extends Service
* {@link AbstractInputMethodSessionImpl#revokeSelf()
* AbstractInputMethodSessionImpl.revokeSelf()} method.
*/
+ @MainThread
public void revokeSession(InputMethodSession session) {
((AbstractInputMethodSessionImpl)session).revokeSelf();
}