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

Commit 4d0431dd authored by Louis Chang's avatar Louis Chang
Browse files

Avoid calling syncInputTransactions within wm lock

It is possible to block wm lock for 5 seconds, waiting for sync
input transaction.

Also avoid move focus to the adjacent embedded window when the
adjacent activity is not yet visible.

Bug: 436971500
Test: wm presubmit
Flag: EXEMPT bugfix
Change-Id: I70992c1d0d22d400fb83d05f32cb27a5559bc69d
parent 0e81c75a
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -9055,6 +9055,7 @@ public class WindowManagerService extends IWindowManager.Stub

        @Override
        public boolean moveFocusToAdjacentEmbeddedActivityIfNeeded() {
            boolean focusMoved = false;
            synchronized (mGlobalLock) {
                final WindowState focusedWindow = getFocusedWindow();
                if (focusedWindow == null) {
@@ -9063,12 +9064,14 @@ public class WindowManagerService extends IWindowManager.Stub

                if (moveFocusToAdjacentEmbeddedWindow(focusedWindow)) {
                    // Sync the input transactions to ensure the input focus updates as well.
                    syncInputTransactions(false);
                    return true;
                    focusMoved = true;
                }
            }

                return false;
            if (focusMoved) {
                syncInputTransactions(false);
            }
            return focusMoved;
        }

        @Override
@@ -9765,7 +9768,7 @@ public class WindowManagerService extends IWindowManager.Stub
     */
    boolean moveFocusToAdjacentEmbeddedWindow(@NonNull WindowState focusedWindow) {
        final ActivityRecord activity = focusedWindow.getActivityRecord();
        if (activity == null) {
        if (activity == null || !activity.isVisible()) {
            return false;
        }