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

Commit a4427659 authored by Tony Huang's avatar Tony Huang Committed by Automerger Merge Worker
Browse files

Merge "Fix pip expand issue if parent task under split root" into tm-qpr-dev am: b89627e9

parents 8d1d4fa2 b89627e9
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -187,6 +187,14 @@ public class TaskInfo {
     */
     */
    public int launchIntoPipHostTaskId;
    public int launchIntoPipHostTaskId;


    /**
     * The task id of the parent Task of the launch-into-pip Activity, i.e., if task have more than
     * one activity it will create new task for this activity, this id is the origin task id and
     * the pip activity will be reparent to origin task when it exit pip mode.
     * @hide
     */
    public int lastParentTaskIdBeforePip;

    /**
    /**
     * The {@link Rect} copied from {@link DisplayCutout#getSafeInsets()} if the cutout is not of
     * The {@link Rect} copied from {@link DisplayCutout#getSafeInsets()} if the cutout is not of
     * (LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES, LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS),
     * (LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES, LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS),
@@ -503,6 +511,7 @@ public class TaskInfo {
        pictureInPictureParams = source.readTypedObject(PictureInPictureParams.CREATOR);
        pictureInPictureParams = source.readTypedObject(PictureInPictureParams.CREATOR);
        shouldDockBigOverlays = source.readBoolean();
        shouldDockBigOverlays = source.readBoolean();
        launchIntoPipHostTaskId = source.readInt();
        launchIntoPipHostTaskId = source.readInt();
        lastParentTaskIdBeforePip = source.readInt();
        displayCutoutInsets = source.readTypedObject(Rect.CREATOR);
        displayCutoutInsets = source.readTypedObject(Rect.CREATOR);
        topActivityInfo = source.readTypedObject(ActivityInfo.CREATOR);
        topActivityInfo = source.readTypedObject(ActivityInfo.CREATOR);
        isResizeable = source.readBoolean();
        isResizeable = source.readBoolean();
@@ -549,6 +558,7 @@ public class TaskInfo {
        dest.writeTypedObject(pictureInPictureParams, flags);
        dest.writeTypedObject(pictureInPictureParams, flags);
        dest.writeBoolean(shouldDockBigOverlays);
        dest.writeBoolean(shouldDockBigOverlays);
        dest.writeInt(launchIntoPipHostTaskId);
        dest.writeInt(launchIntoPipHostTaskId);
        dest.writeInt(lastParentTaskIdBeforePip);
        dest.writeTypedObject(displayCutoutInsets, flags);
        dest.writeTypedObject(displayCutoutInsets, flags);
        dest.writeTypedObject(topActivityInfo, flags);
        dest.writeTypedObject(topActivityInfo, flags);
        dest.writeBoolean(isResizeable);
        dest.writeBoolean(isResizeable);
@@ -589,6 +599,7 @@ public class TaskInfo {
                + " pictureInPictureParams=" + pictureInPictureParams
                + " pictureInPictureParams=" + pictureInPictureParams
                + " shouldDockBigOverlays=" + shouldDockBigOverlays
                + " shouldDockBigOverlays=" + shouldDockBigOverlays
                + " launchIntoPipHostTaskId=" + launchIntoPipHostTaskId
                + " launchIntoPipHostTaskId=" + launchIntoPipHostTaskId
                + " lastParentTaskIdBeforePip=" + lastParentTaskIdBeforePip
                + " displayCutoutSafeInsets=" + displayCutoutInsets
                + " displayCutoutSafeInsets=" + displayCutoutInsets
                + " topActivityInfo=" + topActivityInfo
                + " topActivityInfo=" + topActivityInfo
                + " launchCookies=" + launchCookies
                + " launchCookies=" + launchCookies
+10 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.wm.shell.pip;
package com.android.wm.shell.pip;


import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
@@ -538,6 +539,15 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
            mPipTransitionController.startExitTransition(TRANSIT_EXIT_PIP, wct, destinationBounds);
            mPipTransitionController.startExitTransition(TRANSIT_EXIT_PIP, wct, destinationBounds);
            return;
            return;
        }
        }
        if (mSplitScreenOptional.isPresent()) {
            // If pip activity will reparent to origin task case and if the origin task still under
            // split root, just exit split screen here to ensure it could expand to fullscreen.
            SplitScreenController split = mSplitScreenOptional.get();
            if (split.isTaskInSplitScreen(mTaskInfo.lastParentTaskIdBeforePip)) {
                split.exitSplitScreen(INVALID_TASK_ID,
                        SplitScreenController.EXIT_REASON_APP_FINISHED);
            }
        }
        mSyncTransactionQueue.queue(wct);
        mSyncTransactionQueue.queue(wct);
        mSyncTransactionQueue.runInSync(t -> {
        mSyncTransactionQueue.runInSync(t -> {
            // Make sure to grab the latest source hint rect as it could have been
            // Make sure to grab the latest source hint rect as it could have been
+2 −1
Original line number Original line Diff line number Diff line
@@ -282,7 +282,8 @@ public class PipMenuView extends FrameLayout {


    public void onFocusTaskChanged(ActivityManager.RunningTaskInfo taskInfo) {
    public void onFocusTaskChanged(ActivityManager.RunningTaskInfo taskInfo) {
        final boolean isSplitScreen = mSplitScreenControllerOptional.isPresent()
        final boolean isSplitScreen = mSplitScreenControllerOptional.isPresent()
                && mSplitScreenControllerOptional.get().isTaskInSplitScreen(taskInfo.taskId);
                && mSplitScreenControllerOptional.get().isTaskInSplitScreenForeground(
                taskInfo.taskId);
        mFocusedTaskAllowSplitScreen = isSplitScreen
        mFocusedTaskAllowSplitScreen = isSplitScreen
                || (taskInfo.getWindowingMode() == WINDOWING_MODE_FULLSCREEN
                || (taskInfo.getWindowingMode() == WINDOWING_MODE_FULLSCREEN
                && taskInfo.supportsMultiWindow
                && taskInfo.supportsMultiWindow
+7 −2
Original line number Original line Diff line number Diff line
@@ -327,9 +327,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
        return mTaskOrganizer.getRunningTaskInfo(taskId);
        return mTaskOrganizer.getRunningTaskInfo(taskId);
    }
    }


    /** Check task is under split or not by taskId. */
    public boolean isTaskInSplitScreen(int taskId) {
    public boolean isTaskInSplitScreen(int taskId) {
        return isSplitScreenVisible()
        return mStageCoordinator.getStageOfTask(taskId) != STAGE_TYPE_UNDEFINED;
                && mStageCoordinator.getStageOfTask(taskId) != STAGE_TYPE_UNDEFINED;
    }

    /** Check split is foreground and task is under split or not by taskId. */
    public boolean isTaskInSplitScreenForeground(int taskId) {
        return isTaskInSplitScreen(taskId) && isSplitScreenVisible();
    }
    }


    public @SplitPosition int getSplitPosition(int taskId) {
    public @SplitPosition int getSplitPosition(int taskId) {
+2 −0
Original line number Original line Diff line number Diff line
@@ -3452,6 +3452,8 @@ class Task extends TaskFragment {
                && info.pictureInPictureParams.isLaunchIntoPip()
                && info.pictureInPictureParams.isLaunchIntoPip()
                && top.getLastParentBeforePip() != null)
                && top.getLastParentBeforePip() != null)
                        ? top.getLastParentBeforePip().mTaskId : INVALID_TASK_ID;
                        ? top.getLastParentBeforePip().mTaskId : INVALID_TASK_ID;
        info.lastParentTaskIdBeforePip = top != null && top.getLastParentBeforePip() != null
                ? top.getLastParentBeforePip().mTaskId : INVALID_TASK_ID;
        info.shouldDockBigOverlays = top != null && top.shouldDockBigOverlays;
        info.shouldDockBigOverlays = top != null && top.shouldDockBigOverlays;
        info.mTopActivityLocusId = top != null ? top.getLocusId() : null;
        info.mTopActivityLocusId = top != null ? top.getLocusId() : null;