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

Commit 58c3e8fd authored by Louis Chang's avatar Louis Chang
Browse files

Fix NullPointerException when the focused window has no activity

Bug: 354616175
Test: SimpleSaveActivityTest
Flag: EXEMPT bugfix
Change-Id: Id2b25b9472cf16a0ad23d80b4d4a739928e71def
parent de912328
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -9446,8 +9446,13 @@ public class WindowManagerService extends IWindowManager.Stub
     * Returns {@code true} if the focused window is changed. Otherwise, returns {@code false}.
     */
    boolean moveFocusToAdjacentEmbeddedWindow(@NonNull WindowState focusedWindow) {
        final ActivityRecord activity = focusedWindow.getActivityRecord();
        if (activity == null) {
            return false;
        }

        final ActivityRecord mostRecentActivityInAdjacent = getMostRecentActivityInAdjacent(
                focusedWindow.getActivityRecord());
                activity);

        moveFocusToActivity(mostRecentActivityInAdjacent);
        return !focusedWindow.isFocused();