Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ package android.app { method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void moveTaskToRootTask(int, int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void removeRootTasksInWindowingModes(@NonNull int[]); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void removeRootTasksWithActivityTypes(@NonNull int[]); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean removeTask(int); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void resizeTask(int, android.graphics.Rect); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void startSystemLockTaskMode(int); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode(); Loading core/java/android/app/ActivityTaskManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -469,7 +469,8 @@ public class ActivityTaskManager { } } /** @hide */ /** Removes task by a given taskId */ @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean removeTask(int taskId) { try { return getService().removeTask(taskId); Loading core/proto/android/server/windowmanagerservice.proto +1 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,7 @@ message TaskProto { optional float minimize_amount = 27; optional bool created_by_organizer = 28; optional string affinity = 29; optional bool has_child_pip_activity = 30; } /* represents ActivityRecordProto */ Loading services/core/java/com/android/server/wm/ActivityRecord.java +38 −3 Original line number Diff line number Diff line Loading @@ -587,7 +587,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A AnimatingActivityRegistry mAnimatingActivityRegistry; private Task mLastParent; // Set whenever the ActivityRecord gets reparented to a Task so we can know the last known // parent was when the ActivityRecord is detached from the hierarchy private Task mLastKnownParent; // Set to the previous Task parent of the ActivityRecord when it is reparented to a new Task // due to picture-in-picture. This gets cleared whenever this activity or the Task // it references to gets removed. This should also be cleared when we move out of pip. private Task mLastParentBeforePip; boolean firstWindowDrawn; /** Whether the visible window(s) of this activity is drawn. */ Loading Loading @@ -1096,6 +1103,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.println(prefix + "configChanges=0x" + Integer.toHexString(info.configChanges)); } } if (mLastParentBeforePip != null) { pw.println(prefix + "lastParentTaskIdBeforePip=" + mLastParentBeforePip.mTaskId); } dumpLetterboxInfo(pw, prefix); } Loading Loading @@ -1349,7 +1359,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (getDisplayContent() != null) { getDisplayContent().mClosingApps.remove(this); } } else if (mLastParent != null && mLastParent.getRootTask() != null) { } else if (mLastKnownParent != null && mLastKnownParent.getRootTask() != null) { task.getRootTask().mExitingActivities.remove(this); } final Task rootTask = getRootTask(); Loading @@ -1362,7 +1372,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A ? rootTask.getAnimatingActivityRegistry() : null; mLastParent = task; mLastKnownParent = task; if (mLastKnownParent == mLastParentBeforePip) { // Activity's reparented back from pip, clear the links once established clearLastParentBeforePip(); } updateColorTransform(); Loading @@ -1381,6 +1395,26 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } /** * Sets {@link #mLastParentBeforePip} to the current parent Task, it's caller's job to ensure * {@link #getTask()} is set before this is called. */ void setLastParentBeforePip() { mLastParentBeforePip = getTask(); mLastParentBeforePip.mChildPipActivity = this; } private void clearLastParentBeforePip() { if (mLastParentBeforePip != null) { mLastParentBeforePip.mChildPipActivity = null; mLastParentBeforePip = null; } } @Nullable Task getLastParentBeforePip() { return mLastParentBeforePip; } private void updateColorTransform() { if (mSurfaceControl != null && mLastAppSaturationInfo != null) { getPendingTransaction().setColorTransform(mSurfaceControl, Loading Loading @@ -3434,6 +3468,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ void cleanUp(boolean cleanServices, boolean setState) { task.cleanUpActivityReferences(this); clearLastParentBeforePip(); deferRelaunchUntilPaused = false; frozenBeforeDestroy = false; Loading services/core/java/com/android/server/wm/RecentTasks.java +3 −0 Original line number Diff line number Diff line Loading @@ -1415,6 +1415,9 @@ class RecentTasks { return true; } // The given task if always treated as in visible range if it is the origin of pinned task. if (task.mChildPipActivity != null) return true; if (mMaxNumVisibleTasks >= 0) { // Always keep up to the max number of recent tasks, but return false afterwards return numVisibleTasks <= mMaxNumVisibleTasks; Loading Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ package android.app { method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void moveTaskToRootTask(int, int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void removeRootTasksInWindowingModes(@NonNull int[]); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void removeRootTasksWithActivityTypes(@NonNull int[]); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean removeTask(int); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void resizeTask(int, android.graphics.Rect); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void startSystemLockTaskMode(int); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode(); Loading
core/java/android/app/ActivityTaskManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -469,7 +469,8 @@ public class ActivityTaskManager { } } /** @hide */ /** Removes task by a given taskId */ @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean removeTask(int taskId) { try { return getService().removeTask(taskId); Loading
core/proto/android/server/windowmanagerservice.proto +1 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,7 @@ message TaskProto { optional float minimize_amount = 27; optional bool created_by_organizer = 28; optional string affinity = 29; optional bool has_child_pip_activity = 30; } /* represents ActivityRecordProto */ Loading
services/core/java/com/android/server/wm/ActivityRecord.java +38 −3 Original line number Diff line number Diff line Loading @@ -587,7 +587,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A AnimatingActivityRegistry mAnimatingActivityRegistry; private Task mLastParent; // Set whenever the ActivityRecord gets reparented to a Task so we can know the last known // parent was when the ActivityRecord is detached from the hierarchy private Task mLastKnownParent; // Set to the previous Task parent of the ActivityRecord when it is reparented to a new Task // due to picture-in-picture. This gets cleared whenever this activity or the Task // it references to gets removed. This should also be cleared when we move out of pip. private Task mLastParentBeforePip; boolean firstWindowDrawn; /** Whether the visible window(s) of this activity is drawn. */ Loading Loading @@ -1096,6 +1103,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.println(prefix + "configChanges=0x" + Integer.toHexString(info.configChanges)); } } if (mLastParentBeforePip != null) { pw.println(prefix + "lastParentTaskIdBeforePip=" + mLastParentBeforePip.mTaskId); } dumpLetterboxInfo(pw, prefix); } Loading Loading @@ -1349,7 +1359,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (getDisplayContent() != null) { getDisplayContent().mClosingApps.remove(this); } } else if (mLastParent != null && mLastParent.getRootTask() != null) { } else if (mLastKnownParent != null && mLastKnownParent.getRootTask() != null) { task.getRootTask().mExitingActivities.remove(this); } final Task rootTask = getRootTask(); Loading @@ -1362,7 +1372,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A ? rootTask.getAnimatingActivityRegistry() : null; mLastParent = task; mLastKnownParent = task; if (mLastKnownParent == mLastParentBeforePip) { // Activity's reparented back from pip, clear the links once established clearLastParentBeforePip(); } updateColorTransform(); Loading @@ -1381,6 +1395,26 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } /** * Sets {@link #mLastParentBeforePip} to the current parent Task, it's caller's job to ensure * {@link #getTask()} is set before this is called. */ void setLastParentBeforePip() { mLastParentBeforePip = getTask(); mLastParentBeforePip.mChildPipActivity = this; } private void clearLastParentBeforePip() { if (mLastParentBeforePip != null) { mLastParentBeforePip.mChildPipActivity = null; mLastParentBeforePip = null; } } @Nullable Task getLastParentBeforePip() { return mLastParentBeforePip; } private void updateColorTransform() { if (mSurfaceControl != null && mLastAppSaturationInfo != null) { getPendingTransaction().setColorTransform(mSurfaceControl, Loading Loading @@ -3434,6 +3468,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ void cleanUp(boolean cleanServices, boolean setState) { task.cleanUpActivityReferences(this); clearLastParentBeforePip(); deferRelaunchUntilPaused = false; frozenBeforeDestroy = false; Loading
services/core/java/com/android/server/wm/RecentTasks.java +3 −0 Original line number Diff line number Diff line Loading @@ -1415,6 +1415,9 @@ class RecentTasks { return true; } // The given task if always treated as in visible range if it is the origin of pinned task. if (task.mChildPipActivity != null) return true; if (mMaxNumVisibleTasks >= 0) { // Always keep up to the max number of recent tasks, but return false afterwards return numVisibleTasks <= mMaxNumVisibleTasks; Loading