Merge "Add new InputBindResult.ResultCode for no editor"
diff --git a/core/java/com/android/internal/view/InputBindResult.java b/core/java/com/android/internal/view/InputBindResult.java
index 74dbaba..f05bd32 100644
--- a/core/java/com/android/internal/view/InputBindResult.java
+++ b/core/java/com/android/internal/view/InputBindResult.java
@@ -139,6 +139,10 @@
* @see com.android.server.wm.WindowManagerService#inputMethodClientHasFocus(IInputMethodClient)
*/
int ERROR_NOT_IME_TARGET_WINDOW = 11;
+ /**
+ * Indicates that focused view in the current window is not an editor.
+ */
+ int ERROR_NO_EDITOR = 12;
}
@ResultCode
@@ -258,6 +262,8 @@
return "ERROR_NULL";
case ResultCode.ERROR_NO_IME:
return "ERROR_NO_IME";
+ case ResultCode.ERROR_NO_EDITOR:
+ return "ERROR_NO_EDITOR";
case ResultCode.ERROR_INVALID_PACKAGE_NAME:
return "ERROR_INVALID_PACKAGE_NAME";
case ResultCode.ERROR_SYSTEM_NOT_READY:
@@ -288,6 +294,10 @@
*/
public static final InputBindResult NO_IME = error(ResultCode.ERROR_NO_IME);
/**
+ * Predefined error object for {@link ResultCode#NO_EDITOR}.
+ */
+ public static final InputBindResult NO_EDITOR = error(ResultCode.ERROR_NO_EDITOR);
+ /**
* Predefined error object for {@link ResultCode#ERROR_INVALID_PACKAGE_NAME}.
*/
public static final InputBindResult INVALID_PACKAGE_NAME =
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 2f42585..93f7f1d 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -2970,12 +2970,19 @@
break;
}
- if (!didStart && attribute != null) {
- if (!DebugFlags.FLAG_OPTIMIZE_START_INPUT.value()
- || (controlFlags
- & InputMethodManager.CONTROL_WINDOW_IS_TEXT_EDITOR) != 0) {
- res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute,
- controlFlags, startInputReason);
+ if (!didStart) {
+ if (attribute != null) {
+ if (!DebugFlags.FLAG_OPTIMIZE_START_INPUT.value()
+ || (controlFlags
+ & InputMethodManager.CONTROL_WINDOW_IS_TEXT_EDITOR) != 0) {
+ res = startInputUncheckedLocked(cs, inputContext, missingMethods,
+ attribute,
+ controlFlags, startInputReason);
+ } else {
+ res = InputBindResult.NO_EDITOR;
+ }
+ } else {
+ res = InputBindResult.NULL_EDITOR_INFO;
}
}
}