Fix an issue with bubble being dismissed and added back at the same time
When expanded and the user drags the last bubble to remove it, the
scrim animates out and THEN the views related to that last bubble
get cleaned up.
Within this time, a new update for this bubble could be posted. If the
timing is right, this can result in a crash as the view being added to
stackView is already added (i.e. the view hasn't finished animating
out yet).
This CL makes the following changes:
1) when adding a bubble - check for an existing parent & removing
the bubble and adding it back (need to re-add it to get the add
animation)
2) before removing a bubble - check if it's still in the stack before
removing it / cleaning up expanded view
3) the expanded view state also gets messed up in this scenario, need
to remove it from the hierachy while it's dragged out so that it
gets the correct transitions (TO_BACK) so that it can get a TO_FRONT
when it gets added back, previously we'd fade it out but from WM
perspective that task is still visible.
Also added some tests for removeBubble behavior - general coverage
and coverage for this specific bug.
Bug: 420487074
Flag: com.android.wm.shell.fix_bubbles_add_same_bubble_being_removed
Test: atest BubbleStackViewTest
Test: manual - send two bubbles every second and continuously expand
and dismiss them -- nothing should crash and bubbles
that are removed & added back should be visible
- while expanded, start dragging a bubble but release it
before entering the dismiss target -- expanded view
should hide and then appear when the up event happens
Change-Id: I7d30f486b3b726ea09d6e7686fcd12e145d1731f
Loading
Please register or sign in to comment