Loading services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java +5 −4 Original line number Diff line number Diff line Loading @@ -69,11 +69,11 @@ public class DesktopAppCompatAspectRatioPolicy { * Calculates the final aspect ratio of an launching activity based on the task it will be * launched in. Takes into account any min or max aspect ratio constraints. */ float calculateAspectRatio(@NonNull Task task) { float calculateAspectRatio(@NonNull Task task, boolean hasOrientationMismatch) { final float maxAspectRatio = getMaxAspectRatio(); final float minAspectRatio = getMinAspectRatio(task); float desiredAspectRatio = 0; desiredAspectRatio = getDesiredAspectRatio(task); desiredAspectRatio = getDesiredAspectRatio(task, hasOrientationMismatch); if (maxAspectRatio >= 1 && desiredAspectRatio > maxAspectRatio) { desiredAspectRatio = maxAspectRatio; } else if (minAspectRatio >= 1 && desiredAspectRatio < minAspectRatio) { Loading @@ -87,13 +87,14 @@ public class DesktopAppCompatAspectRatioPolicy { * any min or max aspect ratio constraints. */ @VisibleForTesting float getDesiredAspectRatio(@NonNull Task task) { float getDesiredAspectRatio(@NonNull Task task, boolean hasOrientationMismatch) { final float letterboxAspectRatioOverride = getFixedOrientationLetterboxAspectRatio(task); // Aspect ratio as suggested by the system. Apps requested mix/max aspect ratio will // be respected in #calculateAspectRatio. if (isDefaultMultiWindowLetterboxAspectRatioDesired(task)) { return DEFAULT_LETTERBOX_ASPECT_RATIO_FOR_MULTI_WINDOW; } else if (letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO) { } else if (hasOrientationMismatch && letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO) { return letterboxAspectRatioOverride; } return AppCompatUtils.computeAspectRatio(task.getDisplayArea().getBounds()); Loading services/core/java/com/android/server/wm/DesktopModeBoundsCalculator.java +26 −17 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LOCKED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.isFixedOrientation; import static android.content.pm.ActivityInfo.isFixedOrientationLandscape; import static android.content.pm.ActivityInfo.isFixedOrientationPortrait; Loading @@ -32,8 +31,8 @@ import static com.android.server.wm.LaunchParamsUtil.calculateLayoutBounds; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityOptions; import android.content.pm.ActivityInfo.ScreenOrientation; import android.content.pm.ActivityInfo.WindowLayout; import android.content.res.Configuration; import android.graphics.Rect; import android.os.SystemProperties; import android.util.Size; Loading Loading @@ -152,19 +151,25 @@ public final class DesktopModeBoundsCalculator { } final DesktopAppCompatAspectRatioPolicy desktopAppCompatAspectRatioPolicy = activity.mAppCompatController.getDesktopAspectRatioPolicy(); float appAspectRatio = desktopAppCompatAspectRatioPolicy.calculateAspectRatio(task); final int stableBoundsOrientation = stableBounds.height() >= stableBounds.width() ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; int activityOrientation = getActivityConfigurationOrientation( activity, task, stableBoundsOrientation); // Use orientation mismatch to resolve aspect ratio to match fixed orientation letterboxing // policy in {@link ActivityRecord.resolveFixedOrientationConfiguration} final boolean hasOrientationMismatch = stableBoundsOrientation != activityOrientation; float appAspectRatio = desktopAppCompatAspectRatioPolicy.calculateAspectRatio( task, hasOrientationMismatch); final float tdaWidth = stableBounds.width(); final float tdaHeight = stableBounds.height(); final int taskConfigOrientation = task.getConfiguration().orientation; final int activityOrientation = getActivityOrientation(activity, task); final Size initialSize = switch (taskConfigOrientation) { final Size initialSize = switch (stableBoundsOrientation) { case ORIENTATION_LANDSCAPE -> { // Device in landscape orientation. if (appAspectRatio == 0) { appAspectRatio = 1; } if (canChangeAspectRatio(desktopAppCompatAspectRatioPolicy, task)) { if (isFixedOrientationPortrait(activityOrientation)) { if (hasOrientationMismatch) { // For portrait resizeable activities, respect apps fullscreen width but // apply ideal size height. yield new Size((int) ((tdaHeight / appAspectRatio) + 0.5f), Loading @@ -183,7 +188,7 @@ public final class DesktopModeBoundsCalculator { final int customPortraitWidthForLandscapeApp = screenBounds.width() - (DESKTOP_MODE_LANDSCAPE_APP_PADDING * 2); if (canChangeAspectRatio(desktopAppCompatAspectRatioPolicy, task)) { if (isFixedOrientationLandscape(activityOrientation)) { if (hasOrientationMismatch) { if (appAspectRatio == 0) { appAspectRatio = tdaWidth / (tdaWidth - 1); } Loading @@ -198,7 +203,7 @@ public final class DesktopModeBoundsCalculator { if (appAspectRatio == 0) { appAspectRatio = 1; } if (isFixedOrientationLandscape(activityOrientation)) { if (hasOrientationMismatch) { // For landscape unresizeable activities, apply custom app width to ideal size // and calculate maximum size with this area while maintaining original aspect // ratio. Loading Loading @@ -230,19 +235,23 @@ public final class DesktopModeBoundsCalculator { && !desktopAppCompatAspectRatioPolicy.hasMinAspectRatioOverride(task); } private static @ScreenOrientation int getActivityOrientation( @NonNull ActivityRecord activity, @NonNull Task task) { private static @Configuration.Orientation int getActivityConfigurationOrientation( @NonNull ActivityRecord activity, @NonNull Task task, @Configuration.Orientation int stableBoundsOrientation) { final int activityOrientation = activity.getOverrideOrientation(); final DesktopAppCompatAspectRatioPolicy desktopAppCompatAspectRatioPolicy = activity.mAppCompatController.getDesktopAspectRatioPolicy(); if (desktopAppCompatAspectRatioPolicy.shouldApplyUserMinAspectRatioOverride(task) if ((desktopAppCompatAspectRatioPolicy.shouldApplyUserMinAspectRatioOverride(task) && (!isFixedOrientation(activityOrientation) || activityOrientation == SCREEN_ORIENTATION_LOCKED)) { || activityOrientation == SCREEN_ORIENTATION_LOCKED)) || isFixedOrientationPortrait(activityOrientation)) { // If a user aspect ratio override should be applied, treat the activity as portrait if // it has not specified a fix orientation. return SCREEN_ORIENTATION_PORTRAIT; return ORIENTATION_PORTRAIT; } return activityOrientation; // If activity orientation is undefined inherit task orientation. return isFixedOrientationLandscape(activityOrientation) ? ORIENTATION_LANDSCAPE : stableBoundsOrientation; } /** Loading @@ -252,7 +261,7 @@ public final class DesktopModeBoundsCalculator { // TODO(b/400617906): Merge duplicate initial bounds calculations to shared class. @NonNull private static Size maximizeSizeGivenAspectRatio( @ScreenOrientation int orientation, @Configuration.Orientation int orientation, @NonNull Size targetArea, float aspectRatio, int captionHeight Loading @@ -261,7 +270,7 @@ public final class DesktopModeBoundsCalculator { final int targetWidth = targetArea.getWidth(); final int finalHeight; final int finalWidth; if (isFixedOrientationPortrait(orientation)) { if (orientation == ORIENTATION_PORTRAIT) { // Portrait activity. // Calculate required width given ideal height and aspect ratio. int tempWidth = (int) (targetHeight / aspectRatio); Loading services/tests/wmtests/src/com/android/server/wm/DesktopAppCompatAspectRatioPolicyTests.java +3 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.server.wm.AppCompatConfiguration.DEFAULT_LETTERBOX_ASP import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import android.compat.testing.PlatformCompatChangeRule; import android.content.pm.ActivityInfo; Loading Loading @@ -413,7 +414,7 @@ public class DesktopAppCompatAspectRatioPolicyTests extends WindowTestsBase { void setDesiredAspectRatio(float aspectRatio) { doReturn(aspectRatio).when(getDesktopAppCompatAspectRatioPolicy()) .getDesiredAspectRatio(any()); .getDesiredAspectRatio(any(), anyBoolean()); } DesktopAppCompatAspectRatioPolicy getDesktopAppCompatAspectRatioPolicy() { Loading @@ -422,7 +423,7 @@ public class DesktopAppCompatAspectRatioPolicyTests extends WindowTestsBase { float calculateAspectRatio() { return getDesktopAppCompatAspectRatioPolicy().calculateAspectRatio( getTopActivity().getTask()); getTopActivity().getTask(), /* hasOrientationMismatch */ true); } ActivityRecord getTopActivity() { Loading services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +7 −6 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier. import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; Loading Loading @@ -437,7 +438,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredWidth = (int) ((LANDSCAPE_DISPLAY_BOUNDS.height() / LETTERBOX_ASPECT_RATIO) + 0.5f); Loading Loading @@ -933,7 +934,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredHeight = (int) (LANDSCAPE_DISPLAY_BOUNDS.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); Loading Loading @@ -1060,7 +1061,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredWidth = PORTRAIT_DISPLAY_BOUNDS.width() - (DESKTOP_MODE_LANDSCAPE_APP_PADDING * 2); Loading Loading @@ -1115,7 +1116,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredWidth = PORTRAIT_DISPLAY_BOUNDS.width() - (DESKTOP_MODE_LANDSCAPE_APP_PADDING * 2); Loading Loading @@ -1569,7 +1570,7 @@ public class DesktopModeLaunchParamsModifierTests extends activity.mAppCompatController.getDesktopAspectRatioPolicy(); spyOn(desktopAppCompatAspectRatioPolicy); doReturn(aspectRatio).when(desktopAppCompatAspectRatioPolicy) .getDesiredAspectRatio(any()); .getDesiredAspectRatio(any(), anyBoolean()); } private void applyUserMinAspectRatioOverride(ActivityRecord activity, int overrideCode, Loading @@ -1579,7 +1580,7 @@ public class DesktopModeLaunchParamsModifierTests extends activity.mAppCompatController.getDesktopAspectRatioPolicy(); spyOn(desktopAppCompatAspectRatioPolicy); doReturn(1f).when(desktopAppCompatAspectRatioPolicy) .getDesiredAspectRatio(any()); .getDesiredAspectRatio(any(), anyBoolean()); // Enable user aspect ratio settings final AppCompatConfiguration appCompatConfiguration = Loading Loading
services/core/java/com/android/server/wm/DesktopAppCompatAspectRatioPolicy.java +5 −4 Original line number Diff line number Diff line Loading @@ -69,11 +69,11 @@ public class DesktopAppCompatAspectRatioPolicy { * Calculates the final aspect ratio of an launching activity based on the task it will be * launched in. Takes into account any min or max aspect ratio constraints. */ float calculateAspectRatio(@NonNull Task task) { float calculateAspectRatio(@NonNull Task task, boolean hasOrientationMismatch) { final float maxAspectRatio = getMaxAspectRatio(); final float minAspectRatio = getMinAspectRatio(task); float desiredAspectRatio = 0; desiredAspectRatio = getDesiredAspectRatio(task); desiredAspectRatio = getDesiredAspectRatio(task, hasOrientationMismatch); if (maxAspectRatio >= 1 && desiredAspectRatio > maxAspectRatio) { desiredAspectRatio = maxAspectRatio; } else if (minAspectRatio >= 1 && desiredAspectRatio < minAspectRatio) { Loading @@ -87,13 +87,14 @@ public class DesktopAppCompatAspectRatioPolicy { * any min or max aspect ratio constraints. */ @VisibleForTesting float getDesiredAspectRatio(@NonNull Task task) { float getDesiredAspectRatio(@NonNull Task task, boolean hasOrientationMismatch) { final float letterboxAspectRatioOverride = getFixedOrientationLetterboxAspectRatio(task); // Aspect ratio as suggested by the system. Apps requested mix/max aspect ratio will // be respected in #calculateAspectRatio. if (isDefaultMultiWindowLetterboxAspectRatioDesired(task)) { return DEFAULT_LETTERBOX_ASPECT_RATIO_FOR_MULTI_WINDOW; } else if (letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO) { } else if (hasOrientationMismatch && letterboxAspectRatioOverride > MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO) { return letterboxAspectRatioOverride; } return AppCompatUtils.computeAspectRatio(task.getDisplayArea().getBounds()); Loading
services/core/java/com/android/server/wm/DesktopModeBoundsCalculator.java +26 −17 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LOCKED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.isFixedOrientation; import static android.content.pm.ActivityInfo.isFixedOrientationLandscape; import static android.content.pm.ActivityInfo.isFixedOrientationPortrait; Loading @@ -32,8 +31,8 @@ import static com.android.server.wm.LaunchParamsUtil.calculateLayoutBounds; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityOptions; import android.content.pm.ActivityInfo.ScreenOrientation; import android.content.pm.ActivityInfo.WindowLayout; import android.content.res.Configuration; import android.graphics.Rect; import android.os.SystemProperties; import android.util.Size; Loading Loading @@ -152,19 +151,25 @@ public final class DesktopModeBoundsCalculator { } final DesktopAppCompatAspectRatioPolicy desktopAppCompatAspectRatioPolicy = activity.mAppCompatController.getDesktopAspectRatioPolicy(); float appAspectRatio = desktopAppCompatAspectRatioPolicy.calculateAspectRatio(task); final int stableBoundsOrientation = stableBounds.height() >= stableBounds.width() ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; int activityOrientation = getActivityConfigurationOrientation( activity, task, stableBoundsOrientation); // Use orientation mismatch to resolve aspect ratio to match fixed orientation letterboxing // policy in {@link ActivityRecord.resolveFixedOrientationConfiguration} final boolean hasOrientationMismatch = stableBoundsOrientation != activityOrientation; float appAspectRatio = desktopAppCompatAspectRatioPolicy.calculateAspectRatio( task, hasOrientationMismatch); final float tdaWidth = stableBounds.width(); final float tdaHeight = stableBounds.height(); final int taskConfigOrientation = task.getConfiguration().orientation; final int activityOrientation = getActivityOrientation(activity, task); final Size initialSize = switch (taskConfigOrientation) { final Size initialSize = switch (stableBoundsOrientation) { case ORIENTATION_LANDSCAPE -> { // Device in landscape orientation. if (appAspectRatio == 0) { appAspectRatio = 1; } if (canChangeAspectRatio(desktopAppCompatAspectRatioPolicy, task)) { if (isFixedOrientationPortrait(activityOrientation)) { if (hasOrientationMismatch) { // For portrait resizeable activities, respect apps fullscreen width but // apply ideal size height. yield new Size((int) ((tdaHeight / appAspectRatio) + 0.5f), Loading @@ -183,7 +188,7 @@ public final class DesktopModeBoundsCalculator { final int customPortraitWidthForLandscapeApp = screenBounds.width() - (DESKTOP_MODE_LANDSCAPE_APP_PADDING * 2); if (canChangeAspectRatio(desktopAppCompatAspectRatioPolicy, task)) { if (isFixedOrientationLandscape(activityOrientation)) { if (hasOrientationMismatch) { if (appAspectRatio == 0) { appAspectRatio = tdaWidth / (tdaWidth - 1); } Loading @@ -198,7 +203,7 @@ public final class DesktopModeBoundsCalculator { if (appAspectRatio == 0) { appAspectRatio = 1; } if (isFixedOrientationLandscape(activityOrientation)) { if (hasOrientationMismatch) { // For landscape unresizeable activities, apply custom app width to ideal size // and calculate maximum size with this area while maintaining original aspect // ratio. Loading Loading @@ -230,19 +235,23 @@ public final class DesktopModeBoundsCalculator { && !desktopAppCompatAspectRatioPolicy.hasMinAspectRatioOverride(task); } private static @ScreenOrientation int getActivityOrientation( @NonNull ActivityRecord activity, @NonNull Task task) { private static @Configuration.Orientation int getActivityConfigurationOrientation( @NonNull ActivityRecord activity, @NonNull Task task, @Configuration.Orientation int stableBoundsOrientation) { final int activityOrientation = activity.getOverrideOrientation(); final DesktopAppCompatAspectRatioPolicy desktopAppCompatAspectRatioPolicy = activity.mAppCompatController.getDesktopAspectRatioPolicy(); if (desktopAppCompatAspectRatioPolicy.shouldApplyUserMinAspectRatioOverride(task) if ((desktopAppCompatAspectRatioPolicy.shouldApplyUserMinAspectRatioOverride(task) && (!isFixedOrientation(activityOrientation) || activityOrientation == SCREEN_ORIENTATION_LOCKED)) { || activityOrientation == SCREEN_ORIENTATION_LOCKED)) || isFixedOrientationPortrait(activityOrientation)) { // If a user aspect ratio override should be applied, treat the activity as portrait if // it has not specified a fix orientation. return SCREEN_ORIENTATION_PORTRAIT; return ORIENTATION_PORTRAIT; } return activityOrientation; // If activity orientation is undefined inherit task orientation. return isFixedOrientationLandscape(activityOrientation) ? ORIENTATION_LANDSCAPE : stableBoundsOrientation; } /** Loading @@ -252,7 +261,7 @@ public final class DesktopModeBoundsCalculator { // TODO(b/400617906): Merge duplicate initial bounds calculations to shared class. @NonNull private static Size maximizeSizeGivenAspectRatio( @ScreenOrientation int orientation, @Configuration.Orientation int orientation, @NonNull Size targetArea, float aspectRatio, int captionHeight Loading @@ -261,7 +270,7 @@ public final class DesktopModeBoundsCalculator { final int targetWidth = targetArea.getWidth(); final int finalHeight; final int finalWidth; if (isFixedOrientationPortrait(orientation)) { if (orientation == ORIENTATION_PORTRAIT) { // Portrait activity. // Calculate required width given ideal height and aspect ratio. int tempWidth = (int) (targetHeight / aspectRatio); Loading
services/tests/wmtests/src/com/android/server/wm/DesktopAppCompatAspectRatioPolicyTests.java +3 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.server.wm.AppCompatConfiguration.DEFAULT_LETTERBOX_ASP import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import android.compat.testing.PlatformCompatChangeRule; import android.content.pm.ActivityInfo; Loading Loading @@ -413,7 +414,7 @@ public class DesktopAppCompatAspectRatioPolicyTests extends WindowTestsBase { void setDesiredAspectRatio(float aspectRatio) { doReturn(aspectRatio).when(getDesktopAppCompatAspectRatioPolicy()) .getDesiredAspectRatio(any()); .getDesiredAspectRatio(any(), anyBoolean()); } DesktopAppCompatAspectRatioPolicy getDesktopAppCompatAspectRatioPolicy() { Loading @@ -422,7 +423,7 @@ public class DesktopAppCompatAspectRatioPolicyTests extends WindowTestsBase { float calculateAspectRatio() { return getDesktopAppCompatAspectRatioPolicy().calculateAspectRatio( getTopActivity().getTask()); getTopActivity().getTask(), /* hasOrientationMismatch */ true); } ActivityRecord getTopActivity() { Loading
services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +7 −6 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier. import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; Loading Loading @@ -437,7 +438,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredWidth = (int) ((LANDSCAPE_DISPLAY_BOUNDS.height() / LETTERBOX_ASPECT_RATIO) + 0.5f); Loading Loading @@ -933,7 +934,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredHeight = (int) (LANDSCAPE_DISPLAY_BOUNDS.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); Loading Loading @@ -1060,7 +1061,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredWidth = PORTRAIT_DISPLAY_BOUNDS.width() - (DESKTOP_MODE_LANDSCAPE_APP_PADDING * 2); Loading Loading @@ -1115,7 +1116,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(activity.mAppCompatController.getDesktopAspectRatioPolicy()); doReturn(LETTERBOX_ASPECT_RATIO).when(activity.mAppCompatController .getDesktopAspectRatioPolicy()).calculateAspectRatio(any()); .getDesktopAspectRatioPolicy()).calculateAspectRatio(any(), anyBoolean()); final int desiredWidth = PORTRAIT_DISPLAY_BOUNDS.width() - (DESKTOP_MODE_LANDSCAPE_APP_PADDING * 2); Loading Loading @@ -1569,7 +1570,7 @@ public class DesktopModeLaunchParamsModifierTests extends activity.mAppCompatController.getDesktopAspectRatioPolicy(); spyOn(desktopAppCompatAspectRatioPolicy); doReturn(aspectRatio).when(desktopAppCompatAspectRatioPolicy) .getDesiredAspectRatio(any()); .getDesiredAspectRatio(any(), anyBoolean()); } private void applyUserMinAspectRatioOverride(ActivityRecord activity, int overrideCode, Loading @@ -1579,7 +1580,7 @@ public class DesktopModeLaunchParamsModifierTests extends activity.mAppCompatController.getDesktopAspectRatioPolicy(); spyOn(desktopAppCompatAspectRatioPolicy); doReturn(1f).when(desktopAppCompatAspectRatioPolicy) .getDesiredAspectRatio(any()); .getDesiredAspectRatio(any(), anyBoolean()); // Enable user aspect ratio settings final AppCompatConfiguration appCompatConfiguration = Loading