Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java +0 −10 Original line number Diff line number Diff line Loading @@ -57,11 +57,6 @@ public class PipScheduler { @Nullable private SurfaceControl mPinnedTaskLeash; // the leash of the original task of the PiP activity; // used to synchronize app drawings in the multi-activity case @Nullable private SurfaceControl mOriginalTaskLeash; /** * A temporary broadcast receiver to initiate exit PiP via expand. * This will later be modified to be triggered by the PiP menu. Loading Loading @@ -95,10 +90,6 @@ public class PipScheduler { mPinnedTaskLeash = pinnedTaskLeash; } void setOriginalTaskLeash(SurfaceControl originalTaskLeash) { mOriginalTaskLeash = originalTaskLeash; } void setPipTaskToken(@Nullable WindowContainerToken pipTaskToken) { mPipTaskToken = pipTaskToken; } Loading Loading @@ -133,6 +124,5 @@ public class PipScheduler { void onExitPip() { mPipTaskToken = null; mPinnedTaskLeash = null; mOriginalTaskLeash = null; } } libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +2 −19 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.wm.shell.pip2.phone; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.view.WindowManager.TRANSIT_OPEN; Loading Loading @@ -50,7 +49,7 @@ import com.android.wm.shell.transition.Transitions; public class PipTransition extends PipTransitionController { private static final String TAG = PipTransition.class.getSimpleName(); private PipScheduler mPipScheduler; private final PipScheduler mPipScheduler; @Nullable private WindowContainerToken mPipTaskToken; @Nullable Loading Loading @@ -168,14 +167,9 @@ public class PipTransition extends PipTransitionController { } mPipTaskToken = pipChange.getContainer(); // cache the PiP task token and the relevant leashes // cache the PiP task token and leash mPipScheduler.setPipTaskToken(mPipTaskToken); mPipScheduler.setPinnedTaskLeash(pipChange.getLeash()); // check if we entered PiP from a multi-activity task and set the original task leash final int lastParentTaskId = pipChange.getTaskInfo().lastParentTaskIdBeforePip; final boolean isSingleActivity = lastParentTaskId == INVALID_TASK_ID; mPipScheduler.setOriginalTaskLeash(isSingleActivity ? null : findChangeByTaskId(info, lastParentTaskId).getLeash()); startTransaction.apply(); finishCallback.onTransitionFinished(null); Loading @@ -201,17 +195,6 @@ public class PipTransition extends PipTransitionController { return null; } @Nullable private TransitionInfo.Change findChangeByTaskId(TransitionInfo info, int taskId) { for (TransitionInfo.Change change : info.getChanges()) { if (change.getTaskInfo() != null && change.getTaskInfo().taskId == taskId) { return change; } } return null; } private void onExitPip() { mPipTaskToken = null; mPipScheduler.onExitPip(); Loading services/core/java/com/android/server/wm/ActivityRecord.java +9 −3 Original line number Diff line number Diff line Loading @@ -1556,9 +1556,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } // Transition change for the activity moving into a TaskFragment of different bounds. return newParent.isOrganizedTaskFragment() && !newParent.getBounds().equals(oldParent.getBounds()); final boolean isInPip2 = ActivityTaskManagerService.isPip2ExperimentEnabled() && inPinnedWindowingMode(); if (!newParent.isOrganizedTaskFragment() && !isInPip2) { // Parent TaskFragment isn't associated with a TF organizer and we are not in PiP2, // so do not allow for initializeChangeTransition() on parent changes return false; } // Transition change for the activity moving into TaskFragment of different bounds. return !newParent.getBounds().equals(oldParent.getBounds()); } @Override Loading services/core/java/com/android/server/wm/Task.java +30 −20 Original line number Diff line number Diff line Loading @@ -4625,7 +4625,12 @@ class Task extends TaskFragment { if (topActivity != null) { mTaskSupervisor.mNoAnimActivities.add(topActivity); } final boolean isPip2ExperimentEnabled = ActivityTaskManagerService.isPip2ExperimentEnabled(); if (!isPip2ExperimentEnabled) { super.setWindowingMode(windowingMode); } if (currentMode == WINDOWING_MODE_PINNED && topActivity != null) { // Try reparent pinned activity back to its original task after Loading @@ -4634,13 +4639,15 @@ class Task extends TaskFragment { // PiP, we set final windowing mode on the ActivityRecord first and then on its // Task when the exit PiP transition finishes. Meanwhile, the exit transition is // always performed on its original task, reparent immediately in ActivityRecord // breaks it. if (topActivity.getLastParentBeforePip() != null) { // Do not reparent if the pinned task is in removal, indicated by the // breaks it. Do not reparent if the pinned task is in removal, indicated by the // force hidden flag. if (!isForceHidden()) { if (topActivity.getLastParentBeforePip() != null && !isForceHidden() && topActivity.getLastParentBeforePip().isAttached()) { // We need to collect the pip activity to allow for screenshots // to be taken as a part of reparenting. mTransitionController.collect(topActivity); final Task lastParentBeforePip = topActivity.getLastParentBeforePip(); if (lastParentBeforePip.isAttached()) { topActivity.reparent(lastParentBeforePip, lastParentBeforePip.getChildCount() /* top */, "movePinnedActivityToOriginalTask"); Loading @@ -4649,17 +4656,20 @@ class Task extends TaskFragment { // Expanding pip into new rotation, so create a rotation leash // until the display is rotated. topActivity.getOrCreateFixedRotationLeash( topActivity.getPendingTransaction()); topActivity.getSyncTransaction()); } lastParentBeforePip.moveToFront("movePinnedActivityToOriginalTask"); } } if (isPip2ExperimentEnabled) { super.setWindowingMode(windowingMode); } // Resume app-switches-allowed flag when exiting from pinned mode since // it does not follow the ActivityStarter path. if (topActivity.shouldBeVisible()) { mAtmService.resumeAppSwitches(); } } else if (isPip2ExperimentEnabled) { super.setWindowingMode(windowingMode); } if (creating) { Loading services/core/java/com/android/server/wm/TaskOrganizerController.java +1 −1 Original line number Diff line number Diff line Loading @@ -394,7 +394,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { boolean taskAppearedSent = t.mTaskAppearedSent; if (taskAppearedSent) { if (t.getSurfaceControl() != null) { t.migrateToNewSurfaceControl(t.getPendingTransaction()); t.migrateToNewSurfaceControl(t.getSyncTransaction()); } t.mTaskAppearedSent = false; } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java +0 −10 Original line number Diff line number Diff line Loading @@ -57,11 +57,6 @@ public class PipScheduler { @Nullable private SurfaceControl mPinnedTaskLeash; // the leash of the original task of the PiP activity; // used to synchronize app drawings in the multi-activity case @Nullable private SurfaceControl mOriginalTaskLeash; /** * A temporary broadcast receiver to initiate exit PiP via expand. * This will later be modified to be triggered by the PiP menu. Loading Loading @@ -95,10 +90,6 @@ public class PipScheduler { mPinnedTaskLeash = pinnedTaskLeash; } void setOriginalTaskLeash(SurfaceControl originalTaskLeash) { mOriginalTaskLeash = originalTaskLeash; } void setPipTaskToken(@Nullable WindowContainerToken pipTaskToken) { mPipTaskToken = pipTaskToken; } Loading Loading @@ -133,6 +124,5 @@ public class PipScheduler { void onExitPip() { mPipTaskToken = null; mPinnedTaskLeash = null; mOriginalTaskLeash = null; } }
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +2 −19 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.wm.shell.pip2.phone; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.view.WindowManager.TRANSIT_OPEN; Loading Loading @@ -50,7 +49,7 @@ import com.android.wm.shell.transition.Transitions; public class PipTransition extends PipTransitionController { private static final String TAG = PipTransition.class.getSimpleName(); private PipScheduler mPipScheduler; private final PipScheduler mPipScheduler; @Nullable private WindowContainerToken mPipTaskToken; @Nullable Loading Loading @@ -168,14 +167,9 @@ public class PipTransition extends PipTransitionController { } mPipTaskToken = pipChange.getContainer(); // cache the PiP task token and the relevant leashes // cache the PiP task token and leash mPipScheduler.setPipTaskToken(mPipTaskToken); mPipScheduler.setPinnedTaskLeash(pipChange.getLeash()); // check if we entered PiP from a multi-activity task and set the original task leash final int lastParentTaskId = pipChange.getTaskInfo().lastParentTaskIdBeforePip; final boolean isSingleActivity = lastParentTaskId == INVALID_TASK_ID; mPipScheduler.setOriginalTaskLeash(isSingleActivity ? null : findChangeByTaskId(info, lastParentTaskId).getLeash()); startTransaction.apply(); finishCallback.onTransitionFinished(null); Loading @@ -201,17 +195,6 @@ public class PipTransition extends PipTransitionController { return null; } @Nullable private TransitionInfo.Change findChangeByTaskId(TransitionInfo info, int taskId) { for (TransitionInfo.Change change : info.getChanges()) { if (change.getTaskInfo() != null && change.getTaskInfo().taskId == taskId) { return change; } } return null; } private void onExitPip() { mPipTaskToken = null; mPipScheduler.onExitPip(); Loading
services/core/java/com/android/server/wm/ActivityRecord.java +9 −3 Original line number Diff line number Diff line Loading @@ -1556,9 +1556,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } // Transition change for the activity moving into a TaskFragment of different bounds. return newParent.isOrganizedTaskFragment() && !newParent.getBounds().equals(oldParent.getBounds()); final boolean isInPip2 = ActivityTaskManagerService.isPip2ExperimentEnabled() && inPinnedWindowingMode(); if (!newParent.isOrganizedTaskFragment() && !isInPip2) { // Parent TaskFragment isn't associated with a TF organizer and we are not in PiP2, // so do not allow for initializeChangeTransition() on parent changes return false; } // Transition change for the activity moving into TaskFragment of different bounds. return !newParent.getBounds().equals(oldParent.getBounds()); } @Override Loading
services/core/java/com/android/server/wm/Task.java +30 −20 Original line number Diff line number Diff line Loading @@ -4625,7 +4625,12 @@ class Task extends TaskFragment { if (topActivity != null) { mTaskSupervisor.mNoAnimActivities.add(topActivity); } final boolean isPip2ExperimentEnabled = ActivityTaskManagerService.isPip2ExperimentEnabled(); if (!isPip2ExperimentEnabled) { super.setWindowingMode(windowingMode); } if (currentMode == WINDOWING_MODE_PINNED && topActivity != null) { // Try reparent pinned activity back to its original task after Loading @@ -4634,13 +4639,15 @@ class Task extends TaskFragment { // PiP, we set final windowing mode on the ActivityRecord first and then on its // Task when the exit PiP transition finishes. Meanwhile, the exit transition is // always performed on its original task, reparent immediately in ActivityRecord // breaks it. if (topActivity.getLastParentBeforePip() != null) { // Do not reparent if the pinned task is in removal, indicated by the // breaks it. Do not reparent if the pinned task is in removal, indicated by the // force hidden flag. if (!isForceHidden()) { if (topActivity.getLastParentBeforePip() != null && !isForceHidden() && topActivity.getLastParentBeforePip().isAttached()) { // We need to collect the pip activity to allow for screenshots // to be taken as a part of reparenting. mTransitionController.collect(topActivity); final Task lastParentBeforePip = topActivity.getLastParentBeforePip(); if (lastParentBeforePip.isAttached()) { topActivity.reparent(lastParentBeforePip, lastParentBeforePip.getChildCount() /* top */, "movePinnedActivityToOriginalTask"); Loading @@ -4649,17 +4656,20 @@ class Task extends TaskFragment { // Expanding pip into new rotation, so create a rotation leash // until the display is rotated. topActivity.getOrCreateFixedRotationLeash( topActivity.getPendingTransaction()); topActivity.getSyncTransaction()); } lastParentBeforePip.moveToFront("movePinnedActivityToOriginalTask"); } } if (isPip2ExperimentEnabled) { super.setWindowingMode(windowingMode); } // Resume app-switches-allowed flag when exiting from pinned mode since // it does not follow the ActivityStarter path. if (topActivity.shouldBeVisible()) { mAtmService.resumeAppSwitches(); } } else if (isPip2ExperimentEnabled) { super.setWindowingMode(windowingMode); } if (creating) { Loading
services/core/java/com/android/server/wm/TaskOrganizerController.java +1 −1 Original line number Diff line number Diff line Loading @@ -394,7 +394,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { boolean taskAppearedSent = t.mTaskAppearedSent; if (taskAppearedSent) { if (t.getSurfaceControl() != null) { t.migrateToNewSurfaceControl(t.getPendingTransaction()); t.migrateToNewSurfaceControl(t.getSyncTransaction()); } t.mTaskAppearedSent = false; } Loading