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

Commit 075dd343 authored by ryanlwlin's avatar ryanlwlin
Browse files

Fix double-tap with non-accessibility focus behavior

we inject evetns to the location of hover events when satisifying
the following conditions
1. accessibility-focus node could be in any window or last touch window
   is an active window
2. no accessibility focus node

We reset last touch window id when user interaction is end. It leads to
failure if there is no service could interactive with windows.

To fix it, we don't reset the window id in such condition.

Bug: 194489345
Test: atest TouchExplorerTest
Change-Id: Ia0805eee1ca78254a7e73b63b19c4c2b2769effa
parent 3b7391c2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1322,7 +1322,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
     */
    public boolean accessibilityFocusOnlyInActiveWindow() {
        synchronized (mLock) {
            return mA11yWindowManager.isTrackingWindowsLocked();
            return mA11yWindowManager.accessibilityFocusOnlyInActiveWindowLocked();
        }
    }

+10 −12
Original line number Diff line number Diff line
@@ -1383,20 +1383,9 @@ public class AccessibilityWindowManager {
            // the touched window are delivered is fine.
            final int oldActiveWindow = mActiveWindowId;
            setActiveWindowLocked(mTopFocusedWindowId);

            // If there is no service that can operate with interactive windows
            // then we keep the old behavior where a window loses accessibility
            // focus if it is no longer active. This still changes the behavior
            // for services that do not operate with interactive windows and run
            // at the same time as the one(s) which does. In practice however,
            // there is only one service that uses accessibility focus and it
            // is typically the one that operates with interactive windows, So,
            // this is fine. Note that to allow a service to work across windows
            // we have to allow accessibility focus stay in any of them. Sigh...
            final boolean accessibilityFocusOnlyInActiveWindow = !isTrackingWindowsLocked();
            if (oldActiveWindow != mActiveWindowId
                    && mAccessibilityFocusedWindowId == oldActiveWindow
                    && accessibilityFocusOnlyInActiveWindow) {
                    && accessibilityFocusOnlyInActiveWindowLocked()) {
                clearAccessibilityFocusLocked(oldActiveWindow);
            }
        }
@@ -1617,6 +1606,15 @@ public class AccessibilityWindowManager {
        return displayList;
    }

    // If there is no service that can operate with interactive windows
    // then a window loses accessibility focus if it is no longer active.
    // This inspection happens when the user interaction is ended.
    // Note that to allow a service to work across windows,
    // we have to allow accessibility focus stay in any of them.
    boolean accessibilityFocusOnlyInActiveWindowLocked() {
        return !isTrackingWindowsLocked();
    }

    /**
     * Gets current input focused window token from window manager, and returns its windowId.
     *
+0 −1
Original line number Diff line number Diff line
@@ -98,7 +98,6 @@ public class TouchState {
            mLastReceivedEvent.recycle();
            mLastReceivedEvent = null;
        }
        mLastTouchedWindowId = -1;
        mReceivedPointerTracker.clear();
        mInjectedPointersDown = 0;
    }