From 1c5481ea27625ae9ecb2f386bc115d479fdf50c4 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 1 Jul 2019 14:42:27 -0700 Subject: SurfaceFlinger: Hide Z order relatives when relativeOf is hiddenByPolicy. Now that we are using relative Z for the SurfaceView background we encounter yet another edge case. During Surface preservation we reparent the SurfaceView from one WindowStateAnimator to a second. When we reparent it we hide the old surface and show the new one. However at this time the background is still relative to the OLD surface, which is Z ordered on top of the new Surface. To fix this we ensure that if a layers relative Z parent is hidden by policy the layer is also invisible. Bug: 136061599 Test: TransactionTest#HideRelativeParentHidesLayer Change-Id: I941fb9060dab79dba89300a5c86d6ea1a69f577d --- services/surfaceflinger/Layer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index bda7e4308f..1318bc0b2a 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1231,6 +1231,14 @@ bool Layer::isHiddenByPolicy() const { if (parent != nullptr && parent->isHiddenByPolicy()) { return true; } + if (usingRelativeZ(LayerVector::StateSet::Drawing)) { + auto zOrderRelativeOf = mDrawingState.zOrderRelativeOf.promote(); + if (zOrderRelativeOf != nullptr) { + if (zOrderRelativeOf->isHiddenByPolicy()) { + return true; + } + } + } return s.flags & layer_state_t::eLayerHidden; } @@ -1612,7 +1620,7 @@ int32_t Layer::getZ() const { return mDrawingState.z; } -bool Layer::usingRelativeZ(LayerVector::StateSet stateSet) { +bool Layer::usingRelativeZ(LayerVector::StateSet stateSet) const { const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const State& state = useDrawing ? mDrawingState : mCurrentState; return state.zOrderRelativeOf != nullptr; -- cgit v1.2.3-59-g8ed1b