Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +3 −1 Original line number Diff line number Diff line Loading @@ -3427,9 +3427,11 @@ class DesktopTasksController( // If caption insets should be excluded from app bounds, ensure caption insets // are excluded from the ideal initial bounds when scaling non-resizeable apps. // Caption insets stay fixed and don't scale with bounds. val displayId = taskRepository.getDisplayForDesk(deskId) val displayContext = displayController.getDisplayContext(displayId) ?: context val captionInsets = if (desktopModeCompatPolicy.shouldExcludeCaptionFromAppBounds(taskInfo)) { getDesktopViewAppHeaderHeightPx(context) getDesktopViewAppHeaderHeightPx(displayContext) } else { 0 } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -1582,7 +1582,9 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() controller.addMoveToDeskTaskChanges(wct, task, deskId = 0) val finalBounds = findBoundsChange(wct, task) val captionInsets = getDesktopViewAppHeaderHeightPx(context) val displayId = taskRepository.getDisplayForDesk(deskId = 0) val displayContext = displayController.getDisplayContext(displayId) ?: context val captionInsets = getDesktopViewAppHeaderHeightPx(displayContext) finalBounds!!.top += captionInsets val finalAspectRatio = maxOf(finalBounds.height(), finalBounds.width()) / Loading @@ -1604,7 +1606,9 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() controller.addMoveToDeskTaskChanges(wct, task, deskId = 0) val finalBounds = findBoundsChange(wct, task) val captionInsets = getDesktopViewAppHeaderHeightPx(context) val displayId = taskRepository.getDisplayForDesk(deskId = 0) val displayContext = displayController.getDisplayContext(displayId) ?: context val captionInsets = getDesktopViewAppHeaderHeightPx(displayContext) finalBounds!!.top += captionInsets val finalAspectRatio = maxOf(finalBounds.height(), finalBounds.width()) / Loading services/core/java/com/android/server/wm/DesktopModeBoundsCalculator.java +6 −1 Original line number Diff line number Diff line Loading @@ -32,11 +32,13 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.WindowConfiguration; import android.content.Context; import android.content.pm.ActivityInfo.WindowLayout; import android.content.res.Configuration; import android.graphics.Rect; import android.os.SystemProperties; import android.util.Size; import android.view.Display; import android.view.Gravity; import android.window.DesktopModeFlags; Loading Loading @@ -83,9 +85,12 @@ public final class DesktopModeBoundsCalculator { // during the size update. final boolean shouldRespectOptionPosition = updateOptionBoundsSize && DesktopModeFlags.ENABLE_CASCADING_WINDOWS.isTrue(); // Calculate caption height for target display if needed. final Display targetDisplay = task.getDisplayArea().mDisplayContent.getDisplay(); final Context displayContext = task.mWmService.mContext.createDisplayContext(targetDisplay); final int captionHeight = activity != null && shouldExcludeCaptionFromAppBounds( activity.info, task.isResizeable(), activity.mOptOutEdgeToEdge) ? getDesktopViewAppHeaderHeightPx(activity.mWmService.mContext) : 0; ? getDesktopViewAppHeaderHeightPx(displayContext) : 0; if (options != null && options.getLaunchBounds() != null && !updateOptionBoundsSize) { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +3 −1 Original line number Diff line number Diff line Loading @@ -3427,9 +3427,11 @@ class DesktopTasksController( // If caption insets should be excluded from app bounds, ensure caption insets // are excluded from the ideal initial bounds when scaling non-resizeable apps. // Caption insets stay fixed and don't scale with bounds. val displayId = taskRepository.getDisplayForDesk(deskId) val displayContext = displayController.getDisplayContext(displayId) ?: context val captionInsets = if (desktopModeCompatPolicy.shouldExcludeCaptionFromAppBounds(taskInfo)) { getDesktopViewAppHeaderHeightPx(context) getDesktopViewAppHeaderHeightPx(displayContext) } else { 0 } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +6 −2 Original line number Diff line number Diff line Loading @@ -1582,7 +1582,9 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() controller.addMoveToDeskTaskChanges(wct, task, deskId = 0) val finalBounds = findBoundsChange(wct, task) val captionInsets = getDesktopViewAppHeaderHeightPx(context) val displayId = taskRepository.getDisplayForDesk(deskId = 0) val displayContext = displayController.getDisplayContext(displayId) ?: context val captionInsets = getDesktopViewAppHeaderHeightPx(displayContext) finalBounds!!.top += captionInsets val finalAspectRatio = maxOf(finalBounds.height(), finalBounds.width()) / Loading @@ -1604,7 +1606,9 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() controller.addMoveToDeskTaskChanges(wct, task, deskId = 0) val finalBounds = findBoundsChange(wct, task) val captionInsets = getDesktopViewAppHeaderHeightPx(context) val displayId = taskRepository.getDisplayForDesk(deskId = 0) val displayContext = displayController.getDisplayContext(displayId) ?: context val captionInsets = getDesktopViewAppHeaderHeightPx(displayContext) finalBounds!!.top += captionInsets val finalAspectRatio = maxOf(finalBounds.height(), finalBounds.width()) / Loading
services/core/java/com/android/server/wm/DesktopModeBoundsCalculator.java +6 −1 Original line number Diff line number Diff line Loading @@ -32,11 +32,13 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.WindowConfiguration; import android.content.Context; import android.content.pm.ActivityInfo.WindowLayout; import android.content.res.Configuration; import android.graphics.Rect; import android.os.SystemProperties; import android.util.Size; import android.view.Display; import android.view.Gravity; import android.window.DesktopModeFlags; Loading Loading @@ -83,9 +85,12 @@ public final class DesktopModeBoundsCalculator { // during the size update. final boolean shouldRespectOptionPosition = updateOptionBoundsSize && DesktopModeFlags.ENABLE_CASCADING_WINDOWS.isTrue(); // Calculate caption height for target display if needed. final Display targetDisplay = task.getDisplayArea().mDisplayContent.getDisplay(); final Context displayContext = task.mWmService.mContext.createDisplayContext(targetDisplay); final int captionHeight = activity != null && shouldExcludeCaptionFromAppBounds( activity.info, task.isResizeable(), activity.mOptOutEdgeToEdge) ? getDesktopViewAppHeaderHeightPx(activity.mWmService.mContext) : 0; ? getDesktopViewAppHeaderHeightPx(displayContext) : 0; if (options != null && options.getLaunchBounds() != null && !updateOptionBoundsSize) { Loading