Loading services/surfaceflinger/LayerRenderArea.cpp +14 −12 Original line number Diff line number Diff line Loading @@ -26,18 +26,12 @@ namespace android { namespace { struct ReparentForDrawing { const sp<Layer>& oldParent; ReparentForDrawing(const sp<Layer>& oldParent, const sp<Layer>& newParent, const Rect& drawingBounds) : oldParent(oldParent) { void reparentForDrawing(const sp<Layer>& oldParent, const sp<Layer>& newParent, const Rect& drawingBounds) { // Compute and cache the bounds for the new parent layer. newParent->computeBounds(drawingBounds.toFloatRect(), ui::Transform(), 0.f /* shadowRadius */); oldParent->setChildrenDrawingParent(newParent); } ~ReparentForDrawing() { oldParent->setChildrenDrawingParent(oldParent); } }; } // namespace Loading Loading @@ -114,11 +108,19 @@ void LayerRenderArea::render(std::function<void()> drawLayers) { } else { // In the "childrenOnly" case we reparent the children to a screenshot // layer which has no properties set and which does not draw. // We hold the statelock as the reparent-for-drawing operation modifies the // hierarchy and there could be readers on Binder threads, like dump. sp<ContainerLayer> screenshotParentLayer = mFlinger.getFactory().createContainerLayer( {&mFlinger, nullptr, "Screenshot Parent"s, 0, LayerMetadata()}); ReparentForDrawing reparent(mLayer, screenshotParentLayer, sourceCrop); { Mutex::Autolock _l(mFlinger.mStateLock); reparentForDrawing(mLayer, screenshotParentLayer, sourceCrop); } drawLayers(); { Mutex::Autolock _l(mFlinger.mStateLock); mLayer->setChildrenDrawingParent(mLayer); } } } Loading services/surfaceflinger/SurfaceFlinger.h +1 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,7 @@ private: friend class MonitoredProducer; friend class RefreshRateOverlay; friend class RegionSamplingThread; friend class LayerRenderArea; friend class LayerTracing; // For unit tests Loading Loading
services/surfaceflinger/LayerRenderArea.cpp +14 −12 Original line number Diff line number Diff line Loading @@ -26,18 +26,12 @@ namespace android { namespace { struct ReparentForDrawing { const sp<Layer>& oldParent; ReparentForDrawing(const sp<Layer>& oldParent, const sp<Layer>& newParent, const Rect& drawingBounds) : oldParent(oldParent) { void reparentForDrawing(const sp<Layer>& oldParent, const sp<Layer>& newParent, const Rect& drawingBounds) { // Compute and cache the bounds for the new parent layer. newParent->computeBounds(drawingBounds.toFloatRect(), ui::Transform(), 0.f /* shadowRadius */); oldParent->setChildrenDrawingParent(newParent); } ~ReparentForDrawing() { oldParent->setChildrenDrawingParent(oldParent); } }; } // namespace Loading Loading @@ -114,11 +108,19 @@ void LayerRenderArea::render(std::function<void()> drawLayers) { } else { // In the "childrenOnly" case we reparent the children to a screenshot // layer which has no properties set and which does not draw. // We hold the statelock as the reparent-for-drawing operation modifies the // hierarchy and there could be readers on Binder threads, like dump. sp<ContainerLayer> screenshotParentLayer = mFlinger.getFactory().createContainerLayer( {&mFlinger, nullptr, "Screenshot Parent"s, 0, LayerMetadata()}); ReparentForDrawing reparent(mLayer, screenshotParentLayer, sourceCrop); { Mutex::Autolock _l(mFlinger.mStateLock); reparentForDrawing(mLayer, screenshotParentLayer, sourceCrop); } drawLayers(); { Mutex::Autolock _l(mFlinger.mStateLock); mLayer->setChildrenDrawingParent(mLayer); } } } Loading
services/surfaceflinger/SurfaceFlinger.h +1 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,7 @@ private: friend class MonitoredProducer; friend class RefreshRateOverlay; friend class RegionSamplingThread; friend class LayerRenderArea; friend class LayerTracing; // For unit tests Loading