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
This commit is contained in:
Tiger Huang
2020-11-02 17:05:53 +08:00
parent ef7605be2e
commit a496e03194

View File

@@ -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