Unify windowGainedFocus() and startInput().
This is a safe refactoring that changes nothing.
In order to improve the keyboard dismissal lags [1][2], we have used
IMMS#windowGainedFocus() as a combined event to do startInput() in
certain situations.
To make the intent of those CLs clear, this CL renames
IMMS#windowGainedFocus() to IMMS#startInputOrWindowGainedFocus(). Note
that these are @hide internal IPC protocols. Hence this change is never
observable to application developers.
[1] I8494cbd6e19e2ab6db03f2463d9906680dda058b
a82ba54b0bbc3ff41f29db3998806cb45b261d58
[2] Icb58bef75ef4bf9979f3e2ba88cea20db2e2c3fb
7663d80f6b6fd6ca7a736c3802013a09c0abdeb9
Bug: 25373872
Change-Id: I56934f18e30d90fcdf77bcbb0c35a92a5feb1b82
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index d1de7e5..5ba8bd5 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -1458,8 +1458,7 @@
return null;
}
- @Override
- public InputBindResult startInput(
+ private InputBindResult startInput(
/* @InputMethodClient.StartInputReason */ final int startInputReason,
IInputMethodClient client, IInputContext inputContext, EditorInfo attribute,
int controlFlags) {
@@ -2197,7 +2196,19 @@
}
@Override
- public InputBindResult windowGainedFocus(
+ public InputBindResult startInputOrWindowGainedFocus(
+ /* @InputMethodClient.StartInputReason */ final int startInputReason,
+ IInputMethodClient client, IBinder windowToken, int controlFlags, int softInputMode,
+ int windowFlags, EditorInfo attribute, IInputContext inputContext) {
+ if (windowToken != null) {
+ return windowGainedFocus(startInputReason, client, windowToken, controlFlags,
+ softInputMode, windowFlags, attribute, inputContext);
+ } else {
+ return startInput(startInputReason, client, inputContext, attribute, controlFlags);
+ }
+ }
+
+ private InputBindResult windowGainedFocus(
/* @InputMethodClient.StartInputReason */ final int startInputReason,
IInputMethodClient client, IBinder windowToken, int controlFlags, int softInputMode,
int windowFlags, EditorInfo attribute, IInputContext inputContext) {