From 292094e873b67e8f67ce59842134730e78924379 Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Wed, 29 Mar 2023 14:38:29 +0900 Subject: [PATCH] Use correct gravity for 3-button gesture insets 3-button nav bar can be on sides instead of the bottom when the display rotates, always use the nav bar height value from the resource and put it at the bottom as mandatory gesture insets is not a reliable way to provide the correct value. Use the nav bar frame for the insets. Bug: 273445780 Test: TaplTestsLauncher3 Test: See reproduce steps in the bug Change-Id: I19e87390dbf7ade1e5b2fb6490f8ca550c476026 --- .../android/systemui/navigationbar/NavigationBar.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index 44c718f26a4a6..e8ef612ae2cf2 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -1732,6 +1732,11 @@ public class NavigationBar extends ViewController implements final int gestureHeight = userContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.navigation_bar_gesture_height); final boolean handlingGesture = mEdgeBackGestureHandler.isHandlingGestures(); + final InsetsFrameProvider mandatoryGestureProvider = new InsetsFrameProvider( + mInsetsSourceOwner, 0, WindowInsets.Type.mandatorySystemGestures()); + if (handlingGesture) { + mandatoryGestureProvider.setInsetsSize(Insets.of(0, 0, 0, gestureHeight)); + } final int gestureInsetsLeft = handlingGesture ? mEdgeBackGestureHandler.getEdgeWidthLeft() + safeInsetsLeft : 0; final int gestureInsetsRight = handlingGesture @@ -1739,9 +1744,7 @@ public class NavigationBar extends ViewController implements return new InsetsFrameProvider[] { navBarProvider, tappableElementProvider, - new InsetsFrameProvider( - mInsetsSourceOwner, 0, WindowInsets.Type.mandatorySystemGestures()) - .setInsetsSize(Insets.of(0, 0, 0, gestureHeight)), + mandatoryGestureProvider, new InsetsFrameProvider(mInsetsSourceOwner, 0, WindowInsets.Type.systemGestures()) .setSource(InsetsFrameProvider.SOURCE_DISPLAY) .setInsetsSize(Insets.of(gestureInsetsLeft, 0, 0, 0)),