Use main executor to run remote animation from notification
The pending intent of notification may launch the activity indirectly, e.g. service or receiver. Before the activity is started, the notification may be canceled, then the notification view is detached. And View#post will only put the runnable to a list that will be executed until attach again. So in this case since the notification view is removed, the remote animation is never executed that leads to remote animation timeout and the activity jumps cut without animation. This fix ensures that the handler to animate is valid. Also fix a flickering issue that if activity doesn't draw fast enough (ActivityLaunchAnimator#ANIMATION_DURATION) then the notification panel has started to collapse. The notification view may have clip bottom larger than its actual height, that causes negative crop (as no crop) height of the animating surface. So the first frame will show fully height and then start to animate from the height close to zero. This fix ensures that the crop height is at least zero. Fixes: 158207087 Test: atest ActivityLaunchAnimatorTest Test: Send a notification which will start a service. The service cancels the notification and starts a activity with >500ms delay. Check the launch animation should run smoothly. Change-Id: I78426db1ce295c633271fcaa685b47cc9f697761
Loading
Please register or sign in to comment