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

Commit 747ece1e authored by Orhan Uysal's avatar Orhan Uysal
Browse files

If the rootTaskIdsToRestore is empty...

on user switch, restore the home task to the top for the user. This
happens when the home task belongs to the system user and is visible to
a secondary user.

Test: atest RootWindowContainerTest & manual
Bug: 391501236
Flag: com.android.window.flags.enable_top_visible_root_task_per_user_tracking
Change-Id: I345dc1b965cc21e5cbb12a6ee4dade79927eb696
parent ea66f9f4
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1948,7 +1948,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        final IntArray rootTaskIdsToRestore = mUserVisibleRootTasks.get(userId);
        boolean homeInFront = false;
        if (Flags.enableTopVisibleRootTaskPerUserTracking()) {
            if (rootTaskIdsToRestore == null) {
            if (rootTaskIdsToRestore == null || rootTaskIdsToRestore.size() == 0) {
                // If there are no root tasks saved, try restore id 0 which should create and launch
                // the home task.
                handleRootTaskLaunchOnUserSwitch(/* restoreRootTaskId */INVALID_TASK_ID);
@@ -1958,12 +1958,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                    handleRootTaskLaunchOnUserSwitch(rootTaskIdsToRestore.get(i));
                }
                // Check if the top task is type home
                if (rootTaskIdsToRestore.size() > 0) {
                    final int topRootTaskId = rootTaskIdsToRestore.get(
                            rootTaskIdsToRestore.size() - 1);
                final int topRootTaskId = rootTaskIdsToRestore.get(rootTaskIdsToRestore.size() - 1);
                homeInFront = isHomeTask(topRootTaskId);
            }
            }
        } else {
            handleRootTaskLaunchOnUserSwitch(restoreRootTaskId);
            // Check if the top task is type home