Check proxy status when determining whether to track windows
Marking DisplayWindowsObserver as belonging to a proxy when the proxy is registered will not work since the observer may be removed immediately (the proxy service info may not be propagated yet, so a11y is off and tracking is stopped) Mark the observer when the a11y system decides to track windows. Test: manual check with sample app, atest AccessibilityDisplayProxy Bug: 263375218 Change-Id: I3042b0c77b341251c5590d9e9f2fb9677574d128
This commit is contained in:
@@ -2508,7 +2508,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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user