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

Commit 3fde3511 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 am: 5901d395 am: 2ea16294 am: 36be1b22

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



Change-Id: I4946076f84b1ce55946752def0c2ca6f21b94158
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 147852e4 36be1b22
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1673,7 +1673,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
@@ -7709,6 +7709,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);