Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2ec3a5a authored by Graciela Putri's avatar Graciela Putri Committed by Android (Google) Code Review
Browse files

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

parents 15fcf5b7 aa527d1b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5718,6 +5718,9 @@
    <!-- Whether per-app user aspect ratio override settings is enabled -->
    <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.
         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. -->
+1 −0
Original line number Diff line number Diff line
@@ -4536,6 +4536,7 @@

  <!-- Whether per-app user aspect ratio override settings is enabled -->
  <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_isWindowManagerCameraCompatTreatmentEnabled" />
+29 −0
Original line number Diff line number Diff line
@@ -85,6 +85,11 @@ final class LetterboxConfiguration {
    // TODO(b/288142656): Enable user aspect ratio settings by default.
    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
    private static final String KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER =
            "enable_letterbox_background_wallpaper";
@@ -266,6 +271,9 @@ final class LetterboxConfiguration {
    // Allows to enable user aspect ratio settings ignoring flags.
    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
    // LETTERBOX_BACKGROUND_OVERRIDE_UNSET
    @LetterboxBackgroundType
@@ -379,6 +387,10 @@ final class LetterboxConfiguration {
                                R.bool.config_appCompatUserAppAspectRatioSettingsIsEnabled))
                .addDeviceConfigEntry(KEY_ENABLE_LETTERBOX_BACKGROUND_WALLPAPER,
                        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();
    }

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