From fa76c370e2d2ee1eccc30041b4d3db00b7612b40 Mon Sep 17 00:00:00 2001 From: Vali Calinescu Date: Thu, 4 May 2023 13:15:08 +0000 Subject: [PATCH] Clean up DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP Clean up flag guarding size compat mode policy to disable SCM when the orientation change request comes from the app Bug: 273702388 Fix: 270356567 Test: atest WmTests:SizeCompatTests Change-Id: I74dd4443dbf5104ed227d8a841b46a3b8cbacfa1 --- .../com/android/server/wm/ActivityRecord.java | 4 +--- .../server/wm/LetterboxConfiguration.java | 14 -------------- .../LetterboxConfigurationDeviceConfig.java | 19 +------------------ 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 26b40b4c09ee4..1717d248b7a75 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -7941,9 +7941,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } // This is necessary in order to avoid going into size compat mode when the orientation // change request comes from the app - if (mWmService.mLetterboxConfiguration - .isSizeCompatModeDisabledAfterOrientationChangeFromApp() - && getRequestedConfigurationOrientation(false, requestedOrientation) + if (getRequestedConfigurationOrientation(false, requestedOrientation) != getRequestedConfigurationOrientation(false /*forDisplay */)) { // Do not change the requested configuration now, because this will be done when setting // the orientation below with the new mCompatDisplayInsets diff --git a/services/core/java/com/android/server/wm/LetterboxConfiguration.java b/services/core/java/com/android/server/wm/LetterboxConfiguration.java index 6936a2dcba190..f492bab0728f9 100644 --- a/services/core/java/com/android/server/wm/LetterboxConfiguration.java +++ b/services/core/java/com/android/server/wm/LetterboxConfiguration.java @@ -19,7 +19,6 @@ package com.android.server.wm; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ALLOW_IGNORE_ORIENTATION_REQUEST; -import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP; import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_CAMERA_COMPAT_TREATMENT; import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_COMPAT_FAKE_FOCUS; import static com.android.server.wm.LetterboxConfigurationDeviceConfig.KEY_ENABLE_DISPLAY_ROTATION_IMMERSIVE_APP_COMPAT_POLICY; @@ -330,9 +329,6 @@ final class LetterboxConfiguration { mDeviceConfig.updateFlagActiveStatus( /* isActive */ mTranslucentLetterboxingEnabled, /* key */ KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY); - mDeviceConfig.updateFlagActiveStatus( - /* isActive */ true, - /* key */ KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP); mLetterboxConfigurationPersister = letterboxConfigurationPersister; mLetterboxConfigurationPersister.start(); @@ -346,16 +342,6 @@ final class LetterboxConfiguration { return mDeviceConfig.getFlag(KEY_ALLOW_IGNORE_ORIENTATION_REQUEST); } - /** - * Whether size compat mode is disabled after an orientation change request comes from the app. - * This value is controlled via {@link android.provider.DeviceConfig}. - */ - // TODO(b/270356567) Clean up this flag - boolean isSizeCompatModeDisabledAfterOrientationChangeFromApp() { - return mDeviceConfig.getFlag( - KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP); - } - /** * Overrides the aspect ratio of letterbox for fixed orientation. If given value is <= {@link * #MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO}, both it and a value of {@link diff --git a/services/core/java/com/android/server/wm/LetterboxConfigurationDeviceConfig.java b/services/core/java/com/android/server/wm/LetterboxConfigurationDeviceConfig.java index 1651af328b1f7..a739e42410a98 100644 --- a/services/core/java/com/android/server/wm/LetterboxConfigurationDeviceConfig.java +++ b/services/core/java/com/android/server/wm/LetterboxConfigurationDeviceConfig.java @@ -52,11 +52,6 @@ final class LetterboxConfigurationDeviceConfig private static final boolean DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY = true; - static final String KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP = - "disable_size_compat_mode_after_orientation_change_from_app"; - private static final boolean - DEFAULT_VALUE_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP = true; - @VisibleForTesting static final Map sKeyToDefaultValueMap = Map.of( KEY_ENABLE_CAMERA_COMPAT_TREATMENT, @@ -68,9 +63,7 @@ final class LetterboxConfigurationDeviceConfig KEY_ENABLE_COMPAT_FAKE_FOCUS, DEFAULT_VALUE_ENABLE_COMPAT_FAKE_FOCUS, KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY, - DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY, - KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP, - DEFAULT_VALUE_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP + DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY ); // Whether camera compatibility treatment is enabled. @@ -99,10 +92,6 @@ final class LetterboxConfigurationDeviceConfig private boolean mIsTranslucentLetterboxingAllowed = DEFAULT_VALUE_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY; - // Whether size compat mode is disabled after an orientation change request comes from the app - private boolean mIsSizeCompatModeDisabledAfterOrientationChangeFromApp = - DEFAULT_VALUE_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP; - // Set of active device configs that need to be updated in // DeviceConfig.OnPropertiesChangedListener#onPropertiesChanged. private final ArraySet mActiveDeviceConfigsSet = new ArraySet<>(); @@ -152,8 +141,6 @@ final class LetterboxConfigurationDeviceConfig return mIsCompatFakeFocusAllowed; case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY: return mIsTranslucentLetterboxingAllowed; - case KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP: - return mIsSizeCompatModeDisabledAfterOrientationChangeFromApp; default: throw new AssertionError("Unexpected flag name: " + key); } @@ -181,10 +168,6 @@ final class LetterboxConfigurationDeviceConfig case KEY_ENABLE_LETTERBOX_TRANSLUCENT_ACTIVITY: mIsTranslucentLetterboxingAllowed = getDeviceConfig(key, defaultValue); break; - case KEY_DISABLE_SIZE_COMPAT_MODE_AFTER_ORIENTATION_CHANGE_FROM_APP: - mIsSizeCompatModeDisabledAfterOrientationChangeFromApp = - getDeviceConfig(key, defaultValue); - break; default: throw new AssertionError("Unexpected flag name: " + key); }