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

Commit 4d48ea00 authored by Ryan Lin's avatar Ryan Lin Committed by Automerger Merge Worker
Browse files

Merge "Fix invalid active window if accessibility framework doesn't track...

Merge "Fix invalid active window if accessibility framework doesn't track windows" into tm-dev am: a7f5aa5b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17755779



Change-Id: I107011e3545a40d25b02991333d919606e93c596
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents ecf6e4fb a7f5aa5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1661,7 +1661,7 @@ public class AccessibilityWindowManager {
        if (traceWMEnabled()) {
            logTraceWM("getFocusedWindowToken", "");
        }
        final IBinder token = mWindowManagerInternal.getFocusedWindowToken();
        final IBinder token = mWindowManagerInternal.getFocusedWindowTokenFromWindowStates();
        synchronized (mLock) {
            return findWindowIdLocked(userId, token);
        }
+8 −0
Original line number Diff line number Diff line
@@ -432,6 +432,14 @@ public abstract class WindowManagerInternal {
     */
    public abstract IBinder getFocusedWindowToken();

    /**
     * Gets the token of the window that has input focus. It is from the focused
     * {@link WindowState}.
     *
     * @return The token.
     */
    public abstract IBinder getFocusedWindowTokenFromWindowStates();

    /**
     * @return Whether the keyguard is engaged.
     */
+12 −0
Original line number Diff line number Diff line
@@ -7681,6 +7681,18 @@ public class WindowManagerService extends IWindowManager.Stub
            }
        }

        // TODO (b/229837707): Delete this method after changing the solution.
        @Override
        public IBinder getFocusedWindowTokenFromWindowStates() {
            synchronized (mGlobalLock) {
                final WindowState windowState = getFocusedWindowLocked();
                if (windowState != null) {
                    return windowState.mClient.asBinder();
                }
                return null;
            }
        }

        @Override
        public boolean isKeyguardLocked() {
            return WindowManagerService.this.isKeyguardLocked();
+2 −2
Original line number Diff line number Diff line
@@ -543,7 +543,7 @@ public class AccessibilityWindowManagerTest {
                mWindowInfos.get(Display.DEFAULT_DISPLAY).get(DEFAULT_FOCUSED_INDEX + 1).token;
        final int eventWindowId = mA11yWindowManager.findWindowIdLocked(
                USER_SYSTEM_ID, eventWindowToken);
        when(mMockWindowManagerInternal.getFocusedWindowToken())
        when(mMockWindowManagerInternal.getFocusedWindowTokenFromWindowStates())
                .thenReturn(eventWindowToken);

        final int noUse = 0;
@@ -679,7 +679,7 @@ public class AccessibilityWindowManagerTest {
                mWindowInfos.get(Display.DEFAULT_DISPLAY).get(DEFAULT_FOCUSED_INDEX).token;
        final int defaultFocusWindowId = mA11yWindowManager.findWindowIdLocked(
                USER_SYSTEM_ID, defaultFocusWinToken);
        when(mMockWindowManagerInternal.getFocusedWindowToken())
        when(mMockWindowManagerInternal.getFocusedWindowTokenFromWindowStates())
                .thenReturn(defaultFocusWinToken);
        final int newFocusWindowId = getWindowIdFromWindowInfosForDisplay(Display.DEFAULT_DISPLAY,
                DEFAULT_FOCUSED_INDEX + 1);