summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2020-09-14 16:46:32 -0700
committer Winson Chung <winsonc@google.com> 2020-09-22 16:42:19 +0000
commit073d99fa1de11a770ca25e59ee74fdc78bba063e (patch)
tree2a766d28b5c00b97be036e03bfd7e7e8ee2c1430
parent8ca51bde8cce5a1bed688ae4f3a994e436dcf494 (diff)
Make specific nav touchable region when the IME is showing
- IMEs would like to receive touches that are near the bottom of the screen under the nav bar so we should allow this Bug: 168552683 Test: Verify touchable region from dumpsys input in all nav modes w/ ime switcher Change-Id: Ic2ee8cc8ce59c4025c6730195d6e1050daddf87a Merged-In: Ic2ee8cc8ce59c4025c6730195d6e1050daddf87a (cherry picked from commit fc53675a40eb1dd78c25b194c8c6ffa81fb15d70)
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java63
1 files changed, 34 insertions, 29 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 93d4a5e93cb5..5bb3c836586c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -113,7 +113,8 @@ public class NavigationBarView extends FrameLayout implements
int mNavigationIconHints = 0;
private int mNavBarMode;
- private final Region mActiveRegion = new Region();
+ private final Region mTmpRegion = new Region();
+ private final int[] mTmpPosition = new int[2];
private Rect mTmpBounds = new Rect();
private KeyButtonDrawable mBackIcon;
@@ -252,24 +253,14 @@ public class NavigationBarView extends FrameLayout implements
private final OnComputeInternalInsetsListener mOnComputeInternalInsetsListener = info -> {
// When the nav bar is in 2-button or 3-button mode, or when IME is visible in fully
// gestural mode, the entire nav bar should be touchable.
- if (!mEdgeBackGestureHandler.isHandlingGestures() || mImeVisible) {
+ if (!mEdgeBackGestureHandler.isHandlingGestures()) {
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_FRAME);
return;
}
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
- ButtonDispatcher imeSwitchButton = getImeSwitchButton();
- if (imeSwitchButton.getVisibility() == VISIBLE) {
- // If the IME is not up, but the ime switch button is visible, then make sure that
- // button is touchable
- int[] loc = new int[2];
- View buttonView = imeSwitchButton.getCurrentView();
- buttonView.getLocationInWindow(loc);
- info.touchableRegion.set(loc[0], loc[1], loc[0] + buttonView.getWidth(),
- loc[1] + buttonView.getHeight());
- return;
- }
- info.touchableRegion.setEmpty();
+ info.touchableRegion.set(getButtonLocations(false /* includeFloatingRotationButton */,
+ false /* inScreen */));
};
private final Consumer<Boolean> mRotationButtonListener = (visible) -> {
@@ -947,30 +938,44 @@ public class NavigationBarView extends FrameLayout implements
* Notifies the overview service of the active touch regions.
*/
public void notifyActiveTouchRegions() {
- mActiveRegion.setEmpty();
- updateButtonLocation(getBackButton());
- updateButtonLocation(getHomeButton());
- updateButtonLocation(getRecentsButton());
- updateButtonLocation(getImeSwitchButton());
- updateButtonLocation(getAccessibilityButton());
- if (mFloatingRotationButton.isVisible()) {
- View floatingRotationView = mFloatingRotationButton.getCurrentView();
- floatingRotationView.getBoundsOnScreen(mTmpBounds);
- mActiveRegion.op(mTmpBounds, Op.UNION);
+ mOverviewProxyService.onActiveNavBarRegionChanges(
+ getButtonLocations(true /* includeFloatingRotationButton */, true /* inScreen */));
+ }
+
+ private Region getButtonLocations(boolean includeFloatingRotationButton,
+ boolean inScreenSpace) {
+ mTmpRegion.setEmpty();
+ updateButtonLocation(getBackButton(), inScreenSpace);
+ updateButtonLocation(getHomeButton(), inScreenSpace);
+ updateButtonLocation(getRecentsButton(), inScreenSpace);
+ updateButtonLocation(getImeSwitchButton(), inScreenSpace);
+ updateButtonLocation(getAccessibilityButton(), inScreenSpace);
+ if (includeFloatingRotationButton && mFloatingRotationButton.isVisible()) {
+ updateButtonLocation(mFloatingRotationButton.getCurrentView(), inScreenSpace);
} else {
- updateButtonLocation(getRotateSuggestionButton());
+ updateButtonLocation(getRotateSuggestionButton(), inScreenSpace);
}
- mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion);
+ return mTmpRegion;
}
- private void updateButtonLocation(ButtonDispatcher button) {
+ private void updateButtonLocation(ButtonDispatcher button, boolean inScreenSpace) {
View view = button.getCurrentView();
if (view == null || !button.isVisible()) {
return;
}
+ updateButtonLocation(view, inScreenSpace);
+ }
- view.getBoundsOnScreen(mTmpBounds);
- mActiveRegion.op(mTmpBounds, Op.UNION);
+ private void updateButtonLocation(View view, boolean inScreenSpace) {
+ if (inScreenSpace) {
+ view.getBoundsOnScreen(mTmpBounds);
+ } else {
+ view.getLocationInWindow(mTmpPosition);
+ mTmpBounds.set(mTmpPosition[0], mTmpPosition[1],
+ mTmpPosition[0] + view.getWidth(),
+ mTmpPosition[1] + view.getHeight());
+ }
+ mTmpRegion.op(mTmpBounds, Op.UNION);
}
private void updateOrientationViews() {