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

Commit 96d6d7aa authored by Rhed Jao's avatar Rhed Jao Committed by Android (Google) Code Review
Browse files

Merge "Update active window when a11y client is removed"

parents d57554e4 6c8a43b6
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -777,6 +777,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            final int removedWindowId = removeAccessibilityInteractionConnectionInternalLocked(
                    token, mGlobalWindowTokens, mGlobalInteractionConnections);
            if (removedWindowId >= 0) {
                mSecurityPolicy.onAccessibilityClientRemovedLocked(removedWindowId);
                if (DEBUG) {
                    Slog.i(LOG_TAG, "Removed global connection for pid:" + Binder.getCallingPid()
                            + " with windowId: " + removedWindowId + " and token: " + window.asBinder());
@@ -790,6 +791,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                        removeAccessibilityInteractionConnectionInternalLocked(
                        token, userState.mWindowTokens, userState.mInteractionConnections);
                if (removedWindowIdForUser >= 0) {
                    mSecurityPolicy.onAccessibilityClientRemovedLocked(removedWindowIdForUser);
                    if (DEBUG) {
                        Slog.i(LOG_TAG, "Removed user connection for pid:" + Binder.getCallingPid()
                                + " with windowId: " + removedWindowIdForUser + " and userId:"
@@ -1332,6 +1334,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            userState.mWindowTokens.remove(windowId);
            userState.mInteractionConnections.remove(windowId);
        }
        mSecurityPolicy.onAccessibilityClientRemovedLocked(windowId);
        if (DEBUG) {
            Slog.i(LOG_TAG, "Removing interaction connection to windowId: " + windowId);
        }
@@ -3266,6 +3269,18 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            mWindows = null;
        }

        /**
         * A callback when accessibility interaction client is removed.
         */
        public void onAccessibilityClientRemovedLocked(int windowId) {
            // Active window cannot update immediately, if windows callback is unregistered.
            // Update active window to invalid, when its a11y interaction client is removed.
            if (mWindowsForAccessibilityCallback == null && windowId >= 0
                    && mActiveWindowId == windowId) {
                mActiveWindowId = INVALID_WINDOW_ID;
            }
        }

        public void updateWindowsLocked(List<WindowInfo> windows) {
            if (mWindows == null) {
                mWindows = new ArrayList<>();