Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +12 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.wm.shell.splitscreen; import static android.app.ActivityManager.START_SUCCESS; import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.RemoteAnimationTarget.MODE_OPENING; Loading Loading @@ -213,7 +215,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); try { final int result = ActivityTaskManager.getService().startActivityFromRecents(taskId, options); if (result == START_SUCCESS || result == START_TASK_TO_FRONT) { mStageCoordinator.evictOccludedChildren(position); } } catch (RemoteException e) { Slog.e(TAG, "Failed to launch task", e); } Loading @@ -229,6 +235,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mContext.getSystemService(LauncherApps.class); launcherApps.startShortcut(packageName, shortcutId, null /* sourceBounds */, options, user); mStageCoordinator.evictOccludedChildren(position); } catch (ActivityNotFoundException e) { Slog.e(TAG, "Failed to launch shortcut", e); } Loading Loading @@ -272,6 +279,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, Slog.e(TAG, "Error finishing legacy transition: ", e); } } // Launching a new app into a specific split evicts tasks previously in the same // split. mStageCoordinator.evictOccludedChildren(position); } }; WindowContainerTransaction wct = new WindowContainerTransaction(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +6 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,12 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, wct, remoteTransition, this); } void evictOccludedChildren(@SplitPosition int position) { final WindowContainerTransaction wct = new WindowContainerTransaction(); (position == mSideStagePosition ? mSideStage : mMainStage).evictOccludedChildren(wct); mTaskOrganizer.applyTransaction(wct); } Bundle resolveStartStage(@SplitScreen.StageType int stage, @SplitPosition int position, @androidx.annotation.Nullable Bundle options, @androidx.annotation.Nullable WindowContainerTransaction wct) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +10 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { void onChildTaskStatusChanged(int taskId, boolean present, boolean visible); void onRootTaskVanished(); void onNoLongerSupportMultiWindow(); } Loading Loading @@ -247,6 +248,15 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { wct.reorder(mChildrenTaskInfo.get(taskId).token, onTop /* onTop */); } void evictOccludedChildren(WindowContainerTransaction wct) { for (int i = mChildrenTaskInfo.size() - 1; i >= 0; i--) { final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.valueAt(i); if (!taskInfo.isVisible) { wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); } } } void setVisibility(boolean visible, WindowContainerTransaction wct) { wct.reorder(mRootTaskInfo.token, visible /* onTop */); } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +12 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.wm.shell.splitscreen; import static android.app.ActivityManager.START_SUCCESS; import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.RemoteAnimationTarget.MODE_OPENING; Loading Loading @@ -213,7 +215,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, options = mStageCoordinator.resolveStartStage(stage, position, options, null /* wct */); try { final int result = ActivityTaskManager.getService().startActivityFromRecents(taskId, options); if (result == START_SUCCESS || result == START_TASK_TO_FRONT) { mStageCoordinator.evictOccludedChildren(position); } } catch (RemoteException e) { Slog.e(TAG, "Failed to launch task", e); } Loading @@ -229,6 +235,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mContext.getSystemService(LauncherApps.class); launcherApps.startShortcut(packageName, shortcutId, null /* sourceBounds */, options, user); mStageCoordinator.evictOccludedChildren(position); } catch (ActivityNotFoundException e) { Slog.e(TAG, "Failed to launch shortcut", e); } Loading Loading @@ -272,6 +279,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, Slog.e(TAG, "Error finishing legacy transition: ", e); } } // Launching a new app into a specific split evicts tasks previously in the same // split. mStageCoordinator.evictOccludedChildren(position); } }; WindowContainerTransaction wct = new WindowContainerTransaction(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +6 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,12 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, wct, remoteTransition, this); } void evictOccludedChildren(@SplitPosition int position) { final WindowContainerTransaction wct = new WindowContainerTransaction(); (position == mSideStagePosition ? mSideStage : mMainStage).evictOccludedChildren(wct); mTaskOrganizer.applyTransaction(wct); } Bundle resolveStartStage(@SplitScreen.StageType int stage, @SplitPosition int position, @androidx.annotation.Nullable Bundle options, @androidx.annotation.Nullable WindowContainerTransaction wct) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +10 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { void onChildTaskStatusChanged(int taskId, boolean present, boolean visible); void onRootTaskVanished(); void onNoLongerSupportMultiWindow(); } Loading Loading @@ -247,6 +248,15 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { wct.reorder(mChildrenTaskInfo.get(taskId).token, onTop /* onTop */); } void evictOccludedChildren(WindowContainerTransaction wct) { for (int i = mChildrenTaskInfo.size() - 1; i >= 0; i--) { final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.valueAt(i); if (!taskInfo.isVisible) { wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); } } } void setVisibility(boolean visible, WindowContainerTransaction wct) { wct.reorder(mRootTaskInfo.token, visible /* onTop */); } Loading