Merge "Unify windowGainedFocus() and startInput()." into nyc-dev

am: 5a19477ec4

* commit '5a19477ec4de4c468a2c7da25929d0acc0aabdfa':
  Unify windowGainedFocus() and startInput().
This commit is contained in:
Yohei Yukawa
2016-02-22 21:59:46 +00:00
committed by android-build-merger
3 changed files with 22 additions and 20 deletions

View File

@@ -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);

View File

@@ -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,

View File

@@ -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) {