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

Commit 12e1ea6a authored by lucychang's avatar lucychang Committed by Lucy Chang
Browse files

Using windowId from A11yWindowInfo instead

AccessibilityManagerService#getWindowBounds would return null if
using the windowId comes from the embedded hierarchy, and
EventDispatch#computeClickLocation will return CLICK_LOCATION_NONE
and can't perform long-click action. The fix try to use
AccessibilityWindowInfo's windowId to get correct window token to
get window bounds.

Bug: 161857059
Test: a11y CTS & unit tests
Change-Id: I5a978177352e973f06a856826a43910a9b655b29
parent 168d7918
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -941,10 +941,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            if (resolvedUserId != mCurrentUserId) {
                return null;
            }
            if (mA11yWindowManager.findA11yWindowInfoByIdLocked(windowId) == null) {
            final AccessibilityWindowInfo accessibilityWindowInfo = mA11yWindowManager
                    .findA11yWindowInfoByIdLocked(windowId);
            if (accessibilityWindowInfo == null) {
                return null;
            }
            return mA11yWindowManager.getWindowTokenForUserAndWindowIdLocked(userId, windowId);
            // We use AccessibilityWindowInfo#getId instead of windowId. When the windowId comes
            // from an embedded hierarchy, the system can't find correct window token because
            // embedded hierarchy doesn't have windowInfo. Calling
            // AccessibilityWindowManager#findA11yWindowInfoByIdLocked can look for its parent's
            // windowInfo, so it is safer to use AccessibilityWindowInfo#getId
            // to get window token to find real window.
            return mA11yWindowManager.getWindowTokenForUserAndWindowIdLocked(userId,
                    accessibilityWindowInfo.getId());
        }
    }