From cd0feb35a43c954e6306fbcdbd37f881ce66686f Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 8 Apr 2021 23:44:45 -0700 Subject: [PATCH] Don't account for floating window region in nav bar touchable region - It's only needed for the deferred gesture region, normally not an issue, but b/184914153 causes the layers to be incorrect which causes the button to not be touchable because the nav bar is also touchable in that region. Bug: 184914153 Test: Dump touchable region of nav bar window while overlay is showing and ensure it's not accounted for Change-Id: I6cfc0330469ecd53991694dc62118141f9e1ae48 --- .../navigationbar/NavigationBarView.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java index 339331bdd8277..d9919bea7a992 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java @@ -281,7 +281,7 @@ public class NavigationBarView extends FrameLayout implements // When in gestural and the IME is showing, don't use the nearest region since it will take // gesture space away from the IME info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_REGION); - info.touchableRegion.set(getButtonLocations(false /* includeFloatingRotationButton */, + info.touchableRegion.set(getButtonLocations(false /* includeFloatingButtons */, false /* inScreen */, false /* useNearestRegion */)); }; @@ -982,7 +982,7 @@ public class NavigationBarView extends FrameLayout implements */ public void notifyActiveTouchRegions() { mOverviewProxyService.onActiveNavBarRegionChanges( - getButtonLocations(true /* includeFloatingRotationButton */, true /* inScreen */, + getButtonLocations(true /* includeFloatingButtons */, true /* inScreen */, true /* useNearestRegion */)); } @@ -995,14 +995,14 @@ public class NavigationBarView extends FrameLayout implements } /** - * @param includeFloatingRotationButton Whether to include the floating rotation button in the - * region for all the buttons + * @param includeFloatingButtons Whether to include the floating rotation and overlay button in + * the region for all the buttons * @param inScreenSpace Whether to return values in screen space or window space * @param useNearestRegion Whether to use the nearest region instead of the actual button bounds * @return */ - private Region getButtonLocations(boolean includeFloatingRotationButton, - boolean inScreenSpace, boolean useNearestRegion) { + private Region getButtonLocations(boolean includeFloatingButtons, boolean inScreenSpace, + boolean useNearestRegion) { if (useNearestRegion && !inScreenSpace) { // We currently don't support getting the nearest region in anything but screen space useNearestRegion = false; @@ -1014,13 +1014,13 @@ public class NavigationBarView extends FrameLayout implements updateButtonLocation(getRecentsButton(), inScreenSpace, useNearestRegion); updateButtonLocation(getImeSwitchButton(), inScreenSpace, useNearestRegion); updateButtonLocation(getAccessibilityButton(), inScreenSpace, useNearestRegion); - if (includeFloatingRotationButton && mFloatingRotationButton.isVisible()) { + if (includeFloatingButtons && mFloatingRotationButton.isVisible()) { // Note: this button is floating so the nearest region doesn't apply updateButtonLocation(mFloatingRotationButton.getCurrentView(), inScreenSpace); } else { updateButtonLocation(getRotateSuggestionButton(), inScreenSpace, useNearestRegion); } - if (mNavBarOverlayController.isNavigationBarOverlayEnabled() + if (includeFloatingButtons && mNavBarOverlayController.isNavigationBarOverlayEnabled() && mNavBarOverlayController.isVisible()) { // Note: this button is floating so the nearest region doesn't apply updateButtonLocation(mNavBarOverlayController.getCurrentView(), inScreenSpace);