Loading services/surfaceflinger/Layer.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,8 @@ void Layer::onLayerDisplayed(const sp<const DisplayDevice>& /* hw */, void Layer::onRemovedFromCurrentState() { // the layer is removed from SF mCurrentState to mLayersPendingRemoval mPendingRemoval = true; if (mCurrentState.zOrderRelativeOf != nullptr) { sp<Layer> strongRelative = mCurrentState.zOrderRelativeOf.promote(); if (strongRelative != nullptr) { Loading services/surfaceflinger/Layer.h +4 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,8 @@ public: */ virtual bool isFixedSize() const = 0; bool isPendingRemoval() const { return mPendingRemoval; } void writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing); Loading Loading @@ -669,6 +671,8 @@ protected: // The mesh used to draw the layer in GLES composition mode mutable Mesh mMesh; bool mPendingRemoval = false; #ifdef USE_HWC2 // HWC items, accessed from the main thread struct HWCInfo { Loading services/surfaceflinger/SurfaceFlinger.cpp +120 −108 Original line number Diff line number Diff line Loading @@ -2857,6 +2857,10 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, status_t SurfaceFlinger::removeLayer(const sp<Layer>& layer, bool topLevelOnly) { Mutex::Autolock _l(mStateLock); if (layer->isPendingRemoval()) { return NO_ERROR; } const auto& p = layer->getParent(); ssize_t index; if (p != nullptr) { Loading Loading @@ -3060,9 +3064,18 @@ uint32_t SurfaceFlinger::setClientStateLocked( const sp<Client>& client, const layer_state_t& s) { uint32_t flags = 0; sp<Layer> layer(client->getLayerUser(s.surface)); if (layer != 0) { if (layer == nullptr) { return 0; } if (layer->isPendingRemoval()) { ALOGW("Attempting to set client state on removed layer: %s", layer->getName().string()); return 0; } uint32_t flags = 0; const uint32_t what = s.what; bool geometryAppliesWithResize = what & layer_state_t::eGeometryAppliesWithResize; Loading Loading @@ -3184,7 +3197,6 @@ uint32_t SurfaceFlinger::setClientStateLocked( // We don't trigger a traversal here because if no other state is // changed, we don't want this to cause any more work } } return flags; } Loading Loading
services/surfaceflinger/Layer.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,8 @@ void Layer::onLayerDisplayed(const sp<const DisplayDevice>& /* hw */, void Layer::onRemovedFromCurrentState() { // the layer is removed from SF mCurrentState to mLayersPendingRemoval mPendingRemoval = true; if (mCurrentState.zOrderRelativeOf != nullptr) { sp<Layer> strongRelative = mCurrentState.zOrderRelativeOf.promote(); if (strongRelative != nullptr) { Loading
services/surfaceflinger/Layer.h +4 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,8 @@ public: */ virtual bool isFixedSize() const = 0; bool isPendingRemoval() const { return mPendingRemoval; } void writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing); Loading Loading @@ -669,6 +671,8 @@ protected: // The mesh used to draw the layer in GLES composition mode mutable Mesh mMesh; bool mPendingRemoval = false; #ifdef USE_HWC2 // HWC items, accessed from the main thread struct HWCInfo { Loading
services/surfaceflinger/SurfaceFlinger.cpp +120 −108 Original line number Diff line number Diff line Loading @@ -2857,6 +2857,10 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, status_t SurfaceFlinger::removeLayer(const sp<Layer>& layer, bool topLevelOnly) { Mutex::Autolock _l(mStateLock); if (layer->isPendingRemoval()) { return NO_ERROR; } const auto& p = layer->getParent(); ssize_t index; if (p != nullptr) { Loading Loading @@ -3060,9 +3064,18 @@ uint32_t SurfaceFlinger::setClientStateLocked( const sp<Client>& client, const layer_state_t& s) { uint32_t flags = 0; sp<Layer> layer(client->getLayerUser(s.surface)); if (layer != 0) { if (layer == nullptr) { return 0; } if (layer->isPendingRemoval()) { ALOGW("Attempting to set client state on removed layer: %s", layer->getName().string()); return 0; } uint32_t flags = 0; const uint32_t what = s.what; bool geometryAppliesWithResize = what & layer_state_t::eGeometryAppliesWithResize; Loading Loading @@ -3184,7 +3197,6 @@ uint32_t SurfaceFlinger::setClientStateLocked( // We don't trigger a traversal here because if no other state is // changed, we don't want this to cause any more work } } return flags; } Loading