Loading services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class AccessibilityWindowManager { private static int sNextWindowId; private final Region mTmpRegion = new Region(); private final Object mLock; private final Handler mHandler; private final WindowManagerInternal mWindowManagerInternal; Loading Loading @@ -613,7 +615,7 @@ public class AccessibilityWindowManager { } // If the window is completely covered by other windows - ignore. if (unaccountedSpace.quickReject(regionInScreen)) { if (!mTmpRegion.op(unaccountedSpace, regionInScreen, Region.Op.INTERSECT)) { return false; } Loading services/tests/servicestests/src/com/android/server/accessibility/AccessibilityWindowManagerWithAccessibilityWindowTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -469,6 +469,27 @@ public class AccessibilityWindowManagerWithAccessibilityWindowTest { assertEquals(bounds, embeddingBounds); } @Test public void onWindowsChanged_shouldNotReportfullyOccludedWindow() { final AccessibilityWindow frontWindow = mWindows.get(Display.DEFAULT_DISPLAY).get(0); setRegionForMockAccessibilityWindow(frontWindow, new Region(100, 100, 300, 300)); final int frontWindowId = mA11yWindowManager.findWindowIdLocked( USER_SYSTEM_ID, frontWindow.getWindowInfo().token); // index 1 is focused. Let's use the next one for this test. final AccessibilityWindow occludedWindow = mWindows.get(Display.DEFAULT_DISPLAY).get(2); setRegionForMockAccessibilityWindow(occludedWindow, new Region(150, 150, 250, 250)); final int occludedWindowId = mA11yWindowManager.findWindowIdLocked( USER_SYSTEM_ID, occludedWindow.getWindowInfo().token); onAccessibilityWindowsChanged(Display.DEFAULT_DISPLAY, SEND_ON_WINDOW_CHANGES); final List<AccessibilityWindowInfo> a11yWindows = mA11yWindowManager.getWindowListLocked(Display.DEFAULT_DISPLAY); assertThat(a11yWindows, hasItem(windowId(frontWindowId))); assertThat(a11yWindows, not(hasItem(windowId(occludedWindowId)))); } @Test public void onWindowsChangedAndForceSend_shouldUpdateWindows() { assertNotEquals("new title", Loading Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class AccessibilityWindowManager { private static int sNextWindowId; private final Region mTmpRegion = new Region(); private final Object mLock; private final Handler mHandler; private final WindowManagerInternal mWindowManagerInternal; Loading Loading @@ -613,7 +615,7 @@ public class AccessibilityWindowManager { } // If the window is completely covered by other windows - ignore. if (unaccountedSpace.quickReject(regionInScreen)) { if (!mTmpRegion.op(unaccountedSpace, regionInScreen, Region.Op.INTERSECT)) { return false; } Loading
services/tests/servicestests/src/com/android/server/accessibility/AccessibilityWindowManagerWithAccessibilityWindowTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -469,6 +469,27 @@ public class AccessibilityWindowManagerWithAccessibilityWindowTest { assertEquals(bounds, embeddingBounds); } @Test public void onWindowsChanged_shouldNotReportfullyOccludedWindow() { final AccessibilityWindow frontWindow = mWindows.get(Display.DEFAULT_DISPLAY).get(0); setRegionForMockAccessibilityWindow(frontWindow, new Region(100, 100, 300, 300)); final int frontWindowId = mA11yWindowManager.findWindowIdLocked( USER_SYSTEM_ID, frontWindow.getWindowInfo().token); // index 1 is focused. Let's use the next one for this test. final AccessibilityWindow occludedWindow = mWindows.get(Display.DEFAULT_DISPLAY).get(2); setRegionForMockAccessibilityWindow(occludedWindow, new Region(150, 150, 250, 250)); final int occludedWindowId = mA11yWindowManager.findWindowIdLocked( USER_SYSTEM_ID, occludedWindow.getWindowInfo().token); onAccessibilityWindowsChanged(Display.DEFAULT_DISPLAY, SEND_ON_WINDOW_CHANGES); final List<AccessibilityWindowInfo> a11yWindows = mA11yWindowManager.getWindowListLocked(Display.DEFAULT_DISPLAY); assertThat(a11yWindows, hasItem(windowId(frontWindowId))); assertThat(a11yWindows, not(hasItem(windowId(occludedWindowId)))); } @Test public void onWindowsChangedAndForceSend_shouldUpdateWindows() { assertNotEquals("new title", Loading