Skip to content
Commit 9130150f authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Freezing IME insets when screen turned-off

An animation flicker case happens when power off/on then unlocking the
device to show an IME activity, sometimes will seeing the app
layout jumps up-and-down after dismissing the snapshot starting window.

The root cause is when turning off the screen, IME window will be hidden
because of keyguard policy change. Then ImeInsetsProvider will
receive onPostLayout to update the insets server frame as invisible and
deliver this invisible insets change to the control target.

Also, showing IME and updating IME insets visibility requires to take
time until the IME starts the input after resuming the IME activity.

As a result, fix this flicker issue with

- Add ImeInsetsSourceProvider#setFrozen(boolean) to freeze the IME state
  when turning off the screen (And unfreeze when the IME is going to
  visible after unlocking the screen).

- Override setServerVisible for ImeInsetsSourceProvider to freeze server
  visiblity when setFrozen(true) gets called.

Bug: 246402296
Test: atest CtsInputMethodTestCases
Test: atest WindowContainerTests ActivityRecordTests
Test: atest ImeInsetsSourceProviderTest
Test: manual with the issue steps:
  1) Launch a chat app
  2) Start a chat channel to show IME
  3) Press power button to turn the screen off
  4) Press power button to turn the screen on and unlock
  5) Expect the chat activity looks fine without flickers

Change-Id: Icfec9a491681406a382c74b690d8ef303848b32e
parent 46afac61
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment