Merge "Explicitly handle null rather than relying on NPE." into nyc-dev
This commit is contained in:
@@ -1318,8 +1318,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
/* @InputMethodClient.StartInputReason */ final int startInputReason,
|
||||
IInputMethodClient client, IInputContext inputContext,
|
||||
/* @InputConnectionInspector.missingMethods */ final int missingMethods,
|
||||
EditorInfo attribute,
|
||||
int controlFlags) {
|
||||
@Nullable EditorInfo attribute, int controlFlags) {
|
||||
// If no method is currently selected, do nothing.
|
||||
if (mCurMethodId == null) {
|
||||
return mNoBinding;
|
||||
@@ -1331,6 +1330,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
+ client.asBinder());
|
||||
}
|
||||
|
||||
if (attribute == null) {
|
||||
Slog.w(TAG, "Ignoring startInput with null EditorInfo."
|
||||
+ " uid=" + cs.uid + " pid=" + cs.pid);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!mIWindowManager.inputMethodClientHasFocus(cs.client)) {
|
||||
// Check with the window manager to make sure this client actually
|
||||
@@ -1476,7 +1481,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
/* @InputMethodClient.StartInputReason */ final int startInputReason,
|
||||
IInputMethodClient client, IInputContext inputContext,
|
||||
/* @InputConnectionInspector.missingMethods */ final int missingMethods,
|
||||
EditorInfo attribute, int controlFlags) {
|
||||
@Nullable EditorInfo attribute, int controlFlags) {
|
||||
if (!calledFromValidUser()) {
|
||||
return null;
|
||||
}
|
||||
@@ -2208,7 +2213,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
public InputBindResult startInputOrWindowGainedFocus(
|
||||
/* @InputMethodClient.StartInputReason */ final int startInputReason,
|
||||
IInputMethodClient client, IBinder windowToken, int controlFlags, int softInputMode,
|
||||
int windowFlags, EditorInfo attribute, IInputContext inputContext,
|
||||
int windowFlags, @Nullable EditorInfo attribute, IInputContext inputContext,
|
||||
/* @InputConnectionInspector.missingMethods */ final int missingMethods) {
|
||||
if (windowToken != null) {
|
||||
return windowGainedFocus(startInputReason, client, windowToken, controlFlags,
|
||||
|
||||
Reference in New Issue
Block a user