Merge "Fix pip expand issue if parent task under split root" into tm-qpr-dev
This commit is contained in:
@@ -187,6 +187,14 @@ public class TaskInfo {
|
||||
*/
|
||||
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
|
||||
* (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);
|
||||
shouldDockBigOverlays = source.readBoolean();
|
||||
launchIntoPipHostTaskId = source.readInt();
|
||||
lastParentTaskIdBeforePip = source.readInt();
|
||||
displayCutoutInsets = source.readTypedObject(Rect.CREATOR);
|
||||
topActivityInfo = source.readTypedObject(ActivityInfo.CREATOR);
|
||||
isResizeable = source.readBoolean();
|
||||
@@ -549,6 +558,7 @@ public class TaskInfo {
|
||||
dest.writeTypedObject(pictureInPictureParams, flags);
|
||||
dest.writeBoolean(shouldDockBigOverlays);
|
||||
dest.writeInt(launchIntoPipHostTaskId);
|
||||
dest.writeInt(lastParentTaskIdBeforePip);
|
||||
dest.writeTypedObject(displayCutoutInsets, flags);
|
||||
dest.writeTypedObject(topActivityInfo, flags);
|
||||
dest.writeBoolean(isResizeable);
|
||||
@@ -589,6 +599,7 @@ public class TaskInfo {
|
||||
+ " pictureInPictureParams=" + pictureInPictureParams
|
||||
+ " shouldDockBigOverlays=" + shouldDockBigOverlays
|
||||
+ " launchIntoPipHostTaskId=" + launchIntoPipHostTaskId
|
||||
+ " lastParentTaskIdBeforePip=" + lastParentTaskIdBeforePip
|
||||
+ " displayCutoutSafeInsets=" + displayCutoutInsets
|
||||
+ " topActivityInfo=" + topActivityInfo
|
||||
+ " launchCookies=" + launchCookies
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
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_PINNED;
|
||||
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);
|
||||
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.runInSync(t -> {
|
||||
// Make sure to grab the latest source hint rect as it could have been
|
||||
|
||||
@@ -282,7 +282,8 @@ public class PipMenuView extends FrameLayout {
|
||||
|
||||
public void onFocusTaskChanged(ActivityManager.RunningTaskInfo taskInfo) {
|
||||
final boolean isSplitScreen = mSplitScreenControllerOptional.isPresent()
|
||||
&& mSplitScreenControllerOptional.get().isTaskInSplitScreen(taskInfo.taskId);
|
||||
&& mSplitScreenControllerOptional.get().isTaskInSplitScreenForeground(
|
||||
taskInfo.taskId);
|
||||
mFocusedTaskAllowSplitScreen = isSplitScreen
|
||||
|| (taskInfo.getWindowingMode() == WINDOWING_MODE_FULLSCREEN
|
||||
&& taskInfo.supportsMultiWindow
|
||||
|
||||
@@ -327,9 +327,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
return mTaskOrganizer.getRunningTaskInfo(taskId);
|
||||
}
|
||||
|
||||
/** Check task is under split or not by taskId. */
|
||||
public boolean isTaskInSplitScreen(int taskId) {
|
||||
return isSplitScreenVisible()
|
||||
&& mStageCoordinator.getStageOfTask(taskId) != STAGE_TYPE_UNDEFINED;
|
||||
return 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) {
|
||||
|
||||
@@ -3448,6 +3448,8 @@ class Task extends TaskFragment {
|
||||
&& info.pictureInPictureParams.isLaunchIntoPip()
|
||||
&& top.getLastParentBeforePip() != null)
|
||||
? 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.mTopActivityLocusId = top != null ? top.getLocusId() : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user