OSDN Git Service

WM: Fix seamless rotation with gesture navigation
authorAdrian Roos <roosa@google.com>
Tue, 16 Apr 2019 13:39:23 +0000 (15:39 +0200)
committerAdrian Roos <roosa@google.com>
Mon, 13 May 2019 12:41:13 +0000 (14:41 +0200)
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
core/res/res/values/symbols.xml
packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml
services/core/java/com/android/server/wm/DisplayPolicy.java

index 3ac0af7..dcd7c1d 100644 (file)
          {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">true</bool>
 
+    <!-- Controls whether seamless rotation should be allowed even though the navbar can move
+         (which normally prevents seamless rotation). -->
+    <bool name="config_allowSeamlessRotationDespiteNavBarMoving">false</bool>
+
     <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
          These values are in DPs and will be converted to pixel sizes internally. -->
     <string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">16x16</string>
index 77988de..49f92a4 100644 (file)
   <java-symbol type="bool" name="config_navBarTapThrough" />
   <java-symbol type="bool" name="config_navBarAlwaysShowOnSideEdgeGesture" />
   <java-symbol type="bool" name="config_navBarNeedsScrim" />
+  <java-symbol type="bool" name="config_allowSeamlessRotationDespiteNavBarMoving" />
   <java-symbol type="dimen" name="config_backGestureInset" />
   <java-symbol type="color" name="system_bar_background_semi_transparent" />
 
index 9694e76..f1d2e0b 100644 (file)
      {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">false</bool>
 
+    <!-- Controls whether seamless rotation should be allowed even though the navbar can move
+         (which normally prevents seamless rotation). -->
+    <bool name="config_allowSeamlessRotationDespiteNavBarMoving">true</bool>
+
     <!-- Controls whether the side edge gestures can always trigger the transient nav bar to
          show. -->
     <bool name="config_navBarAlwaysShowOnSideEdgeGesture">true</bool>
index b8504db..197a3cf 100644 (file)
@@ -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;
         }