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

Commit fcba2537 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Fallback to focused window state if input focus target is not a window" into main

parents 008772e7 9e2c5762
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -1226,8 +1226,21 @@ final class AccessibilityController {
                // Gets the top focused display Id and window token for supporting multi-display.
                if (Flags.useInputReportedFocusForAccessibility()) {
                    topFocusedDisplayId = mAccessibilityController.mFocusedDisplay;
                    topFocusedWindowToken = mAccessibilityController.mFocusedWindow.get(
                    final IBinder focusedInputToken = mAccessibilityController.mFocusedWindow.get(
                            topFocusedDisplayId);
                    if (focusedInputToken != null) {
                        topFocusedWindowToken = focusedInputToken;
                    } else {
                        // If there is no focused target as reported by input, then fall back to the
                        // currently focused window in WM (if it exists). This can happen if there
                        // are other input windows that are focused that are neither WindowStates
                        // nor EmbeddedWindows (ie. input consumers)
                        final WindowState topFocusedWindowState =
                                mService.mRoot.getDisplayContent(topFocusedDisplayId).mCurrentFocus;
                        topFocusedWindowToken = topFocusedWindowState != null
                                ? topFocusedWindowState.mClient.asBinder()
                                : null;
                    }
                } else {
                    final WindowState topFocusedWindowState =
                            mService.mRoot.getTopFocusedDisplayContent().mCurrentFocus;