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

Commit 142f5717 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Move home stack forward while entering split-screen in some cases"

parents 37132183 dd2ae3da
Loading
Loading
Loading
Loading
+20 −14
Original line number Original line Diff line number Diff line
@@ -4516,7 +4516,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D


    int startActivityFromRecents(int callingPid, int callingUid, int taskId,
    int startActivityFromRecents(int callingPid, int callingUid, int taskId,
            SafeActivityOptions options) {
            SafeActivityOptions options) {
        final TaskRecord task;
        TaskRecord task = null;
        final String callingPackage;
        final String callingPackage;
        final Intent intent;
        final Intent intent;
        final int userId;
        final int userId;
@@ -4579,13 +4579,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                            targetActivity);
                            targetActivity);
                }
                }


                // If we are launching the task in the docked stack, put it into resizing mode so
                // the window renders full-screen with the background filling the void. Also only
                // call this at the end to make sure that tasks exists on the window manager side.
                if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                    setResizingDuringAnimation(task);
                }

                mService.getActivityStartController().postStartActivityProcessingForLastStarter(
                mService.getActivityStartController().postStartActivityProcessingForLastStarter(
                        task.getTopActivity(), ActivityManager.START_TASK_TO_FRONT,
                        task.getTopActivity(), ActivityManager.START_TASK_TO_FRONT,
                        task.getStack());
                        task.getStack());
@@ -4595,15 +4588,28 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            intent = task.intent;
            intent = task.intent;
            intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
            intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
            userId = task.userId;
            userId = task.userId;
            int result = mService.getActivityStartController().startActivityInPackage(
            return mService.getActivityStartController().startActivityInPackage(
                    task.mCallingUid, callingPid, callingUid, callingPackage, intent, null, null,
                    task.mCallingUid, callingPid, callingUid, callingPackage, intent, null, null,
                    null, 0, 0, options, userId, task,
                    null, 0, 0, options, userId, task, "startActivityFromRecents");
                    "startActivityFromRecents");
        } finally {
            if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
            if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY && task != null) {
                // If we are launching the task in the docked stack, put it into resizing mode so
                // the window renders full-screen with the background filling the void. Also only
                // call this at the end to make sure that tasks exists on the window manager side.
                setResizingDuringAnimation(task);
                setResizingDuringAnimation(task);

                final ActivityDisplay display = task.getStack().getDisplay();
                final ActivityStack topSecondaryStack =
                        display.getTopStackInWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
                if (topSecondaryStack.isActivityTypeHome()) {
                    // If the home activity if the top split-screen secondary stack, then the
                    // primary split-screen stack is in the minimized mode which means it can't
                    // receive input keys, so we should move the focused app to the home app so that
                    // window manager can correctly calculate the focus window that can receive
                    // input keys.
                    moveHomeStackToFront("startActivityFromRecents: homeVisibleInSplitScreen");
                }
            }
            }
            return result;
        } finally {
            mWindowManager.continueSurfaceLayout();
            mWindowManager.continueSurfaceLayout();
        }
        }
    }
    }