summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index ee95b1a333..cb8edc38ca 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -8471,7 +8471,13 @@ bool SurfaceFlinger::commitMirrorDisplays(VsyncId vsyncId) {
// Set mirror layer's default layer stack to -1 so it doesn't end up rendered on a display
// accidentally.
sp<Layer> rootMirrorLayer = LayerHandle::getLayer(mirrorDisplay.rootHandle);
- rootMirrorLayer->setLayerStack(ui::LayerStack::fromValue(-1));
+ ssize_t idx = mCurrentState.layersSortedByZ.indexOf(rootMirrorLayer);
+ bool ret = rootMirrorLayer->setLayerStack(ui::LayerStack::fromValue(-1));
+ if (idx >= 0 && ret) {
+ mCurrentState.layersSortedByZ.removeAt(idx);
+ mCurrentState.layersSortedByZ.add(rootMirrorLayer);
+ }
+
for (const auto& layer : mDrawingState.layersSortedByZ) {
if (layer->getLayerStack() != mirrorDisplay.layerStack ||
layer->isInternalDisplayOverlay()) {