Merge "Fix touchable region calculation in NavigationBarController" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-07 14:04:29 +00:00
committed by Android (Google) Code Review

View File

@@ -259,23 +259,22 @@ final class NavigationBarController {
switch (originalInsets.touchableInsets) { switch (originalInsets.touchableInsets) {
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME: case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME:
if (inputFrame.getVisibility() == View.VISIBLE) { if (inputFrame.getVisibility() == View.VISIBLE) {
touchableRegion = new Region(inputFrame.getLeft(), inputFrame.getBoundsOnScreen(mTempRect);
inputFrame.getTop(), inputFrame.getRight(), touchableRegion = new Region(mTempRect);
inputFrame.getBottom());
} }
break; break;
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT: case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT:
if (inputFrame.getVisibility() == View.VISIBLE) { if (inputFrame.getVisibility() == View.VISIBLE) {
touchableRegion = new Region(inputFrame.getLeft(), inputFrame.getBoundsOnScreen(mTempRect);
originalInsets.contentTopInsets, inputFrame.getRight(), mTempRect.top = originalInsets.contentTopInsets;
inputFrame.getBottom()); touchableRegion = new Region(mTempRect);
} }
break; break;
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE: case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE:
if (inputFrame.getVisibility() == View.VISIBLE) { if (inputFrame.getVisibility() == View.VISIBLE) {
touchableRegion = new Region(inputFrame.getLeft(), inputFrame.getBoundsOnScreen(mTempRect);
originalInsets.visibleTopInsets, inputFrame.getRight(), mTempRect.top = originalInsets.visibleTopInsets;
inputFrame.getBottom()); touchableRegion = new Region(mTempRect);
} }
break; break;
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION: case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION:
@@ -283,6 +282,7 @@ final class NavigationBarController {
touchableRegion.set(originalInsets.touchableRegion); touchableRegion.set(originalInsets.touchableRegion);
break; break;
} }
// Hereafter "mTempRect" means a navigation bar rect.
mTempRect.set(decor.getLeft(), decor.getBottom() - systemInsets.bottom, mTempRect.set(decor.getLeft(), decor.getBottom() - systemInsets.bottom,
decor.getRight(), decor.getBottom()); decor.getRight(), decor.getBottom());
if (touchableRegion == null) { if (touchableRegion == null) {