Loading core/java/com/android/internal/jank/Cuj.java +17 −2 Original line number Diff line number Diff line Loading @@ -235,8 +235,19 @@ public class Cuj { */ public static final int CUJ_DESKTOP_MODE_SNAP_RESIZE = 118; /** * Track unmaximize window interaction in desktop mode. * * <p> Tracking starts when the maximize button or option is clicked {@link * com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModel#onClick} * and finishes when the animation finishes {@link * com.android.wm.shell.windowdecor.ToggleResizeDesktopTaskTransitionHandler#startAnimation} * </p> */ public static final int CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW = 119; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_SNAP_RESIZE; @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW; /** @hide */ @IntDef({ Loading Loading @@ -346,7 +357,8 @@ public class Cuj { CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_APP_LAUNCH, CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE, CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE, CUJ_DESKTOP_MODE_SNAP_RESIZE CUJ_DESKTOP_MODE_SNAP_RESIZE, CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -467,6 +479,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_SNAP_RESIZE] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_SNAP_RESIZE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_UNMAXIMIZE_WINDOW; } private Cuj() { Loading Loading @@ -699,6 +712,8 @@ public class Cuj { return "DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE"; case CUJ_DESKTOP_MODE_SNAP_RESIZE: return "DESKTOP_MODE_SNAP_RESIZE"; case CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW: return "DESKTOP_MODE_UNMAXIMIZE_WINDOW"; } return "UNKNOWN"; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +5 −1 Original line number Diff line number Diff line Loading @@ -797,6 +797,8 @@ class DesktopTasksController( taskInfo: RunningTaskInfo, resizeTrigger: ResizeTrigger, inputMethod: InputMethod, maximizeCujRecorder: (() -> Unit)? = null, unmaximizeCujRecorder: (() -> Unit)? = null, ) { val currentTaskBounds = taskInfo.configuration.windowConfiguration.bounds desktopModeEventLogger.logTaskResizingStarted( Loading @@ -818,6 +820,7 @@ class DesktopTasksController( // helpful to eliminate the current task from logic to calculate taskbar corner rounding. val willMaximize = !isMaximized if (isMaximized) { unmaximizeCujRecorder?.invoke() // The desktop task is at the maximized width and/or height of the stable bounds. // If the task's pre-maximize stable bounds were saved, toggle the task to those bounds. // Otherwise, toggle to the default bounds. Loading @@ -833,6 +836,7 @@ class DesktopTasksController( } } } else { maximizeCujRecorder?.invoke() // Save current bounds so that task can be restored back to original bounds if necessary // and toggle to the stable bounds. desktopTilingDecorViewModel.removeTaskIfTiled(taskInfo.displayId, taskInfo.taskId) Loading Loading @@ -889,7 +893,7 @@ class DesktopTasksController( toggleDesktopTaskSize( taskInfo, ResizeTrigger.DRAG_TO_TOP_RESIZE_TRIGGER, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent) DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent), ) } Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/ToggleResizeDesktopTaskTransitionHandler.kt +1 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ class ToggleResizeDesktopTaskTransitionHandler( initialBounds = null boundsAnimator = null interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW) interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW) interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_SNAP_RESIZE) } ) Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +11 −4 Original line number Diff line number Diff line Loading @@ -586,11 +586,18 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, if (decoration == null) { return; } mDesktopTasksController.toggleDesktopTaskSize(decoration.mTaskInfo, resizeTrigger, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent), () -> { mInteractionJankMonitor.begin( decoration.mTaskSurface, mContext, mMainHandler, Cuj.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW, source); mDesktopTasksController.toggleDesktopTaskSize(decoration.mTaskInfo, resizeTrigger, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent)); return null; }, () -> { mInteractionJankMonitor.begin( decoration.mTaskSurface, mContext, mMainHandler, Cuj.CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW, source); return null; }); decoration.closeHandleMenu(); decoration.closeMaximizeMenu(); } Loading libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/UnmaximizeAppWindowTest.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.functional import android.platform.test.annotations.Postsubmit import com.android.wm.shell.scenarios.UnmaximizeAppWindow import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [UnmaximizeAppWindow]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit class UnmaximizeAppWindowTest : UnmaximizeAppWindow() Loading
core/java/com/android/internal/jank/Cuj.java +17 −2 Original line number Diff line number Diff line Loading @@ -235,8 +235,19 @@ public class Cuj { */ public static final int CUJ_DESKTOP_MODE_SNAP_RESIZE = 118; /** * Track unmaximize window interaction in desktop mode. * * <p> Tracking starts when the maximize button or option is clicked {@link * com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModel#onClick} * and finishes when the animation finishes {@link * com.android.wm.shell.windowdecor.ToggleResizeDesktopTaskTransitionHandler#startAnimation} * </p> */ public static final int CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW = 119; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_SNAP_RESIZE; @VisibleForTesting static final int LAST_CUJ = CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW; /** @hide */ @IntDef({ Loading Loading @@ -346,7 +357,8 @@ public class Cuj { CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_APP_LAUNCH, CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE, CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE, CUJ_DESKTOP_MODE_SNAP_RESIZE CUJ_DESKTOP_MODE_SNAP_RESIZE, CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -467,6 +479,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_RELEASE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_SNAP_RESIZE] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_SNAP_RESIZE; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_UNMAXIMIZE_WINDOW; } private Cuj() { Loading Loading @@ -699,6 +712,8 @@ public class Cuj { return "DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE"; case CUJ_DESKTOP_MODE_SNAP_RESIZE: return "DESKTOP_MODE_SNAP_RESIZE"; case CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW: return "DESKTOP_MODE_UNMAXIMIZE_WINDOW"; } return "UNKNOWN"; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +5 −1 Original line number Diff line number Diff line Loading @@ -797,6 +797,8 @@ class DesktopTasksController( taskInfo: RunningTaskInfo, resizeTrigger: ResizeTrigger, inputMethod: InputMethod, maximizeCujRecorder: (() -> Unit)? = null, unmaximizeCujRecorder: (() -> Unit)? = null, ) { val currentTaskBounds = taskInfo.configuration.windowConfiguration.bounds desktopModeEventLogger.logTaskResizingStarted( Loading @@ -818,6 +820,7 @@ class DesktopTasksController( // helpful to eliminate the current task from logic to calculate taskbar corner rounding. val willMaximize = !isMaximized if (isMaximized) { unmaximizeCujRecorder?.invoke() // The desktop task is at the maximized width and/or height of the stable bounds. // If the task's pre-maximize stable bounds were saved, toggle the task to those bounds. // Otherwise, toggle to the default bounds. Loading @@ -833,6 +836,7 @@ class DesktopTasksController( } } } else { maximizeCujRecorder?.invoke() // Save current bounds so that task can be restored back to original bounds if necessary // and toggle to the stable bounds. desktopTilingDecorViewModel.removeTaskIfTiled(taskInfo.displayId, taskInfo.taskId) Loading Loading @@ -889,7 +893,7 @@ class DesktopTasksController( toggleDesktopTaskSize( taskInfo, ResizeTrigger.DRAG_TO_TOP_RESIZE_TRIGGER, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent) DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent), ) } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/ToggleResizeDesktopTaskTransitionHandler.kt +1 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ class ToggleResizeDesktopTaskTransitionHandler( initialBounds = null boundsAnimator = null interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW) interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW) interactionJankMonitor.end(Cuj.CUJ_DESKTOP_MODE_SNAP_RESIZE) } ) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +11 −4 Original line number Diff line number Diff line Loading @@ -586,11 +586,18 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, if (decoration == null) { return; } mDesktopTasksController.toggleDesktopTaskSize(decoration.mTaskInfo, resizeTrigger, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent), () -> { mInteractionJankMonitor.begin( decoration.mTaskSurface, mContext, mMainHandler, Cuj.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW, source); mDesktopTasksController.toggleDesktopTaskSize(decoration.mTaskInfo, resizeTrigger, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent)); return null; }, () -> { mInteractionJankMonitor.begin( decoration.mTaskSurface, mContext, mMainHandler, Cuj.CUJ_DESKTOP_MODE_UNMAXIMIZE_WINDOW, source); return null; }); decoration.closeHandleMenu(); decoration.closeMaximizeMenu(); } Loading
libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/functional/UnmaximizeAppWindowTest.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.functional import android.platform.test.annotations.Postsubmit import com.android.wm.shell.scenarios.UnmaximizeAppWindow import org.junit.runner.RunWith import org.junit.runners.BlockJUnit4ClassRunner /* Functional test for [UnmaximizeAppWindow]. */ @RunWith(BlockJUnit4ClassRunner::class) @Postsubmit class UnmaximizeAppWindowTest : UnmaximizeAppWindow()