Loading core/java/com/android/internal/view/InputMethodClient.java +4 −1 Original line number Diff line number Diff line Loading @@ -32,13 +32,14 @@ public final class InputMethodClient { public static final int START_INPUT_REASON_UNBOUND_FROM_IMMS = 6; public static final int START_INPUT_REASON_ACTIVATED_BY_IMMS = 7; public static final int START_INPUT_REASON_DEACTIVATED_BY_IMMS = 8; public static final int START_INPUT_REASON_SESSION_CREATED_BY_IME = 9; @Retention(SOURCE) @IntDef({START_INPUT_REASON_UNSPECIFIED, START_INPUT_REASON_WINDOW_FOCUS_GAIN, START_INPUT_REASON_WINDOW_FOCUS_GAIN_REPORT_ONLY, START_INPUT_REASON_APP_CALLED_RESTART_INPUT_API, START_INPUT_REASON_CHECK_FOCUS, START_INPUT_REASON_BOUND_TO_IMMS, START_INPUT_REASON_ACTIVATED_BY_IMMS, START_INPUT_REASON_DEACTIVATED_BY_IMMS}) START_INPUT_REASON_DEACTIVATED_BY_IMMS, START_INPUT_REASON_SESSION_CREATED_BY_IME}) public @interface StartInputReason {} public static String getStartInputReason(@StartInputReason final int reason) { Loading @@ -61,6 +62,8 @@ public final class InputMethodClient { return "ACTIVATED_BY_IMMS"; case START_INPUT_REASON_DEACTIVATED_BY_IMMS: return "DEACTIVATED_BY_IMMS"; case START_INPUT_REASON_SESSION_CREATED_BY_IME: return "SESSION_CREATED_BY_IME"; default: return "Unknown=" + reason; } Loading services/core/java/com/android/server/InputMethodManagerService.java +13 −10 Original line number Diff line number Diff line Loading @@ -1297,7 +1297,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return flags; } InputBindResult attachNewInputLocked(boolean initial) { InputBindResult attachNewInputLocked( /* @InputMethodClient.StartInputReason */ final int startInputReason, boolean initial) { if (!mBoundToMethod) { executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO( MSG_BIND_INPUT, mCurMethod, mCurClient.binding)); Loading Loading @@ -1361,12 +1362,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); controlFlags, startInputReason); } InputBindResult startInputUncheckedLocked(@NonNull ClientState cs, IInputContext inputContext, /* @InputConnectionInspector.missingMethods */ final int missingMethods, @NonNull EditorInfo attribute, int controlFlags) { @NonNull EditorInfo attribute, int controlFlags, /* @InputMethodClient.StartInputReason */ final int startInputReason) { // If no method is currently selected, do nothing. if (mCurMethodId == null) { return mNoBinding; Loading Loading @@ -1408,7 +1410,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (cs.curSession != null) { // Fast case: if we are already connected to the input method, // then just return it. return attachNewInputLocked( return attachNewInputLocked(startInputReason, (controlFlags&InputMethodManager.CONTROL_START_INITIAL) != 0); } if (mHaveConnection) { Loading Loading @@ -1549,7 +1551,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub clearClientSessionLocked(mCurClient); mCurClient.curSession = new SessionState(mCurClient, method, session, channel); InputBindResult res = attachNewInputLocked(true); InputBindResult res = attachNewInputLocked( InputMethodClient.START_INPUT_REASON_SESSION_CREATED_BY_IME, true); if (res.method != null) { executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO( MSG_BIND_CLIENT, mCurClient.client, res)); Loading Loading @@ -2289,7 +2292,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } if (attribute != null) { return startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); attribute, controlFlags, startInputReason); } return null; } Loading Loading @@ -2339,7 +2342,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Unspecified window will show input"); if (attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); missingMethods, attribute, controlFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); Loading @@ -2365,7 +2368,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Window asks to show input going forward"); if (attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); missingMethods, attribute, controlFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); Loading @@ -2375,7 +2378,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Window asks to always show input"); if (attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); attribute, controlFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); Loading @@ -2384,7 +2387,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (!didStart && attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); controlFlags, startInputReason); } } } finally { Loading Loading
core/java/com/android/internal/view/InputMethodClient.java +4 −1 Original line number Diff line number Diff line Loading @@ -32,13 +32,14 @@ public final class InputMethodClient { public static final int START_INPUT_REASON_UNBOUND_FROM_IMMS = 6; public static final int START_INPUT_REASON_ACTIVATED_BY_IMMS = 7; public static final int START_INPUT_REASON_DEACTIVATED_BY_IMMS = 8; public static final int START_INPUT_REASON_SESSION_CREATED_BY_IME = 9; @Retention(SOURCE) @IntDef({START_INPUT_REASON_UNSPECIFIED, START_INPUT_REASON_WINDOW_FOCUS_GAIN, START_INPUT_REASON_WINDOW_FOCUS_GAIN_REPORT_ONLY, START_INPUT_REASON_APP_CALLED_RESTART_INPUT_API, START_INPUT_REASON_CHECK_FOCUS, START_INPUT_REASON_BOUND_TO_IMMS, START_INPUT_REASON_ACTIVATED_BY_IMMS, START_INPUT_REASON_DEACTIVATED_BY_IMMS}) START_INPUT_REASON_DEACTIVATED_BY_IMMS, START_INPUT_REASON_SESSION_CREATED_BY_IME}) public @interface StartInputReason {} public static String getStartInputReason(@StartInputReason final int reason) { Loading @@ -61,6 +62,8 @@ public final class InputMethodClient { return "ACTIVATED_BY_IMMS"; case START_INPUT_REASON_DEACTIVATED_BY_IMMS: return "DEACTIVATED_BY_IMMS"; case START_INPUT_REASON_SESSION_CREATED_BY_IME: return "SESSION_CREATED_BY_IME"; default: return "Unknown=" + reason; } Loading
services/core/java/com/android/server/InputMethodManagerService.java +13 −10 Original line number Diff line number Diff line Loading @@ -1297,7 +1297,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return flags; } InputBindResult attachNewInputLocked(boolean initial) { InputBindResult attachNewInputLocked( /* @InputMethodClient.StartInputReason */ final int startInputReason, boolean initial) { if (!mBoundToMethod) { executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO( MSG_BIND_INPUT, mCurMethod, mCurClient.binding)); Loading Loading @@ -1361,12 +1362,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); controlFlags, startInputReason); } InputBindResult startInputUncheckedLocked(@NonNull ClientState cs, IInputContext inputContext, /* @InputConnectionInspector.missingMethods */ final int missingMethods, @NonNull EditorInfo attribute, int controlFlags) { @NonNull EditorInfo attribute, int controlFlags, /* @InputMethodClient.StartInputReason */ final int startInputReason) { // If no method is currently selected, do nothing. if (mCurMethodId == null) { return mNoBinding; Loading Loading @@ -1408,7 +1410,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (cs.curSession != null) { // Fast case: if we are already connected to the input method, // then just return it. return attachNewInputLocked( return attachNewInputLocked(startInputReason, (controlFlags&InputMethodManager.CONTROL_START_INITIAL) != 0); } if (mHaveConnection) { Loading Loading @@ -1549,7 +1551,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub clearClientSessionLocked(mCurClient); mCurClient.curSession = new SessionState(mCurClient, method, session, channel); InputBindResult res = attachNewInputLocked(true); InputBindResult res = attachNewInputLocked( InputMethodClient.START_INPUT_REASON_SESSION_CREATED_BY_IME, true); if (res.method != null) { executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO( MSG_BIND_CLIENT, mCurClient.client, res)); Loading Loading @@ -2289,7 +2292,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } if (attribute != null) { return startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); attribute, controlFlags, startInputReason); } return null; } Loading Loading @@ -2339,7 +2342,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Unspecified window will show input"); if (attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); missingMethods, attribute, controlFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); Loading @@ -2365,7 +2368,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Window asks to show input going forward"); if (attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); missingMethods, attribute, controlFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); Loading @@ -2375,7 +2378,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Window asks to always show input"); if (attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); attribute, controlFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); Loading @@ -2384,7 +2387,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (!didStart && attribute != null) { res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, controlFlags); controlFlags, startInputReason); } } } finally { Loading