Merge "[1/n] Add build and runtime flags for fullscreen option" into udc-qpr-dev

This commit is contained in:
Graciela Putri
2023-07-25 16:18:47 +00:00
committed by Android (Google) Code Review
4 changed files with 45 additions and 0 deletions

View File

@@ -5718,6 +5718,9 @@
<!-- Whether per-app user aspect ratio override settings is enabled --> <!-- Whether per-app user aspect ratio override settings is enabled -->
<bool name="config_appCompatUserAppAspectRatioSettingsIsEnabled">false</bool> <bool name="config_appCompatUserAppAspectRatioSettingsIsEnabled">false</bool>
<!-- Whether per-app fullscreen override option is allowed in user aspect ratio settings -->
<bool name="config_appCompatUserAppAspectRatioFullscreenIsEnabled">false</bool>
<!-- Whether sending compat fake focus for split screen resumed activities is enabled. <!-- Whether sending compat fake focus for split screen resumed activities is enabled.
Needed because some game engines wait to get focus before drawing the content of Needed because some game engines wait to get focus before drawing the content of
the app which isn't guaranteed by default in multi-window modes. --> the app which isn't guaranteed by default in multi-window modes. -->

View File

@@ -4536,6 +4536,7 @@
<!-- Whether per-app user aspect ratio override settings is enabled --> <!-- Whether per-app user aspect ratio override settings is enabled -->
<java-symbol type="bool" name="config_appCompatUserAppAspectRatioSettingsIsEnabled" /> <java-symbol type="bool" name="config_appCompatUserAppAspectRatioSettingsIsEnabled" />
<java-symbol type="bool" name="config_appCompatUserAppAspectRatioFullscreenIsEnabled" />
<java-symbol type="bool" name="config_isCompatFakeFocusEnabled" /> <java-symbol type="bool" name="config_isCompatFakeFocusEnabled" />
<java-symbol type="bool" name="config_isWindowManagerCameraCompatTreatmentEnabled" /> <java-symbol type="bool" name="config_isWindowManagerCameraCompatTreatmentEnabled" />

View File

@@ -85,6 +85,11 @@ final class LetterboxConfiguration {
// TODO(b/288142656): Enable user aspect ratio settings by default. // TODO(b/288142656): Enable user aspect ratio settings by default.
private static final boolean DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_SETTINGS = false; private static final boolean DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_SETTINGS = false;
// Whether per-app fullscreen user aspect ratio override option is enabled
private static final String KEY_ENABLE_USER_ASPECT_RATIO_FULLSCREEN =
"enable_app_compat_user_aspect_ratio_fullscreen";
private static final boolean DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_FULLSCREEN = true;
// Whether the letterbox wallpaper style is enabled by default // Whether the letterbox wallpaper style is enabled by default
private static final String KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER = private static final String KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER =
"enable_letterbox_background_wallpaper"; "enable_letterbox_background_wallpaper";
@@ -266,6 +271,9 @@ final class LetterboxConfiguration {
// Allows to enable user aspect ratio settings ignoring flags. // Allows to enable user aspect ratio settings ignoring flags.
private boolean mUserAppAspectRatioSettingsOverrideEnabled; private boolean mUserAppAspectRatioSettingsOverrideEnabled;
// Allows to enable fullscreen option in user aspect ratio settings ignoring flags.
private boolean mUserAppAspectRatioFullscreenOverrideEnabled;
// The override for letterbox background type in case it's different from // The override for letterbox background type in case it's different from
// LETTERBOX_BACKGROUND_OVERRIDE_UNSET // LETTERBOX_BACKGROUND_OVERRIDE_UNSET
@LetterboxBackgroundType @LetterboxBackgroundType
@@ -379,6 +387,10 @@ final class LetterboxConfiguration {
R.bool.config_appCompatUserAppAspectRatioSettingsIsEnabled)) R.bool.config_appCompatUserAppAspectRatioSettingsIsEnabled))
.addDeviceConfigEntry(KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER, .addDeviceConfigEntry(KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER,
DEFAULT_VALUE_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER, /* enabled */ true) DEFAULT_VALUE_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER, /* enabled */ true)
.addDeviceConfigEntry(KEY_ENABLE_USER_ASPECT_RATIO_FULLSCREEN,
DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_FULLSCREEN,
mContext.getResources().getBoolean(
R.bool.config_appCompatUserAppAspectRatioFullscreenIsEnabled))
.build(); .build();
} }
@@ -1275,4 +1287,21 @@ final class LetterboxConfiguration {
void resetUserAppAspectRatioSettingsEnabled() { void resetUserAppAspectRatioSettingsEnabled() {
setUserAppAspectRatioSettingsOverrideEnabled(false); setUserAppAspectRatioSettingsOverrideEnabled(false);
} }
/**
* Whether fullscreen option in per-app user aspect ratio settings is enabled
*/
boolean isUserAppAspectRatioFullscreenEnabled() {
return isUserAppAspectRatioSettingsEnabled()
&& (mUserAppAspectRatioFullscreenOverrideEnabled
|| mDeviceConfig.getFlagValue(KEY_ENABLE_USER_ASPECT_RATIO_FULLSCREEN));
}
void setUserAppAspectRatioFullscreenOverrideEnabled(boolean enabled) {
mUserAppAspectRatioFullscreenOverrideEnabled = enabled;
}
void resetUserAppAspectRatioFullscreenEnabled() {
setUserAppAspectRatioFullscreenOverrideEnabled(false);
}
} }

