Update Window List when the windowToken is moved

When a window is moved from display A to display B. We don't have any callbacks
to update window list of A and B. We update window list when the displaycont of
windowtoken is changed.

Bug: 140277818
Test: AccessibilityEndToEndTest
Change-Id: I3f9cc34ec3f24178df33bcc632e6af33b6dc3e7c
This commit is contained in:
RyanlwLin
2019-08-30 15:08:48 +08:00
committed by Ryan Lin
parent b3bd7b19bd
commit 925e822dec
2 changed files with 18 additions and 6 deletions

View File

@@ -255,13 +255,19 @@ final class AccessibilityController {
}
}
public void onSomeWindowResizedOrMovedLocked(int displayId) {
/**
* Called when the location or the size of the window is changed. Moving the window to
* another display is also taken into consideration.
* @param displayIds the display ids of displays when the situation happens.
*/
public void onSomeWindowResizedOrMovedLocked(int... displayIds) {
// Not relevant for the display magnifier.
final WindowsForAccessibilityObserver windowsForA11yObserver =
mWindowsForAccessibilityObserver.get(displayId);
if (windowsForA11yObserver != null) {
windowsForA11yObserver.scheduleComputeChangedWindowsLocked();
for (int i = 0; i < displayIds.length; i++) {
final WindowsForAccessibilityObserver windowsForA11yObserver =
mWindowsForAccessibilityObserver.get(displayIds[i]);
if (windowsForA11yObserver != null) {
windowsForA11yObserver.scheduleComputeChangedWindowsLocked();
}
}
}

View File

@@ -1062,6 +1062,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
}
addWindowToken(token.token, token);
if (mWmService.mAccessibilityController != null) {
final int prevDisplayId = prevDc != null ? prevDc.getDisplayId() : INVALID_DISPLAY;
mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(prevDisplayId,
getDisplayId());
}
}
void removeAppToken(IBinder binder) {