Merge "Check proxy status when determining whether to track windows"

This commit is contained in:
Sally Yuen
2023-01-09 17:16:20 +00:00
committed by Android (Google) Code Review
4 changed files with 7 additions and 18 deletions

View File

@@ -2527,7 +2527,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
final Display display = displays.get(i);
if (display != null) {
if (observingWindows) {
mA11yWindowManager.startTrackingWindows(display.getDisplayId());
mA11yWindowManager.startTrackingWindows(display.getDisplayId(),
mProxyManager.isProxyed(display.getDisplayId()));
} else {
mA11yWindowManager.stopTrackingWindows(display.getDisplayId());
}

View File

@@ -988,12 +988,15 @@ public class AccessibilityWindowManager {
*
* @param displayId The logical display id.
*/
public void startTrackingWindows(int displayId) {
public void startTrackingWindows(int displayId, boolean proxyed) {
synchronized (mLock) {
DisplayWindowsObserver observer = mDisplayWindowsObservers.get(displayId);
if (observer == null) {
observer = new DisplayWindowsObserver(displayId);
}
if (proxyed && !observer.mIsProxy) {
observer.mIsProxy = true;
}
if (observer.isTrackingWindowsLocked()) {
return;
}
@@ -1018,20 +1021,6 @@ public class AccessibilityWindowManager {
}
}
/**
* Starts tracking a display as belonging to a proxy. Creates the window observer if necessary.
* @param displayId
*/
public void startTrackingDisplayProxy(int displayId) {
startTrackingWindows(displayId);
synchronized (mLock) {
DisplayWindowsObserver observer = mDisplayWindowsObservers.get(displayId);
if (observer != null) {
observer.mIsProxy = true;
}
}
}
/**
* Stops tracking a display as belonging to a proxy.
* @param displayId

View File

@@ -103,7 +103,6 @@ public class ProxyManager {
};
client.asBinder().linkToDeath(deathRecipient, 0);
mA11yWindowManager.startTrackingDisplayProxy(displayId);
// Notify apps that the service state has changed.
// A11yManager#A11yServicesStateChangeListener
synchronized (mLock) {

View File

@@ -1019,7 +1019,7 @@ public class AccessibilityWindowManagerTest {
windowInfosForDisplay.get(DEFAULT_FOCUSED_INDEX).focused = true;
}
// Turns on windows tracking, and update window info.
mA11yWindowManager.startTrackingWindows(displayId);
mA11yWindowManager.startTrackingWindows(displayId, false);
// Puts window lists into array.
mWindowInfos.put(displayId, windowInfosForDisplay);
// Sets the default display is the top focused display and