View File

@@ -1013,6 +1013,10 @@ public class WindowManagerShellCommand extends ShellCommand {
runSetBooleanFlag(pw, mLetterboxConfiguration runSetBooleanFlag(pw, mLetterboxConfiguration
::setUserAppAspectRatioSettingsOverrideEnabled); ::setUserAppAspectRatioSettingsOverrideEnabled);
break; break;
case "--isUserAppAspectRatioFullscreenEnabled":
runSetBooleanFlag(pw, mLetterboxConfiguration
::setUserAppAspectRatioFullscreenOverrideEnabled);
break;
case "--isCameraCompatRefreshEnabled": case "--isCameraCompatRefreshEnabled":
runSetBooleanFlag(pw, mLetterboxConfiguration::setCameraCompatRefreshEnabled); runSetBooleanFlag(pw, mLetterboxConfiguration::setCameraCompatRefreshEnabled);
break; break;
@@ -1093,6 +1097,9 @@ public class WindowManagerShellCommand extends ShellCommand {
case "isUserAppAspectRatioSettingsEnabled": case "isUserAppAspectRatioSettingsEnabled":
mLetterboxConfiguration.resetUserAppAspectRatioSettingsEnabled(); mLetterboxConfiguration.resetUserAppAspectRatioSettingsEnabled();
break; break;
case "isUserAppAspectRatioFullscreenEnabled":
mLetterboxConfiguration.resetUserAppAspectRatioFullscreenEnabled();
break;
case "isCameraCompatRefreshEnabled": case "isCameraCompatRefreshEnabled":
mLetterboxConfiguration.resetCameraCompatRefreshEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshEnabled();
break; break;
@@ -1204,6 +1211,7 @@ public class WindowManagerShellCommand extends ShellCommand {
mLetterboxConfiguration.resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox(); mLetterboxConfiguration.resetIsDisplayAspectRatioEnabledForFixedOrientationLetterbox();
mLetterboxConfiguration.resetTranslucentLetterboxingEnabled(); mLetterboxConfiguration.resetTranslucentLetterboxingEnabled();
mLetterboxConfiguration.resetUserAppAspectRatioSettingsEnabled(); mLetterboxConfiguration.resetUserAppAspectRatioSettingsEnabled();
mLetterboxConfiguration.resetUserAppAspectRatioFullscreenEnabled();
mLetterboxConfiguration.resetCameraCompatRefreshEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshEnabled();
mLetterboxConfiguration.resetCameraCompatRefreshCycleThroughStopEnabled(); mLetterboxConfiguration.resetCameraCompatRefreshCycleThroughStopEnabled();
} }
@@ -1272,6 +1280,8 @@ public class WindowManagerShellCommand extends ShellCommand {
+ mLetterboxConfiguration.isTranslucentLetterboxingEnabled()); + mLetterboxConfiguration.isTranslucentLetterboxingEnabled());
pw.println("Is the user aspect ratio settings enabled: " pw.println("Is the user aspect ratio settings enabled: "
+ mLetterboxConfiguration.isUserAppAspectRatioSettingsEnabled()); + mLetterboxConfiguration.isUserAppAspectRatioSettingsEnabled());
pw.println("Is the fullscreen option in user aspect ratio settings enabled: "
+ mLetterboxConfiguration.isUserAppAspectRatioFullscreenEnabled());
} }
return 0; return 0;
} }
@@ -1471,6 +1481,8 @@ public class WindowManagerShellCommand extends ShellCommand {
pw.println(" Whether letterboxing for translucent activities is enabled."); pw.println(" Whether letterboxing for translucent activities is enabled.");
pw.println(" --isUserAppAspectRatioSettingsEnabled [true|1|false|0]"); pw.println(" --isUserAppAspectRatioSettingsEnabled [true|1|false|0]");
pw.println(" Whether user aspect ratio settings are enabled."); pw.println(" Whether user aspect ratio settings are enabled.");
pw.println(" --isUserAppAspectRatioFullscreenEnabled [true|1|false|0]");
pw.println(" Whether user aspect ratio fullscreen option is enabled.");
pw.println(" --isCameraCompatRefreshEnabled [true|1|false|0]"); pw.println(" --isCameraCompatRefreshEnabled [true|1|false|0]");
pw.println(" Whether camera compatibility refresh is enabled."); pw.println(" Whether camera compatibility refresh is enabled.");
pw.println(" --isCameraCompatRefreshCycleThroughStopEnabled [true|1|false|0]"); pw.println(" --isCameraCompatRefreshCycleThroughStopEnabled [true|1|false|0]");