Improve InsetsPolicy#adjustVisibilityForIme when switching apps
When switching tasks from the task has IME shown to another task without showing IME (e.g. youtube apps.), the flickering might happen because the next activity accidentally received the IME insets attached in the previous activity. If the IME is attached to one app window on that time, even the next app window is behind the IME window, conceptually the window should not receive the IME insets if the next window is not eligible IME requester and ready to show IME on top of it. Previously, we introduced CL[1] with checking task animating state and check if the window has request IME visiblity to judge if the next focus window is eligible to get IME insets. However, CL[1] overlooked that some apps design may using a child window to receive IME insets but not the IME requester (the requester is activity main window), so makes the regression that the child window may not able to receive IME to adjust editor layout on the main window like Bug 195385541 and Bug 195846009. As the result, in this CL we introduce another way to fix this improper IME insets delivering. The fix way is straight forward. when the task with showing IME is leaving, we'll set a flag to froze IME insets state for all windows until the next task's IME input target has focused and reprorted to WM site. As this fix approach could be more simple and preversing the original insets behavior. Refine the logic in InsetsPolicy#adjustVisibilityForIme with the above approach. [1]: Ib3a1eacedd3763bcf1e6eed82e7efdf01c50b204 Fix: 192337037 Test: atest WindowStateTests#\ testAdjustImeInsetsVisibilityWhenSwitchingApps Test: atest ActivityRecordTests Test: manual as below steps: 1) Switch tasks with the task has IME shown (e.g. Android Message) and youtube apps. 2) Expect youtube no flickering when switched the task from Android Message. Change-Id: Id8a56c68a06a774ef12ba444fd9a368148ea4539
Loading
Please register or sign in to comment