From 9538eea5ff6f8e2183ced81b5b8eac60b0e774ea Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Thu, 13 Nov 2014 14:49:20 -0800 Subject: [PATCH] Ignore accessibility overlays during visible window computation Previously, the conditional for checking the layer type before accounting for the window bounds was incorrectly inverted, but we can simplify by just skipping accessibility overlay windows completely. BUG: 18358878 BUG: 18359820 BUG: 18359788 Change-Id: I9ba1e43a0fef4fa40693bd8c7e883c2ef45b4c4d --- .../server/wm/AccessibilityController.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index f947b6ab86541..7e6da8b578b0e 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -984,12 +984,7 @@ final class AccessibilityController { final int visibleWindowCount = visibleWindows.size(); for (int i = visibleWindowCount - 1; i >= 0; i--) { - WindowState windowState = visibleWindows.valueAt(i); - - // Compute the bounds in the screen. - Rect boundsInScreen = mTempRect; - computeWindowBoundsInScreen(windowState, boundsInScreen); - + final WindowState windowState = visibleWindows.valueAt(i); final int flags = windowState.mAttrs.flags; // If the window is not touchable - ignore. @@ -997,6 +992,16 @@ final class AccessibilityController { continue; } + // If the window is an accessibility overlay - ignore. + if (windowState.mAttrs.type == + WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY) { + continue; + } + + // Compute the bounds in the screen. + final Rect boundsInScreen = mTempRect; + computeWindowBoundsInScreen(windowState, boundsInScreen); + // If the window is completely covered by other windows - ignore. if (unaccountedSpace.quickReject(boundsInScreen)) { continue; @@ -1013,14 +1018,8 @@ final class AccessibilityController { } } - // Account for the space this window takes if the window - // is not an accessibility overlay which does not change - // the reported windows. - if (windowState.mAttrs.type == WindowManager.LayoutParams - .TYPE_ACCESSIBILITY_OVERLAY) { - unaccountedSpace.op(boundsInScreen, unaccountedSpace, - Region.Op.REVERSE_DIFFERENCE); - } + unaccountedSpace.op(boundsInScreen, unaccountedSpace, + Region.Op.REVERSE_DIFFERENCE); // We figured out what is touchable for the entire screen - done. if (unaccountedSpace.isEmpty()) {