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

Commit bf9de65b 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: TaskFragmentTest
Flag: EXEMPT bugfix
Change-Id: I5d30f8f29514a49633d846824bc7565dc7083f0e
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;
        }

+2 −0
Original line number Diff line number Diff line
@@ -1172,7 +1172,9 @@ public class TaskFragmentTest extends WindowTestsBase {
        final ActivityRecord appLeftBottom = taskFragmentLeft.getBottomMostActivity();
        final ActivityRecord appRightTop = taskFragmentRight.getTopMostActivity();
        appLeftTop.setVisibleRequested(true);
        appLeftTop.setVisible(true);
        appRightTop.setVisibleRequested(true);
        appRightTop.setVisible(true);
        final WindowState winLeftTop = createAppWindow(appLeftTop, "winLeftTop");
        final WindowState winLeftBottom = createAppWindow(appLeftBottom, "winLeftBottom");
        final WindowState winRightTop = createAppWindow(appRightTop, "winRightTop");