summaryrefslogtreecommitdiff
path: root/libs/androidfw/misc.cpp
diff options
context:
space:
mode:
author Johannes Gallmann <gallmann@google.com> 2024-08-26 12:51:41 +0000
committer Johannes Gallmann <gallmann@google.com> 2024-08-27 12:28:55 +0000
commitbf9d8106221dcec6a9f6c361f86fc274eca598f6 (patch)
tree16a967a323eec45494000483c9a77d8681a4b1c8 /libs/androidfw/misc.cpp
parenteeae7591567410ba5d5b7ddd588d3f64f2014b4f (diff)
Prevent insets switch during IME predictive back animation...
...when app has animation callback registered This CL changes an important aspect of the IME predictive back animation: When the app has an animation callback registered, insets are now HIDDEN from the start of the predictive back animation, instead of remaining as SHOWN during the precommit phase and switching to HIDDEN as soon as the back gesture is committed. The reason for this change is to be compatible with apps that are following the official documentation at https://developer.android.com/develop/ui/views/layout/sw-keyboard to animate app content in sync with the IME. The official documentation states that insets always switch at the beginning of the animation (between onPrepare and onStart of WindowInsetsAnimation.Callback). This needs to be valid for IME predictive back too, otherwise some apps animation logic might break. Here's a brief explanation of the changes in this CL: 1. The custom handling for ime-predictive-back in InsetsController#getLayoutInsetsDuringAnimationMode is only applied if there is no animation callback registered. 2. We must prevent ViewRootImpl from moving app content back to it's original position at the start of the back gesture in the adjust_pan case. The pan is controlled by ImeBackAnimationController instead. When the refactor_insets_controller flag is enabled, these two changes would already be sufficient. For the case of that flag not being enabled, two additional targeted fixes are necessary: 1. In InsetsController#collectSourceControls, we want to treat the ime-predictive-back case (with animation-callback) as a hide request instead of a show request. Without that change, starting a predictive-back gesture while the IME is still animating in doesn't work properly. 2. In ImeInsetsSourceConsumer it needs to be ensured that the insets are reported as changed after a predictive back gesture is cancelled and the IME was animated back to its shown position. Without that change, there would be a flicker in that case. Bug: 359175310 Test: Manual, i.e. extensive manual testing with refactor_insets_controller flag enabled and disabled in different apps (ChatActivity test app, Instagram, Launcher all apps, Settings, Google Keep etc.) and various use cases (animation interruptions, quick refocusing, quick rehiding etc.) Test: ImeBackAnimationControllerTest, InsetsControllerTest Flag: android.view.inputmethod.predictive_back_ime Change-Id: I288c7acadb12f84394f8a64b3b0a7898fde3ab7e
Diffstat (limited to 'libs/androidfw/misc.cpp')
0 files changed, 0 insertions, 0 deletions