Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3f01c73 authored by sallyyuen's avatar sallyyuen
Browse files

Clear caches when an A11yDisplayProxy is registered.

This removes any cached instances of the display and its windows
that now belong to the proxy.

Test: atestAccessibilityDisplayProxyTest
Bug: 241429275
Change-Id: Ie81eb4cd99d3732eeb69f28d4987ce01e734fabf
parent 501fb286
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1757,6 +1757,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            AccessibilityServiceConnection service = state.mBoundServices.get(i);
            service.notifyClearAccessibilityNodeInfoCache();
        }

        mProxyManager.clearCacheLocked();
    }

    private void notifyMagnificationChangedLocked(int displayId, @NonNull Region region,
@@ -3700,6 +3702,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        mProxyManager.registerProxy(client, displayId, mContext,
                sIdCounter++, mMainHandler, mSecurityPolicy, this, getTraceManager(),
                mWindowManagerService, mA11yWindowManager);

        synchronized (mLock) {
            notifyClearAccessibilityCacheLocked();
        }
        return true;
    }

+11 −0
Original line number Diff line number Diff line
@@ -235,4 +235,15 @@ public class ProxyManager {
            }
        }
    }

    /**
     * Clears all proxy caches.
     */
    public void clearCacheLocked() {
        for (int i = 0; i < mProxyA11yServiceConnections.size(); i++) {
            final ProxyAccessibilityServiceConnection proxy =
                    mProxyA11yServiceConnections.valueAt(i);
            proxy.notifyClearAccessibilityNodeInfoCache();
        }
    }
}
 No newline at end of file