Merge "Fix hardly triggering A11y shortcut via gesture when zoom in" into rvc-dev am: 7e96fc8087 am: 2f9026a5df

Change-Id: I8ff55c27d0490f854e797bef5deaf194977f4d65
This commit is contained in:
Ryan Lin
2020-04-15 01:04:58 +00:00
committed by Automerger Merge Worker

View File

@@ -674,6 +674,15 @@ final class AccessibilityController {
availableBounds.op(windowBounds, Region.Op.DIFFERENCE); availableBounds.op(windowBounds, Region.Op.DIFFERENCE);
} }
// If the navigation bar window doesn't have touchable region, count
// navigation bar insets into nonMagnifiedBounds. It happens when
// navigation mode is gestural.
if (isUntouchableNavigationBar(windowState, mTempRegion3)) {
final Rect navBarInsets = getNavBarInsets(mDisplayContent);
nonMagnifiedBounds.op(navBarInsets, Region.Op.UNION);
availableBounds.op(navBarInsets, Region.Op.DIFFERENCE);
}
// Count letterbox into nonMagnifiedBounds // Count letterbox into nonMagnifiedBounds
if (windowState.isLetterboxedForDisplayCutoutLw()) { if (windowState.isLetterboxedForDisplayCutoutLw()) {
Region letterboxBounds = getLetterboxBounds(windowState); Region letterboxBounds = getLetterboxBounds(windowState);
@@ -1091,6 +1100,24 @@ final class AccessibilityController {
} }
} }
static boolean isUntouchableNavigationBar(WindowState windowState,
Region touchableRegion) {
if (windowState.mAttrs.type != WindowManager.LayoutParams.TYPE_NAVIGATION_BAR) {
return false;
}
// Gets the touchable region.
windowState.getTouchableRegion(touchableRegion);
return touchableRegion.isEmpty();
}
static Rect getNavBarInsets(DisplayContent displayContent) {
final InsetsState insetsState =
displayContent.getInsetsStateController().getRawInsetsState();
return insetsState.getSource(ITYPE_NAVIGATION_BAR).getFrame();
}
/** /**
* This class encapsulates the functionality related to computing the windows * This class encapsulates the functionality related to computing the windows
* reported for accessibility purposes. These windows are all windows a sighted * reported for accessibility purposes. These windows are all windows a sighted
@@ -1205,16 +1232,12 @@ final class AccessibilityController {
updateUnaccountedSpace(windowState, regionInScreen, unaccountedSpace, updateUnaccountedSpace(windowState, regionInScreen, unaccountedSpace,
skipRemainingWindowsForTasks); skipRemainingWindowsForTasks);
focusedWindowAdded |= windowState.isFocused(); focusedWindowAdded |= windowState.isFocused();
} else if (isUntouchableNavigationBar(windowState)) { } else if (isUntouchableNavigationBar(windowState, mTempRegion1)) {
// If this widow is navigation bar without touchable region, accounting the // If this widow is navigation bar without touchable region, accounting the
// region of navigation bar inset because all touch events from this region // region of navigation bar inset because all touch events from this region
// would be received by launcher, i.e. this region is a un-touchable one // would be received by launcher, i.e. this region is a un-touchable one
// for the application. // for the application.
final InsetsState insetsState = unaccountedSpace.op(getNavBarInsets(dc), unaccountedSpace,
dc.getInsetsStateController().getRawInsetsState();
final Rect displayFrame =
insetsState.getSource(ITYPE_NAVIGATION_BAR).getFrame();
unaccountedSpace.op(displayFrame, unaccountedSpace,
Region.Op.REVERSE_DIFFERENCE); Region.Op.REVERSE_DIFFERENCE);
} }
@@ -1294,18 +1317,6 @@ final class AccessibilityController {
return false; return false;
} }
private boolean isUntouchableNavigationBar(WindowState windowState) {
if (windowState.mAttrs.type != WindowManager.LayoutParams.TYPE_NAVIGATION_BAR) {
return false;
}
// Gets the touchable region.
Region touchableRegion = mTempRegion1;
windowState.getTouchableRegion(touchableRegion);
return touchableRegion.isEmpty();
}
private void updateUnaccountedSpace(WindowState windowState, Region regionInScreen, private void updateUnaccountedSpace(WindowState windowState, Region regionInScreen,
Region unaccountedSpace, HashSet<Integer> skipRemainingWindowsForTasks) { Region unaccountedSpace, HashSet<Integer> skipRemainingWindowsForTasks) {
if (windowState.mAttrs.type if (windowState.mAttrs.type