summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Graciela Putri <gracielawputri@google.com> 2024-04-19 16:19:18 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-04-19 16:19:18 +0000
commit88fde31b24c53d7a085fa713aab7fb9c8b23f40c (patch)
tree803966c0979d6b6c5e1ab77777b234f124a5a877
parentb65a6f1094e7ba38fd7a54199ff43b4dc123e859 (diff)
parentf465558612f28a8a5f215992ce725f4b23afebf0 (diff)
Merge "Don't create compatDisplayInsets if has fullscreen override" into 24D1-dev am: f465558612
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/26994541 Change-Id: Iec3fc3d91620a2981bcbd004989f278457d92d47 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManager.java3
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManagerTest.java18
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java19
4 files changed, 40 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManager.java
index 7c280994042b..8fb4bdbea933 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManager.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManager.java
@@ -237,7 +237,8 @@ class UserAspectRatioSettingsWindowManager extends CompatUIWindowManagerAbstract
final int letterboxWidth = taskInfo.topActivityLetterboxWidth;
// App is not visibly letterboxed if it covers status bar/bottom insets or matches the
// stable bounds, so don't show the button
- if (stableBounds.height() <= letterboxHeight && stableBounds.width() <= letterboxWidth) {
+ if (stableBounds.height() <= letterboxHeight && stableBounds.width() <= letterboxWidth
+ && !taskInfo.isUserFullscreenOverrideEnabled) {
return false;
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManagerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManagerTest.java
index 81ba4b37d13b..94e168ed70ed 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManagerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/UserAspectRatioSettingsWindowManagerTest.java
@@ -292,6 +292,24 @@ public class UserAspectRatioSettingsWindowManagerTest extends ShellTestCase {
}
@Test
+ public void testUserFullscreenOverrideEnabled_buttonAlwaysShown() {
+ TaskInfo taskInfo = createTaskInfo(/* eligibleForUserAspectRatioButton= */
+ true, /* topActivityBoundsLetterboxed */ true, ACTION_MAIN, CATEGORY_LAUNCHER);
+
+ final Rect stableBounds = mWindowManager.getTaskStableBounds();
+
+ // Letterboxed activity that has user fullscreen override should always show button,
+ // layout should be inflated
+ taskInfo.appCompatTaskInfo.topActivityLetterboxHeight = stableBounds.height();
+ taskInfo.appCompatTaskInfo.topActivityLetterboxWidth = stableBounds.width();
+ taskInfo.appCompatTaskInfo.isUserFullscreenOverrideEnabled = true;
+
+ mWindowManager.updateCompatInfo(taskInfo, mTaskListener, /* canShow= */ true);
+
+ verify(mWindowManager).inflateLayout();
+ }
+
+ @Test
public void testUpdateDisplayLayout() {
final DisplayInfo displayInfo = new DisplayInfo();
displayInfo.logicalWidth = 1000;
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 54e932a80ee9..6a074636b2ef 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -8363,7 +8363,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
* aspect ratio.
*/
boolean shouldCreateCompatDisplayInsets() {
- if (mLetterboxUiController.shouldApplyUserFullscreenOverride()) {
+ if (mLetterboxUiController.hasFullscreenOverride()) {
// If the user has forced the applications aspect ratio to be fullscreen, don't use size
// compatibility mode in any situation. The user has been warned and therefore accepts
// the risk of the application misbehaving.
diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
index 9697c65dc1ea..f4012963a173 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -1384,6 +1384,25 @@ public class SizeCompatTests extends WindowTestsBase {
}
@Test
+ @EnableCompatChanges({ActivityInfo.OVERRIDE_ANY_ORIENTATION_TO_USER})
+ public void testShouldNotCreateCompatDisplays_systemFullscreenOverride() {
+ setUpDisplaySizeWithApp(1000, 2500);
+
+ // Make the task root resizable.
+ mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE;
+
+ // Create an activity on the same task.
+ final ActivityRecord activity = buildActivityRecord(/* supportsSizeChanges= */false,
+ RESIZE_MODE_UNRESIZEABLE, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+
+ // Simulate the user selecting the fullscreen user aspect ratio override
+ spyOn(activity.mLetterboxUiController);
+ doReturn(true).when(activity.mLetterboxUiController)
+ .isSystemOverrideToFullscreenEnabled();
+ assertFalse(activity.shouldCreateCompatDisplayInsets());
+ }
+
+ @Test
@EnableCompatChanges({ActivityInfo.NEVER_SANDBOX_DISPLAY_APIS})
public void testNeverSandboxDisplayApis_configEnabled_sandboxingNotApplied() {
setUpDisplaySizeWithApp(1000, 1200);