Ignore onStartInput when WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR
CL[1] introduces new WINDOW_FOCUS_GAIN_REPORT_ONLY flows to notify InputMethodService only reports IME input target to WM when focusing to the next window and its input connection remains. Originally in android Q and prior devices, we don't need such report mechnism but just skip to start new input connection and ignore onStartInput / onFinishInput for the above use case. Since starts from Android R, new IME insets control APIs relying on this mechanism (see CL[2]) to keep the actual IME input target up-to-date. As we expected there should be no new input connection and additional onFinishInput when CL[1] landed. However, in IMMS, startInputUncheckedLocked will be called to callback additional onStartInput for InputMethodService, which mostly is not expected, except when focusing the same window after device turned screen on, we need to start input and callback onStartInput to align with the behavior of android Q or the prior platform. Besides, to have more clear code logic and debugging concept of ignoring onStartInput and onFinishInput only when focused the same editor with input connection remains, we remove WINDOW_FOCUS_GAIN_REPORT_ONLY reason and introduced 2 more start input reasons to distinguish the different behavior: - WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR - WINDOW_FOCUS_GAIN_REPORT_WITHOUT_EDITOR [1]: I45a9814d812ad906f417c24200fd4219959e2423 [2]: I9e8984b7e5aa989a53ece9e2576393f795b9ef94 Fix: 158624922 Test: atest FocusHandlingTest InputMethodStartInputLifecycleTest Test: manual as below steps: 1. Use Gboard, Open the emoji keyboard 2. Swipe down to reveal notification shade 3. Swipe up to dismiss notifications 4. Expect the Emoji keyboard is still open without close Change-Id: I2da99ae67b9ce4051dec0c0f0e975ebe6e1ab118
Loading
Please register or sign in to comment