Re-land: Update the leash position when gaining a new control
If there is an animation playing, the leash position will be updated after calling InsetsAnimationControlRunner#updateSurfacePosition in the next animation frame or the end of animation. However, if there is no animation playing. The client wouldn't update the leash position if the surface position of the insets source window is changed at the server side. This is fine in most of time because the server will update the leash position. But if the client is playing the animation while the server is updating the leash position, and then the client finishes the animation right before receiving the new control, the position can be overwritten by the client animation. This CL updates the leash position when the client gains a new control if there is no leash-animation playing, like we did to the visibility. The previous attempt would send the control with the new surface position while waiting for the next draw, so that it caused flickers. This CL updates the surface position, the leash postion, and the insets hint together as well as the time to call notifyControlChanged. In this way, the new surface position won't be leaked to the client before it is ready to be dispatched. Bug: 337018949 Bug: 349601805 Flag: EXEMPT bugfix Test: Turn screen off while the device is unfolded, fold the device, and then turn screen on. See if the taskbar position is expected. Test: InsetsAnimationControlImplTest InsetsControllerTest InsetsSourceConsumerTest ViewTest Change-Id: I2ebe7567f6c3d35eea23b6063718aa5499f2ed20
Loading