diff options
| author | 2016-02-22 21:52:55 +0000 | |
|---|---|---|
| committer | 2016-02-22 21:52:56 +0000 | |
| commit | 5a19477ec4de4c468a2c7da25929d0acc0aabdfa (patch) | |
| tree | 590bf9db124f4d71b67ed261c7f643927437ef95 | |
| parent | 339fc0a1d213fed1201443838a9536651ad2ca3b (diff) | |
| parent | 05c25f8a3a033816ac25aa5cd7db5b1ab495bc3f (diff) | |
Merge "Unify windowGainedFocus() and startInput()." into nyc-dev
3 files changed, 22 insertions, 20 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 2de9897904d6..4c015ba9e2d3 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1245,15 +1245,9 @@ public final class InputMethodManager { if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic=" + ic + " tba=" + tba + " controlFlags=#" + Integer.toHexString(controlFlags)); - InputBindResult res; - if (windowGainingFocus != null) { - res = mService.windowGainedFocus(startInputReason, mClient, windowGainingFocus, - controlFlags, softInputMode, windowFlags, - tba, servedContext); - } else { - res = mService.startInput(startInputReason, mClient, - servedContext, tba, controlFlags); - } + final InputBindResult res = mService.startInputOrWindowGainedFocus( + startInputReason, mClient, windowGainingFocus, controlFlags, softInputMode, + windowFlags, tba, servedContext); if (DEBUG) Log.v(TAG, "Starting input: Bind result=" + res); if (res != null) { if (res.id != null) { @@ -1471,13 +1465,13 @@ public final class InputMethodManager { return; } } - + // For some reason we didn't do a startInput + windowFocusGain, so // we'll just do a window focus gain and call it a day. synchronized (mH) { try { if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput"); - mService.windowGainedFocus( + mService.startInputOrWindowGainedFocus( InputMethodClient.START_INPUT_REASON_WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient, rootView.getWindowToken(), controlFlags, softInputMode, windowFlags, null, null); diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index db3ecc6f2dc8..5576f13ba488 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -46,17 +46,14 @@ interface IInputMethodManager { in IInputContext inputContext, int uid, int pid); void removeClient(in IInputMethodClient client); - InputBindResult startInput(/* @InputMethodClient.StartInputReason */ int startInputReason, - in IInputMethodClient client, IInputContext inputContext, in EditorInfo attribute, - int controlFlags); void finishInput(in IInputMethodClient client); boolean showSoftInput(in IInputMethodClient client, int flags, in ResultReceiver resultReceiver); boolean hideSoftInput(in IInputMethodClient client, int flags, in ResultReceiver resultReceiver); - // Report that a window has gained focus. If 'attribute' is non-null, - // this will also do a startInput. - InputBindResult windowGainedFocus( + // If windowToken is null, this just does startInput(). Otherwise this reports that a window + // has gained focus, and if 'attribute' is non-null then also does startInput. + InputBindResult startInputOrWindowGainedFocus( /* @InputMethodClient.StartInputReason */ int startInputReason, in IInputMethodClient client, in IBinder windowToken, int controlFlags, int softInputMode, int windowFlags, in EditorInfo attribute, diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index d1de7e57ef45..5ba8bd555237 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -1458,8 +1458,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } @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) { |