Fix the IME flicker when the launching activity in fixed-rotation
Previously, when synchronizing IME visibility in between removing
tasksnapshot with IME starting window and showing the real IME during
the activity launching, we schedule a runnable for removing the starting
window with a timeout (600ms) if IME will be shown when
AR#onFirstWindowDrawn comes, and then remove it immediately once
the IME has actually drawn before that timeout.
But this approch doesn't accurate when the activity was in fixed
rotation. Since the IME client visiblity change from InsetsController
does not aware the IME orientation was still in changing (portrait ->
landcape), in this case, starting window will be removed in earlier
stage and seeing IME fade-out / fade-in animation during
AsyncRotationController controlling IME surface in fixed rotation.
To more accurate deciding whether to defer the starting window
removal during the rotation, in this CL
1) Modified StartingWindowRemovalInfo#deferRemoveForIme with
deferRemoveForImeMode to diffenciate scenarios for giving adaquate
waiting IME drawn timeout:
- DEFER_MODE_NONE: no need wait for IME drawn.
- DEFER_MODE_NORMAL: wait IME drawn at most 600ms
- DEFER_MODE_ROTATION: wait IME rotation and drawn at most 3 secs.
2) Fix StartingWindowRecordManager#removeStartingWindow removes the
record from mStartingWindowRecords too early before calling
onImeDrawnOnTask leads to the the IME snapshot starting window
always be defered to remove after the timeout.
3) Modified ImeInsetsSourceProvider and AsyncRotationController to
skip reporting IME drawn state to WMShell when the system was in
fixed-rotation, and report it once AsyncRotationController receiving
onAnimationFinished callback from IME token's surfaceAnimator.
4) Added a flicker test to verify this CL works as expected for this
use case.
Fix: 268627602
Test: atest FlickerTests:\
ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest
Test: atest ActivityRecordTests
Change-Id: Ie476e89a57f2f64d4d66e722fedeeb1719d9de55
Loading
Please register or sign in to comment