Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd996941 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas Committed by Android (Google) Code Review
Browse files

Merge "Fix SCM app letterboxing in desktop mode" into main

parents a14be25f bd5d38b6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ fun maximizeSizeGivenAspectRatio(
fun calculateAspectRatio(taskInfo: RunningTaskInfo): Float {
    val appLetterboxWidth = taskInfo.appCompatTaskInfo.topActivityLetterboxAppWidth
    val appLetterboxHeight = taskInfo.appCompatTaskInfo.topActivityLetterboxAppHeight
    if (taskInfo.appCompatTaskInfo.isTopActivityLetterboxed) {
    if (taskInfo.appCompatTaskInfo.isTopActivityLetterboxed || !taskInfo.canChangeAspectRatio) {
        return maxOf(appLetterboxWidth, appLetterboxHeight) /
            minOf(appLetterboxWidth, appLetterboxHeight).toFloat()
    }
+14 −8
Original line number Diff line number Diff line
@@ -2986,6 +2986,8 @@ class DesktopTasksControllerTest : ShellTestCase() {
        screenOrientation = SCREEN_ORIENTATION_LANDSCAPE
        configuration.windowConfiguration.appBounds = bounds
      }
      appCompatTaskInfo.topActivityLetterboxAppWidth = bounds.width()
      appCompatTaskInfo.topActivityLetterboxAppHeight = bounds.height()
      isResizeable = false
    }

@@ -3144,6 +3146,18 @@ class DesktopTasksControllerTest : ShellTestCase() {
      appCompatTaskInfo.isUserFullscreenOverrideEnabled = enableUserFullscreenOverride
      appCompatTaskInfo.isSystemFullscreenOverrideEnabled = enableSystemFullscreenOverride

      if (deviceOrientation == ORIENTATION_LANDSCAPE) {
        configuration.windowConfiguration.appBounds =
          Rect(0, 0, DISPLAY_DIMENSION_LONG, DISPLAY_DIMENSION_SHORT)
        appCompatTaskInfo.topActivityLetterboxAppWidth = DISPLAY_DIMENSION_LONG
        appCompatTaskInfo.topActivityLetterboxAppHeight = DISPLAY_DIMENSION_SHORT
      } else {
        configuration.windowConfiguration.appBounds =
          Rect(0, 0, DISPLAY_DIMENSION_SHORT, DISPLAY_DIMENSION_LONG)
        appCompatTaskInfo.topActivityLetterboxAppWidth = DISPLAY_DIMENSION_SHORT
        appCompatTaskInfo.topActivityLetterboxAppHeight = DISPLAY_DIMENSION_LONG
      }

      if (shouldLetterbox) {
        appCompatTaskInfo.setHasMinAspectRatioOverride(aspectRatioOverrideApplied)
        if (deviceOrientation == ORIENTATION_LANDSCAPE &&
@@ -3160,14 +3174,6 @@ class DesktopTasksControllerTest : ShellTestCase() {
          appCompatTaskInfo.topActivityLetterboxAppHeight = 1200
        }
      }

      if (deviceOrientation == ORIENTATION_LANDSCAPE) {
        configuration.windowConfiguration.appBounds =
            Rect(0, 0, DISPLAY_DIMENSION_LONG, DISPLAY_DIMENSION_SHORT)
      } else {
        configuration.windowConfiguration.appBounds =
            Rect(0, 0, DISPLAY_DIMENSION_SHORT, DISPLAY_DIMENSION_LONG)
      }
    }
    whenever(shellTaskOrganizer.getRunningTaskInfo(task.taskId)).thenReturn(task)
    runningTasks.add(task)