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

Commit 66bf088c authored by Riley Jones's avatar Riley Jones Committed by Android (Google) Code Review
Browse files

Merge "Unlocking getDisplayByUserIdAndWindowId" into main

parents ddedb160 642e621f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -611,12 +611,12 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
        if (svcConnTracingEnabled()) {
            logTraceSvcConn("getWindow", "windowId=" + windowId);
        }
        synchronized (mLock) {
        int displayId = Display.INVALID_DISPLAY;
        if (windowId != AccessibilityWindowInfo.UNDEFINED_WINDOW_ID) {
                displayId = mA11yWindowManager.getDisplayIdByUserIdAndWindowIdLocked(
            displayId = mA11yWindowManager.getDisplayIdByUserIdAndWindowId(
                    mSystemSupport.getCurrentUserIdLocked(), windowId);
        }
        synchronized (mLock) {
            ensureWindowsAvailableTimedLocked(displayId);

            if (!hasRightsToCurrentUserLocked()) {
+7 −8
Original line number Diff line number Diff line
@@ -1261,15 +1261,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            // the computation for performance reasons.
            boolean shouldComputeWindows = false;
            int displayId = event.getDisplayId();
            synchronized (mLock) {
            final int windowId = event.getWindowId();
            if (windowId != AccessibilityWindowInfo.UNDEFINED_WINDOW_ID
                    && displayId == Display.INVALID_DISPLAY) {
                    displayId = mA11yWindowManager.getDisplayIdByUserIdAndWindowIdLocked(
                displayId = mA11yWindowManager.getDisplayIdByUserIdAndWindowId(
                        resolvedUserId, windowId);
                event.setDisplayId(displayId);
            }

            synchronized (mLock) {
                if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
                        && displayId != Display.INVALID_DISPLAY
                        && mA11yWindowManager.isTrackingWindowsLocked(displayId)) {
+5 −2
Original line number Diff line number Diff line
@@ -2038,8 +2038,11 @@ public class AccessibilityWindowManager {
     * @param windowId The windowId
     * @return The display ID
     */
    public int getDisplayIdByUserIdAndWindowIdLocked(int userId, int windowId) {
        final IBinder windowToken = getWindowTokenForUserAndWindowIdLocked(userId, windowId);
    public int getDisplayIdByUserIdAndWindowId(int userId, int windowId) {
        final IBinder windowToken;
        synchronized (mLock) {
            windowToken = getWindowTokenForUserAndWindowIdLocked(userId, windowId);
        }
        if (traceWMEnabled()) {
            logTraceWM("getDisplayIdForWindow", "token=" + windowToken);
        }
+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ public class AbstractAccessibilityServiceConnectionTest {
                .thenReturn(mA11yWindowInfos.get(0));
        when(mMockA11yWindowManager.findA11yWindowInfoByIdLocked(PIP_WINDOWID))
                .thenReturn(mA11yWindowInfos.get(1));
        when(mMockA11yWindowManager.getDisplayIdByUserIdAndWindowIdLocked(USER_ID,
        when(mMockA11yWindowManager.getDisplayIdByUserIdAndWindowId(USER_ID,
            WINDOWID_ONSECONDDISPLAY)).thenReturn(SECONDARY_DISPLAY_ID);
        when(mMockA11yWindowManager.getWindowListLocked(SECONDARY_DISPLAY_ID))
            .thenReturn(mA11yWindowInfosOnSecondDisplay);