Loading libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java +25 −2 Original line number Diff line number Diff line Loading @@ -103,11 +103,17 @@ public class ShellTaskOrganizer extends TaskOrganizer implements // All TaskListeners should support compat UI except PIP. return true; } /** Attaches the a child window surface to the task surface. */ /** Attaches a child window surface to the task surface. */ default void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { throw new IllegalStateException( "This task listener doesn't support child surface attachment."); } /** Reparents a child window surface to the task surface. */ default void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { throw new IllegalStateException( "This task listener doesn't support child surface reparent."); } default void dump(@NonNull PrintWriter pw, String prefix) {}; } Loading Loading @@ -620,6 +626,23 @@ public class ShellTaskOrganizer extends TaskOrganizer implements updateCameraCompatControlState(info.getTaskInfo().token, state); } /** Reparents a child window surface to the task surface. */ public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { final TaskListener taskListener; synchronized (mLock) { taskListener = mTasks.contains(taskId) ? getTaskListener(mTasks.get(taskId).getTaskInfo()) : null; } if (taskListener == null) { ProtoLog.w(WM_SHELL_TASK_ORG, "Failed to find Task to reparent surface taskId=%d", taskId); return; } taskListener.reparentChildSurfaceToTask(taskId, sc, t); } private void logSizeCompatRestartButtonEventReported(@NonNull TaskAppearedInfo info, int event) { ActivityInfo topActivityInfo = info.getTaskInfo().topActivityInfo; Loading libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java +12 −2 Original line number Diff line number Diff line Loading @@ -367,10 +367,20 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { if (mTaskInfo.taskId != taskId) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (mTaskInfo == null || mTaskLeash == null || mTaskInfo.taskId != taskId) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } b.setParent(mTaskLeash); return mTaskLeash; } @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/apppairs/AppPair.java +13 −3 Original line number Diff line number Diff line Loading @@ -275,12 +275,22 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.SplitLayou @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (getRootTaskId() == taskId) { b.setParent(mRootTaskLeash); return mRootTaskLeash; } else if (getTaskId1() == taskId) { b.setParent(mTaskLeash1); return mTaskLeash1; } else if (getTaskId2() == taskId) { b.setParent(mTaskLeash2); return mTaskLeash2; } else { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskListener.java +18 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,24 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { }); } @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (!mTasks.contains(taskId)) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } return mTasks.get(taskId).mLeash; } @Override public void dump(PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; Loading libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java +11 −1 Original line number Diff line number Diff line Loading @@ -133,10 +133,20 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener { @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (!mDataByTaskId.contains(taskId)) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } b.setParent(mDataByTaskId.get(taskId).surface); return mDataByTaskId.get(taskId).surface; } @Override Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java +25 −2 Original line number Diff line number Diff line Loading @@ -103,11 +103,17 @@ public class ShellTaskOrganizer extends TaskOrganizer implements // All TaskListeners should support compat UI except PIP. return true; } /** Attaches the a child window surface to the task surface. */ /** Attaches a child window surface to the task surface. */ default void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { throw new IllegalStateException( "This task listener doesn't support child surface attachment."); } /** Reparents a child window surface to the task surface. */ default void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { throw new IllegalStateException( "This task listener doesn't support child surface reparent."); } default void dump(@NonNull PrintWriter pw, String prefix) {}; } Loading Loading @@ -620,6 +626,23 @@ public class ShellTaskOrganizer extends TaskOrganizer implements updateCameraCompatControlState(info.getTaskInfo().token, state); } /** Reparents a child window surface to the task surface. */ public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { final TaskListener taskListener; synchronized (mLock) { taskListener = mTasks.contains(taskId) ? getTaskListener(mTasks.get(taskId).getTaskInfo()) : null; } if (taskListener == null) { ProtoLog.w(WM_SHELL_TASK_ORG, "Failed to find Task to reparent surface taskId=%d", taskId); return; } taskListener.reparentChildSurfaceToTask(taskId, sc, t); } private void logSizeCompatRestartButtonEventReported(@NonNull TaskAppearedInfo info, int event) { ActivityInfo topActivityInfo = info.getTaskInfo().topActivityInfo; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java +12 −2 Original line number Diff line number Diff line Loading @@ -367,10 +367,20 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { if (mTaskInfo.taskId != taskId) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (mTaskInfo == null || mTaskLeash == null || mTaskInfo.taskId != taskId) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } b.setParent(mTaskLeash); return mTaskLeash; } @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/apppairs/AppPair.java +13 −3 Original line number Diff line number Diff line Loading @@ -275,12 +275,22 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.SplitLayou @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (getRootTaskId() == taskId) { b.setParent(mRootTaskLeash); return mRootTaskLeash; } else if (getTaskId1() == taskId) { b.setParent(mTaskLeash1); return mTaskLeash1; } else if (getTaskId2() == taskId) { b.setParent(mTaskLeash2); return mTaskLeash2; } else { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskListener.java +18 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,24 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { }); } @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (!mTasks.contains(taskId)) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } return mTasks.get(taskId).mLeash; } @Override public void dump(PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java +11 −1 Original line number Diff line number Diff line Loading @@ -133,10 +133,20 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener { @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { b.setParent(findTaskSurface(taskId)); } @Override public void reparentChildSurfaceToTask(int taskId, SurfaceControl sc, SurfaceControl.Transaction t) { t.reparent(sc, findTaskSurface(taskId)); } private SurfaceControl findTaskSurface(int taskId) { if (!mDataByTaskId.contains(taskId)) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } b.setParent(mDataByTaskId.get(taskId).surface); return mDataByTaskId.get(taskId).surface; } @Override Loading