Loading services/core/java/com/android/server/wm/ActivityStarter.java +1 −2 Original line number Diff line number Diff line Loading @@ -2926,8 +2926,7 @@ class ActivityStarter { // If the matching task is already in the adjacent task of the launch target. Adjust to use // the adjacent task as its launch target. So the existing task will be launched into the // closer one and won't be reparent redundantly. final Task adjacentTargetTask = mTargetRootTask.getAdjacentTaskFragment() != null ? mTargetRootTask.getAdjacentTaskFragment().asTask() : null; final Task adjacentTargetTask = mTargetRootTask.getAdjacentTask(); if (adjacentTargetTask != null && intentActivity.isDescendantOf(adjacentTargetTask)) { mTargetRootTask = adjacentTargetTask; } Loading services/core/java/com/android/server/wm/AppTransitionController.java +4 −5 Original line number Diff line number Diff line Loading @@ -1030,12 +1030,11 @@ public class AppTransitionController { canPromote = false; } // If the current window container is task and it have adjacent task, it means // both tasks will open or close app toghther but we want get their opening or // closing animation target independently so do not promote. // If the current window container is a task with adjacent task set, the both // adjacent tasks will be opened or closed together. To get their opening or // closing animation target independently, skip promoting their animation targets. if (current.asTask() != null && current.asTask().getAdjacentTaskFragment() != null && current.asTask().getAdjacentTaskFragment().asTask() != null) { && current.asTask().getAdjacentTask() != null) { canPromote = false; } Loading services/core/java/com/android/server/wm/DisplayPolicy.java +5 −7 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.view.Display.TYPE_INTERNAL; import static android.view.InsetsFrameProvider.SOURCE_ARBITRARY_RECTANGLE; import static android.view.InsetsFrameProvider.SOURCE_CONTAINER_BOUNDS; Loading Loading @@ -2208,16 +2207,15 @@ public class DisplayPolicy { private int updateSystemBarsLw(WindowState win, int disableFlags) { final TaskDisplayArea defaultTaskDisplayArea = mDisplayContent.getDefaultTaskDisplayArea(); final boolean multiWindowTaskVisible = final boolean adjacentTasksVisible = defaultTaskDisplayArea.getRootTask(task -> task.isVisible() && task.getTopLeafTask().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW) && task.getTopLeafTask().getAdjacentTask() != null) != null; final boolean freeformRootTaskVisible = defaultTaskDisplayArea.isRootTaskVisible(WINDOWING_MODE_FREEFORM); // We need to force showing system bars when the multi-window or freeform root task is // visible. mForceShowSystemBars = multiWindowTaskVisible || freeformRootTaskVisible; // We need to force showing system bars when adjacent tasks or freeform roots visible. mForceShowSystemBars = adjacentTasksVisible || freeformRootTaskVisible; // We need to force the consumption of the system bars if they are force shown or if they // are controlled by a remote insets controller. mForceConsumeSystemBars = mForceShowSystemBars Loading @@ -2238,7 +2236,7 @@ public class DisplayPolicy { int appearance = APPEARANCE_OPAQUE_NAVIGATION_BARS | APPEARANCE_OPAQUE_STATUS_BARS; appearance = configureStatusBarOpacity(appearance); appearance = configureNavBarOpacity(appearance, multiWindowTaskVisible, appearance = configureNavBarOpacity(appearance, adjacentTasksVisible, freeformRootTaskVisible); // Show immersive mode confirmation if needed. Loading services/core/java/com/android/server/wm/Task.java +17 −1 Original line number Diff line number Diff line Loading @@ -2362,6 +2362,22 @@ class Task extends TaskFragment { return parentTask == null ? null : parentTask.getCreatedByOrganizerTask(); } /** @return the first adjacent task of this task or its parent. */ @Nullable Task getAdjacentTask() { final TaskFragment adjacentTaskFragment = getAdjacentTaskFragment(); if (adjacentTaskFragment != null && adjacentTaskFragment.asTask() != null) { return adjacentTaskFragment.asTask(); } final WindowContainer parent = getParent(); if (parent == null || parent.asTask() == null) { return null; } return parent.asTask().getAdjacentTask(); } // TODO(task-merge): Figure out what's the right thing to do for places that used it. boolean isRootTask() { return getRootTask() == this; Loading Loading @@ -2747,7 +2763,7 @@ class Task extends TaskFragment { Rect outSurfaceInsets) { // If this task has its adjacent task, it means they should animate together. Use display // bounds for them could move same as full screen task. if (getAdjacentTaskFragment() != null && getAdjacentTaskFragment().asTask() != null) { if (getAdjacentTask() != null) { super.getAnimationFrames(outFrame, outInsets, outStableInsets, outSurfaceInsets); return; } Loading services/core/java/com/android/server/wm/TaskDisplayArea.java +11 −15 Original line number Diff line number Diff line Loading @@ -1081,12 +1081,12 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { if (sourceTask != null && sourceTask == candidateTask) { // Do nothing when task that is getting opened is same as the source. } else if (sourceTask != null && mLaunchAdjacentFlagRootTask.getAdjacentTaskFragment() != null && mLaunchAdjacentFlagRootTask.getAdjacentTask() != null && (sourceTask == mLaunchAdjacentFlagRootTask || sourceTask.isDescendantOf(mLaunchAdjacentFlagRootTask))) { // If the adjacent launch is coming from the same root, launch to // adjacent root instead. return mLaunchAdjacentFlagRootTask.getAdjacentTaskFragment().asTask(); return mLaunchAdjacentFlagRootTask.getAdjacentTask(); } else { return mLaunchAdjacentFlagRootTask; } Loading @@ -1095,10 +1095,8 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) { if (mLaunchRootTasks.get(i).contains(windowingMode, activityType)) { final Task launchRootTask = mLaunchRootTasks.get(i).task; final TaskFragment adjacentTaskFragment = launchRootTask != null ? launchRootTask.getAdjacentTaskFragment() : null; final Task adjacentRootTask = adjacentTaskFragment != null ? adjacentTaskFragment.asTask() : null; final Task adjacentRootTask = launchRootTask != null ? launchRootTask.getAdjacentTask() : null; if (sourceTask != null && adjacentRootTask != null && (sourceTask == adjacentRootTask || sourceTask.isDescendantOf(adjacentRootTask))) { Loading @@ -1116,16 +1114,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { // A pinned task relaunching should be handled by its task organizer. Skip fallback // launch target of a pinned task from source task. || candidateTask.getWindowingMode() != WINDOWING_MODE_PINNED)) { Task launchTarget = sourceTask.getCreatedByOrganizerTask(); if (launchTarget != null && launchTarget.getAdjacentTaskFragment() != null) { if (candidateTask != null) { final Task candidateRoot = candidateTask.getCreatedByOrganizerTask(); if (candidateRoot != null && candidateRoot != launchTarget && launchTarget == candidateRoot.getAdjacentTaskFragment()) { launchTarget = candidateRoot; } } return launchTarget; final Task adjacentTarget = sourceTask.getAdjacentTask(); if (adjacentTarget != null) { if (candidateTask != null && (candidateTask == adjacentTarget || candidateTask.isDescendantOf(adjacentTarget))) { return adjacentTarget; } return sourceTask.getCreatedByOrganizerTask(); } } Loading Loading
services/core/java/com/android/server/wm/ActivityStarter.java +1 −2 Original line number Diff line number Diff line Loading @@ -2926,8 +2926,7 @@ class ActivityStarter { // If the matching task is already in the adjacent task of the launch target. Adjust to use // the adjacent task as its launch target. So the existing task will be launched into the // closer one and won't be reparent redundantly. final Task adjacentTargetTask = mTargetRootTask.getAdjacentTaskFragment() != null ? mTargetRootTask.getAdjacentTaskFragment().asTask() : null; final Task adjacentTargetTask = mTargetRootTask.getAdjacentTask(); if (adjacentTargetTask != null && intentActivity.isDescendantOf(adjacentTargetTask)) { mTargetRootTask = adjacentTargetTask; } Loading
services/core/java/com/android/server/wm/AppTransitionController.java +4 −5 Original line number Diff line number Diff line Loading @@ -1030,12 +1030,11 @@ public class AppTransitionController { canPromote = false; } // If the current window container is task and it have adjacent task, it means // both tasks will open or close app toghther but we want get their opening or // closing animation target independently so do not promote. // If the current window container is a task with adjacent task set, the both // adjacent tasks will be opened or closed together. To get their opening or // closing animation target independently, skip promoting their animation targets. if (current.asTask() != null && current.asTask().getAdjacentTaskFragment() != null && current.asTask().getAdjacentTaskFragment().asTask() != null) { && current.asTask().getAdjacentTask() != null) { canPromote = false; } Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +5 −7 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.view.Display.TYPE_INTERNAL; import static android.view.InsetsFrameProvider.SOURCE_ARBITRARY_RECTANGLE; import static android.view.InsetsFrameProvider.SOURCE_CONTAINER_BOUNDS; Loading Loading @@ -2208,16 +2207,15 @@ public class DisplayPolicy { private int updateSystemBarsLw(WindowState win, int disableFlags) { final TaskDisplayArea defaultTaskDisplayArea = mDisplayContent.getDefaultTaskDisplayArea(); final boolean multiWindowTaskVisible = final boolean adjacentTasksVisible = defaultTaskDisplayArea.getRootTask(task -> task.isVisible() && task.getTopLeafTask().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW) && task.getTopLeafTask().getAdjacentTask() != null) != null; final boolean freeformRootTaskVisible = defaultTaskDisplayArea.isRootTaskVisible(WINDOWING_MODE_FREEFORM); // We need to force showing system bars when the multi-window or freeform root task is // visible. mForceShowSystemBars = multiWindowTaskVisible || freeformRootTaskVisible; // We need to force showing system bars when adjacent tasks or freeform roots visible. mForceShowSystemBars = adjacentTasksVisible || freeformRootTaskVisible; // We need to force the consumption of the system bars if they are force shown or if they // are controlled by a remote insets controller. mForceConsumeSystemBars = mForceShowSystemBars Loading @@ -2238,7 +2236,7 @@ public class DisplayPolicy { int appearance = APPEARANCE_OPAQUE_NAVIGATION_BARS | APPEARANCE_OPAQUE_STATUS_BARS; appearance = configureStatusBarOpacity(appearance); appearance = configureNavBarOpacity(appearance, multiWindowTaskVisible, appearance = configureNavBarOpacity(appearance, adjacentTasksVisible, freeformRootTaskVisible); // Show immersive mode confirmation if needed. Loading
services/core/java/com/android/server/wm/Task.java +17 −1 Original line number Diff line number Diff line Loading @@ -2362,6 +2362,22 @@ class Task extends TaskFragment { return parentTask == null ? null : parentTask.getCreatedByOrganizerTask(); } /** @return the first adjacent task of this task or its parent. */ @Nullable Task getAdjacentTask() { final TaskFragment adjacentTaskFragment = getAdjacentTaskFragment(); if (adjacentTaskFragment != null && adjacentTaskFragment.asTask() != null) { return adjacentTaskFragment.asTask(); } final WindowContainer parent = getParent(); if (parent == null || parent.asTask() == null) { return null; } return parent.asTask().getAdjacentTask(); } // TODO(task-merge): Figure out what's the right thing to do for places that used it. boolean isRootTask() { return getRootTask() == this; Loading Loading @@ -2747,7 +2763,7 @@ class Task extends TaskFragment { Rect outSurfaceInsets) { // If this task has its adjacent task, it means they should animate together. Use display // bounds for them could move same as full screen task. if (getAdjacentTaskFragment() != null && getAdjacentTaskFragment().asTask() != null) { if (getAdjacentTask() != null) { super.getAnimationFrames(outFrame, outInsets, outStableInsets, outSurfaceInsets); return; } Loading
services/core/java/com/android/server/wm/TaskDisplayArea.java +11 −15 Original line number Diff line number Diff line Loading @@ -1081,12 +1081,12 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { if (sourceTask != null && sourceTask == candidateTask) { // Do nothing when task that is getting opened is same as the source. } else if (sourceTask != null && mLaunchAdjacentFlagRootTask.getAdjacentTaskFragment() != null && mLaunchAdjacentFlagRootTask.getAdjacentTask() != null && (sourceTask == mLaunchAdjacentFlagRootTask || sourceTask.isDescendantOf(mLaunchAdjacentFlagRootTask))) { // If the adjacent launch is coming from the same root, launch to // adjacent root instead. return mLaunchAdjacentFlagRootTask.getAdjacentTaskFragment().asTask(); return mLaunchAdjacentFlagRootTask.getAdjacentTask(); } else { return mLaunchAdjacentFlagRootTask; } Loading @@ -1095,10 +1095,8 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) { if (mLaunchRootTasks.get(i).contains(windowingMode, activityType)) { final Task launchRootTask = mLaunchRootTasks.get(i).task; final TaskFragment adjacentTaskFragment = launchRootTask != null ? launchRootTask.getAdjacentTaskFragment() : null; final Task adjacentRootTask = adjacentTaskFragment != null ? adjacentTaskFragment.asTask() : null; final Task adjacentRootTask = launchRootTask != null ? launchRootTask.getAdjacentTask() : null; if (sourceTask != null && adjacentRootTask != null && (sourceTask == adjacentRootTask || sourceTask.isDescendantOf(adjacentRootTask))) { Loading @@ -1116,16 +1114,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { // A pinned task relaunching should be handled by its task organizer. Skip fallback // launch target of a pinned task from source task. || candidateTask.getWindowingMode() != WINDOWING_MODE_PINNED)) { Task launchTarget = sourceTask.getCreatedByOrganizerTask(); if (launchTarget != null && launchTarget.getAdjacentTaskFragment() != null) { if (candidateTask != null) { final Task candidateRoot = candidateTask.getCreatedByOrganizerTask(); if (candidateRoot != null && candidateRoot != launchTarget && launchTarget == candidateRoot.getAdjacentTaskFragment()) { launchTarget = candidateRoot; } } return launchTarget; final Task adjacentTarget = sourceTask.getAdjacentTask(); if (adjacentTarget != null) { if (candidateTask != null && (candidateTask == adjacentTarget || candidateTask.isDescendantOf(adjacentTarget))) { return adjacentTarget; } return sourceTask.getCreatedByOrganizerTask(); } } Loading