OSDN Git Service

surfaceflinger: fix z-relative layer destruction
authorChia-I Wu <olv@google.com>
Tue, 15 Aug 2017 18:18:17 +0000 (11:18 -0700)
committerChia-I Wu <olv@google.com>
Tue, 15 Aug 2017 21:20:49 +0000 (14:20 -0700)
commitc665702cea06c5c42360b7f66fed1693127e6680
tree492521de4c7a73aeb48a08c7d670bed9e7bececa
parentd2bc3ac8c4d7e71975a8c99762b63307a5e6e449
surfaceflinger: fix z-relative layer destruction

Layer::commitTransaction is called before Layer::onRemoved.  The
removal of a layer from another layer's zOrderRelatives is not
reflected in Layer::mDrawingState until Layer::commitTransaction is
called again.  As a result, we may draw a removed layer, which is
not supposed to own any HWC or GL resource.

Add Layer::onRemovedFromCurrentState that is called when a layer is
removed from mCurrentState to mLayersPendingRemoval.  Move
zOrderRelative* updates from onRemoved to the new
onRemovedFromCurrentState, and set eTraversalNeeded as needed.

Also fix Layer::~Layer to restore the old behavior and destroy all
stale HWC layers just in case.

Bug: 64572777
Test: manual and AUPT
Change-Id: I546c5b4b7ecac0937fead655733402fae664331c
services/surfaceflinger/Layer.cpp
services/surfaceflinger/Layer.h
services/surfaceflinger/SurfaceFlinger.cpp
services/surfaceflinger/SurfaceFlinger_hwc1.cpp