Loading libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java +13 −18 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.wm.shell.fullscreen; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static com.android.wm.shell.ShellTaskOrganizer.TASK_LISTENER_TYPE_FULLSCREEN; import static com.android.wm.shell.ShellTaskOrganizer.taskListenerTypeToString; Loading Loading @@ -107,13 +105,14 @@ public class FullscreenTaskListener<T extends AutoCloseable> if (Transitions.ENABLE_SHELL_TRANSITIONS) return; updateRecentsForVisibleFullscreenTask(taskInfo); if (shouldShowWindowDecor(taskInfo) && mWindowDecorViewModelOptional.isPresent()) { if (mWindowDecorViewModelOptional.isPresent()) { SurfaceControl.Transaction t = new SurfaceControl.Transaction(); state.mWindowDecoration = mWindowDecorViewModelOptional.get().createWindowDecoration(taskInfo, leash, t, t); t.apply(); } else { } if (state.mWindowDecoration == null) { mSyncQueue.runInSync(t -> { // Reset several properties back to fullscreen (PiP, for example, leaves all these // properties in a bad state). Loading Loading @@ -178,13 +177,12 @@ public class FullscreenTaskListener<T extends AutoCloseable> public void createWindowDecoration(TransitionInfo.Change change, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { final State<T> state = createOrUpdateTaskState(change.getTaskInfo(), change.getLeash()); if (!mWindowDecorViewModelOptional.isPresent() || !shouldShowWindowDecor(state.mTaskInfo)) { return; } state.mWindowDecoration = mWindowDecorViewModelOptional.get().createWindowDecoration( if (!mWindowDecorViewModelOptional.isPresent()) return; T newWindowDecor = mWindowDecorViewModelOptional.get().createWindowDecoration( state.mTaskInfo, state.mLeash, startT, finishT); if (newWindowDecor != null) { state.mWindowDecoration = newWindowDecor; } } /** Loading @@ -202,8 +200,7 @@ public class FullscreenTaskListener<T extends AutoCloseable> SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT, @Nullable AutoCloseable windowDecor) { if (!mWindowDecorViewModelOptional.isPresent() || !shouldShowWindowDecor(change.getTaskInfo())) { if (!mWindowDecorViewModelOptional.isPresent()) { return false; } final State<T> state = createOrUpdateTaskState(change.getTaskInfo(), change.getLeash()); Loading @@ -214,8 +211,11 @@ public class FullscreenTaskListener<T extends AutoCloseable> state.mTaskInfo, startT, finishT, state.mWindowDecoration); return true; } else { state.mWindowDecoration = mWindowDecorViewModelOptional.get().createWindowDecoration( T newWindowDecor = mWindowDecorViewModelOptional.get().createWindowDecoration( state.mTaskInfo, state.mLeash, startT, finishT); if (newWindowDecor != null) { state.mWindowDecoration = newWindowDecor; } return false; } } Loading Loading @@ -336,10 +336,5 @@ public class FullscreenTaskListener<T extends AutoCloseable> return TAG + ":" + taskListenerTypeToString(TASK_LISTENER_TYPE_FULLSCREEN); } private static boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) { return taskInfo.getConfiguration().windowConfiguration.getDisplayWindowingMode() == WINDOWING_MODE_FREEFORM; } } libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +15 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import com.android.wm.shell.R; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.desktopmode.DesktopMode; import com.android.wm.shell.freeform.FreeformTaskTransitionStarter; import com.android.wm.shell.transition.Transitions; Loading Loading @@ -80,6 +81,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption SurfaceControl taskSurface, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { if (!shouldShowWindowDecor(taskInfo)) return null; final CaptionWindowDecoration windowDecoration = new CaptionWindowDecoration( mContext, mDisplayController, Loading @@ -101,9 +103,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption @Override public CaptionWindowDecoration adoptWindowDecoration(AutoCloseable windowDecor) { return (windowDecor instanceof CaptionWindowDecoration) ? (CaptionWindowDecoration) windowDecor : null; if (!(windowDecor instanceof CaptionWindowDecoration)) return null; final CaptionWindowDecoration captionWindowDecor = (CaptionWindowDecoration) windowDecor; if (!shouldShowWindowDecor(captionWindowDecor.mTaskInfo)) { return null; } return captionWindowDecor; } @Override Loading Loading @@ -231,4 +236,11 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption } } } private boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) { if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) return true; return DesktopMode.IS_SUPPORTED && mDisplayController.getDisplayContext(taskInfo.displayId) .getResources().getConfiguration().smallestScreenWidthDp >= 600; } } libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecorViewModel.java +4 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public interface WindowDecorViewModel<T extends AutoCloseable> { /** * Creates a window decoration for the given task. * Can be {@code null} for Fullscreen tasks but not Freeform ones. * * @param taskInfo the initial task info of the task * @param taskSurface the surface of the task Loading @@ -49,7 +50,7 @@ public interface WindowDecorViewModel<T extends AutoCloseable> { * @param finishT the finish transaction to restore states after the transition * @return the window decoration object */ T createWindowDecoration( @Nullable T createWindowDecoration( ActivityManager.RunningTaskInfo taskInfo, SurfaceControl taskSurface, SurfaceControl.Transaction startT, Loading @@ -57,11 +58,12 @@ public interface WindowDecorViewModel<T extends AutoCloseable> { /** * Adopts the window decoration if possible. * May be {@code null} if a window decor is not needed or the given one is incompatible. * * @param windowDecor the potential window decoration to adopt * @return the window decoration if it can be adopted, or {@code null} otherwise. */ T adoptWindowDecoration(@Nullable AutoCloseable windowDecor); @Nullable T adoptWindowDecoration(@Nullable AutoCloseable windowDecor); /** * Notifies a task info update on the given task, with the window decoration created previously Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/fullscreen/FullscreenTaskListener.java +13 −18 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.wm.shell.fullscreen; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static com.android.wm.shell.ShellTaskOrganizer.TASK_LISTENER_TYPE_FULLSCREEN; import static com.android.wm.shell.ShellTaskOrganizer.taskListenerTypeToString; Loading Loading @@ -107,13 +105,14 @@ public class FullscreenTaskListener<T extends AutoCloseable> if (Transitions.ENABLE_SHELL_TRANSITIONS) return; updateRecentsForVisibleFullscreenTask(taskInfo); if (shouldShowWindowDecor(taskInfo) && mWindowDecorViewModelOptional.isPresent()) { if (mWindowDecorViewModelOptional.isPresent()) { SurfaceControl.Transaction t = new SurfaceControl.Transaction(); state.mWindowDecoration = mWindowDecorViewModelOptional.get().createWindowDecoration(taskInfo, leash, t, t); t.apply(); } else { } if (state.mWindowDecoration == null) { mSyncQueue.runInSync(t -> { // Reset several properties back to fullscreen (PiP, for example, leaves all these // properties in a bad state). Loading Loading @@ -178,13 +177,12 @@ public class FullscreenTaskListener<T extends AutoCloseable> public void createWindowDecoration(TransitionInfo.Change change, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { final State<T> state = createOrUpdateTaskState(change.getTaskInfo(), change.getLeash()); if (!mWindowDecorViewModelOptional.isPresent() || !shouldShowWindowDecor(state.mTaskInfo)) { return; } state.mWindowDecoration = mWindowDecorViewModelOptional.get().createWindowDecoration( if (!mWindowDecorViewModelOptional.isPresent()) return; T newWindowDecor = mWindowDecorViewModelOptional.get().createWindowDecoration( state.mTaskInfo, state.mLeash, startT, finishT); if (newWindowDecor != null) { state.mWindowDecoration = newWindowDecor; } } /** Loading @@ -202,8 +200,7 @@ public class FullscreenTaskListener<T extends AutoCloseable> SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT, @Nullable AutoCloseable windowDecor) { if (!mWindowDecorViewModelOptional.isPresent() || !shouldShowWindowDecor(change.getTaskInfo())) { if (!mWindowDecorViewModelOptional.isPresent()) { return false; } final State<T> state = createOrUpdateTaskState(change.getTaskInfo(), change.getLeash()); Loading @@ -214,8 +211,11 @@ public class FullscreenTaskListener<T extends AutoCloseable> state.mTaskInfo, startT, finishT, state.mWindowDecoration); return true; } else { state.mWindowDecoration = mWindowDecorViewModelOptional.get().createWindowDecoration( T newWindowDecor = mWindowDecorViewModelOptional.get().createWindowDecoration( state.mTaskInfo, state.mLeash, startT, finishT); if (newWindowDecor != null) { state.mWindowDecoration = newWindowDecor; } return false; } } Loading Loading @@ -336,10 +336,5 @@ public class FullscreenTaskListener<T extends AutoCloseable> return TAG + ":" + taskListenerTypeToString(TASK_LISTENER_TYPE_FULLSCREEN); } private static boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) { return taskInfo.getConfiguration().windowConfiguration.getDisplayWindowingMode() == WINDOWING_MODE_FREEFORM; } }
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java +15 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import com.android.wm.shell.R; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.desktopmode.DesktopMode; import com.android.wm.shell.freeform.FreeformTaskTransitionStarter; import com.android.wm.shell.transition.Transitions; Loading Loading @@ -80,6 +81,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption SurfaceControl taskSurface, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { if (!shouldShowWindowDecor(taskInfo)) return null; final CaptionWindowDecoration windowDecoration = new CaptionWindowDecoration( mContext, mDisplayController, Loading @@ -101,9 +103,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption @Override public CaptionWindowDecoration adoptWindowDecoration(AutoCloseable windowDecor) { return (windowDecor instanceof CaptionWindowDecoration) ? (CaptionWindowDecoration) windowDecor : null; if (!(windowDecor instanceof CaptionWindowDecoration)) return null; final CaptionWindowDecoration captionWindowDecor = (CaptionWindowDecoration) windowDecor; if (!shouldShowWindowDecor(captionWindowDecor.mTaskInfo)) { return null; } return captionWindowDecor; } @Override Loading Loading @@ -231,4 +236,11 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel<Caption } } } private boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) { if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) return true; return DesktopMode.IS_SUPPORTED && mDisplayController.getDisplayContext(taskInfo.displayId) .getResources().getConfiguration().smallestScreenWidthDp >= 600; } }
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecorViewModel.java +4 −2 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public interface WindowDecorViewModel<T extends AutoCloseable> { /** * Creates a window decoration for the given task. * Can be {@code null} for Fullscreen tasks but not Freeform ones. * * @param taskInfo the initial task info of the task * @param taskSurface the surface of the task Loading @@ -49,7 +50,7 @@ public interface WindowDecorViewModel<T extends AutoCloseable> { * @param finishT the finish transaction to restore states after the transition * @return the window decoration object */ T createWindowDecoration( @Nullable T createWindowDecoration( ActivityManager.RunningTaskInfo taskInfo, SurfaceControl taskSurface, SurfaceControl.Transaction startT, Loading @@ -57,11 +58,12 @@ public interface WindowDecorViewModel<T extends AutoCloseable> { /** * Adopts the window decoration if possible. * May be {@code null} if a window decor is not needed or the given one is incompatible. * * @param windowDecor the potential window decoration to adopt * @return the window decoration if it can be adopted, or {@code null} otherwise. */ T adoptWindowDecoration(@Nullable AutoCloseable windowDecor); @Nullable T adoptWindowDecoration(@Nullable AutoCloseable windowDecor); /** * Notifies a task info update on the given task, with the window decoration created previously Loading