From d3b4086d55c1178a9b7d9418c5732a269e6470d5 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Tue, 16 Apr 2019 15:39:23 +0200 Subject: [PATCH] WM: Fix seamless rotation with gesture navigation With gesture navigation, the navigation bar will generally move when rotating the screen. Fixes: 130052977 Test: Enable gestural navigation, open camera, enable auto-rotate, verify camera rotates seamlessly Change-Id: I2d73fcadf9338a08ac15ba04842dc8b1221d74b0 --- core/res/res/values/config.xml | 4 ++++ core/res/res/values/symbols.xml | 1 + .../res/values/config.xml | 4 ++++ .../core/java/com/android/server/wm/DisplayPolicy.java | 8 ++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 3ac0af7b53a32..dcd7c1db064d6 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3297,6 +3297,10 @@ {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. --> true + + false + 16x16 diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 77988de771d9d..49f92a4ba525e 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2875,6 +2875,7 @@ + diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml index 9694e76e138be..f1d2e0b273537 100644 --- a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml +++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml @@ -37,6 +37,10 @@ {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. --> false + + true + true diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index b8504db8e810e..197a3cf2b3ab3 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -255,6 +255,7 @@ public class DisplayPolicy { private volatile boolean mNavigationBarCanMove; private volatile boolean mNavigationBarLetsThroughTaps; private volatile boolean mNavigationBarAlwaysShowOnSideGesture; + private volatile boolean mAllowSeamlessRotationDespiteNavBarMoving; // Written by vr manager thread, only read in this class. private volatile boolean mPersistentVrModeEnabled; @@ -2726,6 +2727,8 @@ public class DisplayPolicy { mNavigationBarCanMove = mDisplayContent.mBaseDisplayWidth != mDisplayContent.mBaseDisplayHeight && res.getBoolean(R.bool.config_navBarCanMove); + mAllowSeamlessRotationDespiteNavBarMoving = + res.getBoolean(R.bool.config_allowSeamlessRotationDespiteNavBarMoving); } /** @@ -3508,8 +3511,9 @@ public class DisplayPolicy { } // If the navigation bar can't change sides, then it will // jump when we change orientations and we don't rotate - // seamlessly. - if (!navigationBarCanMove()) { + // seamlessly - unless that is allowed, eg. with gesture + // navigation where the navbar is low-profile enough that this isn't very noticeable. + if (!navigationBarCanMove() && !mAllowSeamlessRotationDespiteNavBarMoving) { return false; }