Merge "Prevent windows of embedding activities excluded from a11y" into sc-v2-dev am: 64f6df94e3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15762966

Change-Id: Iaf2c90a723c1b479f6e2f096963e43f98adf92f2
This commit is contained in:
Louis Chang
2021-09-13 03:14:46 +00:00
committed by Automerger Merge Worker

View File

@@ -1701,7 +1701,7 @@ final class AccessibilityController {
boolean focusedWindowAdded = false; boolean focusedWindowAdded = false;
final int visibleWindowCount = visibleWindows.size(); final int visibleWindowCount = visibleWindows.size();
HashSet<Integer> skipRemainingWindowsForTasks = new HashSet<>(); ArrayList<TaskFragment> skipRemainingWindowsForTaskFragments = new ArrayList<>();
ArrayList<ShellRoot> shellRoots = getSortedShellRoots(dc.mShellRoots); ArrayList<ShellRoot> shellRoots = getSortedShellRoots(dc.mShellRoots);
@@ -1723,10 +1723,10 @@ final class AccessibilityController {
computeWindowRegionInScreen(windowState, regionInScreen); computeWindowRegionInScreen(windowState, regionInScreen);
if (windowMattersToAccessibility(windowState, regionInScreen, unaccountedSpace, if (windowMattersToAccessibility(windowState, regionInScreen, unaccountedSpace,
skipRemainingWindowsForTasks)) { skipRemainingWindowsForTaskFragments)) {
addPopulatedWindowInfo(windowState, regionInScreen, windows, addedWindows); addPopulatedWindowInfo(windowState, regionInScreen, windows, addedWindows);
updateUnaccountedSpace(windowState, regionInScreen, unaccountedSpace, updateUnaccountedSpace(windowState, regionInScreen, unaccountedSpace,
skipRemainingWindowsForTasks); skipRemainingWindowsForTaskFragments);
focusedWindowAdded |= windowState.isFocused(); focusedWindowAdded |= windowState.isFocused();
} else if (isUntouchableNavigationBar(windowState, mTempRegion1)) { } 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
@@ -1782,7 +1782,7 @@ final class AccessibilityController {
private boolean windowMattersToAccessibility(WindowState windowState, private boolean windowMattersToAccessibility(WindowState windowState,
Region regionInScreen, Region unaccountedSpace, Region regionInScreen, Region unaccountedSpace,
HashSet<Integer> skipRemainingWindowsForTasks) { ArrayList<TaskFragment> skipRemainingWindowsForTaskFragments) {
final RecentsAnimationController controller = mService.getRecentsAnimationController(); final RecentsAnimationController controller = mService.getRecentsAnimationController();
if (controller != null && controller.shouldIgnoreForAccessibility(windowState)) { if (controller != null && controller.shouldIgnoreForAccessibility(windowState)) {
return false; return false;
@@ -1793,8 +1793,9 @@ final class AccessibilityController {
} }
// If the window is part of a task that we're finished with - ignore. // If the window is part of a task that we're finished with - ignore.
final Task task = windowState.getTask(); final TaskFragment taskFragment = windowState.getTaskFragment();
if (task != null && skipRemainingWindowsForTasks.contains(task.mTaskId)) { if (taskFragment != null
&& skipRemainingWindowsForTaskFragments.contains(taskFragment)) {
return false; return false;
} }
@@ -1820,7 +1821,8 @@ final class AccessibilityController {
} }
private void updateUnaccountedSpace(WindowState windowState, Region regionInScreen, private void updateUnaccountedSpace(WindowState windowState, Region regionInScreen,
Region unaccountedSpace, HashSet<Integer> skipRemainingWindowsForTasks) { Region unaccountedSpace,
ArrayList<TaskFragment> skipRemainingWindowsForTaskFragments) {
if (windowState.mAttrs.type if (windowState.mAttrs.type
!= WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY) { != WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY) {
@@ -1850,11 +1852,11 @@ final class AccessibilityController {
Region.Op.REVERSE_DIFFERENCE); Region.Op.REVERSE_DIFFERENCE);
} }
final Task task = windowState.getTask(); final TaskFragment taskFragment = windowState.getTaskFragment();
if (task != null) { if (taskFragment != null) {
// If the window is associated with a particular task, we can skip the // If the window is associated with a particular task, we can skip the
// rest of the windows for that task. // rest of the windows for that task.
skipRemainingWindowsForTasks.add(task.mTaskId); skipRemainingWindowsForTaskFragments.add(taskFragment);
} else if (!windowState.hasTapExcludeRegion()) { } else if (!windowState.hasTapExcludeRegion()) {
// If the window is not associated with a particular task, then it is // If the window is not associated with a particular task, then it is
// globally modal. In this case we can skip all remaining windows when // globally modal. In this case we can skip all remaining windows when