From a496e0319479e2b8081f5808f3d31b858ef8f037 Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Mon, 2 Nov 2020 17:05:53 +0800 Subject: [PATCH] DO NOT MERGE: Only restore the positions of types which are controlled The client can only send the requested visibility to the server when it has the control. Before that, the server doesn't know the requested visibility of the client. We don't restore the visible-system-bar position in this case. Fix: 161247175 Test: Steps in the bug Change-Id: Ibbcd2fac352a5349ec24b5a6361f3e48d16f5a05 --- .../com/android/server/wm/DisplayPolicy.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 515d1f58d3ef7..daec4d7617420 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -3437,17 +3437,16 @@ public class DisplayPolicy { } final InsetsState requestedState = controlTarget.getRequestedInsetsState(); + final InsetsSource nbSource = requestedState.peekSource(ITYPE_NAVIGATION_BAR); + final InsetsSource sbSource = requestedState.peekSource(ITYPE_STATUS_BAR); + final InsetsSource enbSource = requestedState.peekSource(ITYPE_EXTRA_NAVIGATION_BAR); + final InsetsSource cbSource = requestedState.peekSource(ITYPE_CLIMATE_BAR); final @InsetsType int restorePositionTypes = - (requestedState.getSourceOrDefaultVisibility(ITYPE_NAVIGATION_BAR) + (nbSource != null && nbSource.isVisible() ? Type.navigationBars() : 0) + | (sbSource != null && sbSource.isVisible() ? Type.statusBars() : 0) + | (mExtraNavBarAlt != null && enbSource != null && enbSource.isVisible() ? Type.navigationBars() : 0) - | (requestedState.getSourceOrDefaultVisibility(ITYPE_STATUS_BAR) - ? Type.statusBars() : 0) - | (mExtraNavBarAlt != null - && requestedState.getSourceOrDefaultVisibility( - ITYPE_EXTRA_NAVIGATION_BAR) - ? Type.navigationBars() : 0) - | (mClimateBarAlt != null - && requestedState.getSourceOrDefaultVisibility(ITYPE_CLIMATE_BAR) + | (mClimateBarAlt != null && cbSource != null && cbSource.isVisible() ? Type.statusBars() : 0); if (swipeTarget == mNavigationBar