-
Eliot Courtney authored
Expanding/contracting a notification changes its size, which generates a new LocalSurfaceId. Creating a new LocalSurfaceId makes viz create a new viz::Surface upon submitting the compositor frame. Viz's SurfaceManager tracks the lifetime and performs garbage collection for Surfaces, which reference TransferableResources, which correspond to e.g. the notification buffers. A viz::Surface can be destroyed and deleted. Destroyed means it is marked for deletion. Deletion will happen at some point in the future during GarbageCollectSurfaces. Normally, a notification would be displayed+embedded in the message center so it will have real references to the SurfaceIds. This means that the old viz Surface can be garbage collected immediately if the notification produces more buffers. But, if the notification is producing buffers while the message centre is closed, it's not embedded in anything. In this case, Viz creates temporary references. If you expand and then contract, two Viz Surfaces are created (one for each LocalSurfaceId) but neither can be deleted - both only have temporary references. These Surfaces hold onto the associated TransferableResources, the buffers, and cause buffer starvation on the Android side. Android HWUI starts waiting on a fence for a buffer but the ANR timeout occurs before the Viz temporary reference timeout. This causes the SystemUI ANR. Because the triggers for this bug - "notifications not being visible on the Chrome side" + "receiving input on a notification on the Android side" are completely asynchronous we can't realistically prevent these triggers from occurring. Instead, this change explicitly tells Viz it can release the resources by pushing empty compositor frames when the notification becomes invisible. Test: Android applications still can produce buffers Test: Notifications appear correctly when closing/opening the message center. Test: Following the steps in b/130856284, the ANR no longer reproduces. Bug: b/130856284 Change-Id: I42529267f75d7c30a8bcb03586e6dd08f658c69b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1645432Reviewed-by:
kylechar <kylechar@chromium.org> Reviewed-by:
Peng Huang <penghuang@chromium.org> Reviewed-by:
Mitsuru Oshima <oshima@chromium.org> Commit-Queue: Eliot Courtney <edcourtney@chromium.org> Cr-Commit-Position: refs/heads/master@{#669068}
9d62030e