Merge "Fix double-tap with non-accessibility focus behavior"

This commit is contained in:
Ryan Lin
2021-08-03 06:21:43 +00:00
committed by Android (Google) Code Review
3 changed files with 11 additions and 14 deletions

View File

@@ -1322,7 +1322,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
*/
public boolean accessibilityFocusOnlyInActiveWindow() {
synchronized (mLock) {
return mA11yWindowManager.isTrackingWindowsLocked();
return mA11yWindowManager.accessibilityFocusOnlyInActiveWindowLocked();
}
}

View File

@@ -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.
*

View File

@@ -98,7 +98,6 @@ public class TouchState {
mLastReceivedEvent.recycle();
mLastReceivedEvent = null;
}
mLastTouchedWindowId = -1;
mReceivedPointerTracker.clear();
mInjectedPointersDown = 0;
}