Loading core/java/android/app/TaskInfo.java +27 −3 Original line number Diff line number Diff line Loading @@ -241,6 +241,18 @@ public class TaskInfo { */ public boolean isLetterboxDoubleTapEnabled; /** * Whether the user aspect ratio settings button is enabled * @hide */ public boolean topActivityEligibleForUserAspectRatioButton; /** * Hint about the letterbox state of the top activity. * @hide */ public boolean topActivityBoundsLetterboxed; /** * Whether the update comes from a letterbox double-tap action from the user or not. * @hide Loading Loading @@ -460,7 +472,8 @@ public class TaskInfo { public boolean hasCompatUI() { return hasCameraCompatControl() || topActivityInSizeCompat || topActivityEligibleForLetterboxEducation || isLetterboxDoubleTapEnabled; || isLetterboxDoubleTapEnabled || topActivityEligibleForUserAspectRatioButton; } /** Loading Loading @@ -510,6 +523,8 @@ public class TaskInfo { && supportsMultiWindow == that.supportsMultiWindow && displayAreaFeatureId == that.displayAreaFeatureId && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxWidth == that.topActivityLetterboxWidth && topActivityLetterboxHeight == that.topActivityLetterboxHeight Loading Loading @@ -543,6 +558,8 @@ public class TaskInfo { && taskId == that.taskId && topActivityInSizeCompat == that.topActivityInSizeCompat && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton && topActivityEligibleForLetterboxEducation == that.topActivityEligibleForLetterboxEducation && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition Loading Loading @@ -606,6 +623,8 @@ public class TaskInfo { displayAreaFeatureId = source.readInt(); cameraCompatControlState = source.readInt(); isLetterboxDoubleTapEnabled = source.readBoolean(); topActivityEligibleForUserAspectRatioButton = source.readBoolean(); topActivityBoundsLetterboxed = source.readBoolean(); isFromLetterboxDoubleTap = source.readBoolean(); topActivityLetterboxVerticalPosition = source.readInt(); topActivityLetterboxHorizontalPosition = source.readInt(); Loading Loading @@ -660,6 +679,8 @@ public class TaskInfo { dest.writeInt(displayAreaFeatureId); dest.writeInt(cameraCompatControlState); dest.writeBoolean(isLetterboxDoubleTapEnabled); dest.writeBoolean(topActivityEligibleForUserAspectRatioButton); dest.writeBoolean(topActivityBoundsLetterboxed); dest.writeBoolean(isFromLetterboxDoubleTap); dest.writeInt(topActivityLetterboxVerticalPosition); dest.writeInt(topActivityLetterboxHorizontalPosition); Loading Loading @@ -701,8 +722,11 @@ public class TaskInfo { + " topActivityInSizeCompat=" + topActivityInSizeCompat + " topActivityEligibleForLetterboxEducation= " + topActivityEligibleForLetterboxEducation + " topActivityLetterboxed= " + isLetterboxDoubleTapEnabled + " isFromDoubleTap= " + isFromLetterboxDoubleTap + " isLetterboxDoubleTapEnabled= " + isLetterboxDoubleTapEnabled + " topActivityEligibleForUserAspectRatioButton= " + topActivityEligibleForUserAspectRatioButton + " topActivityBoundsLetterboxed= " + topActivityBoundsLetterboxed + " isFromLetterboxDoubleTap= " + isFromLetterboxDoubleTap + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition + " topActivityLetterboxHorizontalPosition= " + topActivityLetterboxHorizontalPosition Loading services/core/java/com/android/server/wm/Task.java +5 −0 Original line number Diff line number Diff line Loading @@ -3473,6 +3473,11 @@ class Task extends TaskFragment { top.mLetterboxUiController.getLetterboxPositionForVerticalReachability(); } } // User Aspect Ratio Settings is enabled if the app is not in SCM info.topActivityEligibleForUserAspectRatioButton = mWmService.mLetterboxConfiguration.isUserAppAspectRatioSettingsEnabled() && top != null && !info.topActivityInSizeCompat; info.topActivityBoundsLetterboxed = top != null && top.areBoundsLetterboxed(); } /** Loading services/tests/wmtests/src/com/android/server/wm/TaskTests.java +30 −0 Original line number Diff line number Diff line Loading @@ -563,6 +563,36 @@ public class TaskTests extends WindowTestsBase { assertEquals(freeformBounds, task.getBounds()); } @Test public void testTopActivityEligibleForUserAspectRatioButton() { DisplayContent display = mAtm.mRootWindowContainer.getDefaultDisplay(); final Task rootTask = new TaskBuilder(mSupervisor).setCreateActivity(true) .setWindowingMode(WINDOWING_MODE_FULLSCREEN).setDisplay(display).build(); final Task task = rootTask.getBottomMostTask(); final ActivityRecord root = task.getTopNonFinishingActivity(); spyOn(mWm.mLetterboxConfiguration); // When device config flag is disabled the button is not enabled doReturn(false).when(mWm.mLetterboxConfiguration) .isUserAppAspectRatioSettingsEnabled(); doReturn(false).when(mWm.mLetterboxConfiguration) .isTranslucentLetterboxingEnabled(); assertFalse(task.getTaskInfo().topActivityEligibleForUserAspectRatioButton); // The flag is enabled doReturn(true).when(mWm.mLetterboxConfiguration) .isUserAppAspectRatioSettingsEnabled(); spyOn(root); doReturn(task).when(root).getOrganizedTask(); // When the flag is enabled and the top activity is not in size compat mode. doReturn(false).when(root).inSizeCompatMode(); assertTrue(task.getTaskInfo().topActivityEligibleForUserAspectRatioButton); // When in size compat mode the button is not enabled doReturn(true).when(root).inSizeCompatMode(); assertFalse(task.getTaskInfo().topActivityEligibleForUserAspectRatioButton); } /** * Tests that a task with forced orientation has orientation-consistent bounds within the * parent. Loading Loading
core/java/android/app/TaskInfo.java +27 −3 Original line number Diff line number Diff line Loading @@ -241,6 +241,18 @@ public class TaskInfo { */ public boolean isLetterboxDoubleTapEnabled; /** * Whether the user aspect ratio settings button is enabled * @hide */ public boolean topActivityEligibleForUserAspectRatioButton; /** * Hint about the letterbox state of the top activity. * @hide */ public boolean topActivityBoundsLetterboxed; /** * Whether the update comes from a letterbox double-tap action from the user or not. * @hide Loading Loading @@ -460,7 +472,8 @@ public class TaskInfo { public boolean hasCompatUI() { return hasCameraCompatControl() || topActivityInSizeCompat || topActivityEligibleForLetterboxEducation || isLetterboxDoubleTapEnabled; || isLetterboxDoubleTapEnabled || topActivityEligibleForUserAspectRatioButton; } /** Loading Loading @@ -510,6 +523,8 @@ public class TaskInfo { && supportsMultiWindow == that.supportsMultiWindow && displayAreaFeatureId == that.displayAreaFeatureId && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition && topActivityLetterboxWidth == that.topActivityLetterboxWidth && topActivityLetterboxHeight == that.topActivityLetterboxHeight Loading Loading @@ -543,6 +558,8 @@ public class TaskInfo { && taskId == that.taskId && topActivityInSizeCompat == that.topActivityInSizeCompat && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap && topActivityEligibleForUserAspectRatioButton == that.topActivityEligibleForUserAspectRatioButton && topActivityEligibleForLetterboxEducation == that.topActivityEligibleForLetterboxEducation && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition Loading Loading @@ -606,6 +623,8 @@ public class TaskInfo { displayAreaFeatureId = source.readInt(); cameraCompatControlState = source.readInt(); isLetterboxDoubleTapEnabled = source.readBoolean(); topActivityEligibleForUserAspectRatioButton = source.readBoolean(); topActivityBoundsLetterboxed = source.readBoolean(); isFromLetterboxDoubleTap = source.readBoolean(); topActivityLetterboxVerticalPosition = source.readInt(); topActivityLetterboxHorizontalPosition = source.readInt(); Loading Loading @@ -660,6 +679,8 @@ public class TaskInfo { dest.writeInt(displayAreaFeatureId); dest.writeInt(cameraCompatControlState); dest.writeBoolean(isLetterboxDoubleTapEnabled); dest.writeBoolean(topActivityEligibleForUserAspectRatioButton); dest.writeBoolean(topActivityBoundsLetterboxed); dest.writeBoolean(isFromLetterboxDoubleTap); dest.writeInt(topActivityLetterboxVerticalPosition); dest.writeInt(topActivityLetterboxHorizontalPosition); Loading Loading @@ -701,8 +722,11 @@ public class TaskInfo { + " topActivityInSizeCompat=" + topActivityInSizeCompat + " topActivityEligibleForLetterboxEducation= " + topActivityEligibleForLetterboxEducation + " topActivityLetterboxed= " + isLetterboxDoubleTapEnabled + " isFromDoubleTap= " + isFromLetterboxDoubleTap + " isLetterboxDoubleTapEnabled= " + isLetterboxDoubleTapEnabled + " topActivityEligibleForUserAspectRatioButton= " + topActivityEligibleForUserAspectRatioButton + " topActivityBoundsLetterboxed= " + topActivityBoundsLetterboxed + " isFromLetterboxDoubleTap= " + isFromLetterboxDoubleTap + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition + " topActivityLetterboxHorizontalPosition= " + topActivityLetterboxHorizontalPosition Loading
services/core/java/com/android/server/wm/Task.java +5 −0 Original line number Diff line number Diff line Loading @@ -3473,6 +3473,11 @@ class Task extends TaskFragment { top.mLetterboxUiController.getLetterboxPositionForVerticalReachability(); } } // User Aspect Ratio Settings is enabled if the app is not in SCM info.topActivityEligibleForUserAspectRatioButton = mWmService.mLetterboxConfiguration.isUserAppAspectRatioSettingsEnabled() && top != null && !info.topActivityInSizeCompat; info.topActivityBoundsLetterboxed = top != null && top.areBoundsLetterboxed(); } /** Loading
services/tests/wmtests/src/com/android/server/wm/TaskTests.java +30 −0 Original line number Diff line number Diff line Loading @@ -563,6 +563,36 @@ public class TaskTests extends WindowTestsBase { assertEquals(freeformBounds, task.getBounds()); } @Test public void testTopActivityEligibleForUserAspectRatioButton() { DisplayContent display = mAtm.mRootWindowContainer.getDefaultDisplay(); final Task rootTask = new TaskBuilder(mSupervisor).setCreateActivity(true) .setWindowingMode(WINDOWING_MODE_FULLSCREEN).setDisplay(display).build(); final Task task = rootTask.getBottomMostTask(); final ActivityRecord root = task.getTopNonFinishingActivity(); spyOn(mWm.mLetterboxConfiguration); // When device config flag is disabled the button is not enabled doReturn(false).when(mWm.mLetterboxConfiguration) .isUserAppAspectRatioSettingsEnabled(); doReturn(false).when(mWm.mLetterboxConfiguration) .isTranslucentLetterboxingEnabled(); assertFalse(task.getTaskInfo().topActivityEligibleForUserAspectRatioButton); // The flag is enabled doReturn(true).when(mWm.mLetterboxConfiguration) .isUserAppAspectRatioSettingsEnabled(); spyOn(root); doReturn(task).when(root).getOrganizedTask(); // When the flag is enabled and the top activity is not in size compat mode. doReturn(false).when(root).inSizeCompatMode(); assertTrue(task.getTaskInfo().topActivityEligibleForUserAspectRatioButton); // When in size compat mode the button is not enabled doReturn(true).when(root).inSizeCompatMode(); assertFalse(task.getTaskInfo().topActivityEligibleForUserAspectRatioButton); } /** * Tests that a task with forced orientation has orientation-consistent bounds within the * parent. Loading