Merge "Make sure focused window is tracked by accessibility even if it is obscured." into qt-dev
am: f84cc965fe

Change-Id: I100bacbecefca5c809442304170f19610af398f5
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index 0ebd092..6ce42ec 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -1132,7 +1132,7 @@
                 HashSet<Integer> skipRemainingWindowsForTasks = new HashSet<>();
 
                 // Iterate until we figure out what is touchable for the entire screen.
-                for (int i = visibleWindowCount - 1; i >= 0 && !unaccountedSpace.isEmpty(); i--) {
+                for (int i = visibleWindowCount - 1; i >= 0; i--) {
                     final WindowState windowState = visibleWindows.valueAt(i);
 
                     final Rect boundsInScreen = mTempRect;
@@ -1143,6 +1143,11 @@
                         addPopulatedWindowInfo(windowState, boundsInScreen, windows, addedWindows);
                         updateUnaccountedSpace(windowState, boundsInScreen, unaccountedSpace,
                                 skipRemainingWindowsForTasks);
+                        focusedWindowAdded |= windowState.isFocused();
+                    }
+
+                    if (unaccountedSpace.isEmpty() && focusedWindowAdded) {
+                        break;
                     }
                 }