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

Commit af22a58e authored by Mina Granic's avatar Mina Granic
Browse files

Set camera compat for freeform aspect ratio to 16:9 for all devices.

Setting this aspect ratio is guarded with other constraints, for example `shouldCameraCompatControlAspectRatio()`.

Flag: EXEMPT simple fix
Bug: 368573687
Test: atest WmTests:CameraCompatFreeformPolicyTests
Test: atest WmTests:AppCompatOrientationPolicyTests
Change-Id: Id8352e08ca802b52593eaba85cdd2f7735e5a327
parent ba55b9ac
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -6508,10 +6508,6 @@
        to match what the apps most likely expect in their requested orientation. -->
    <bool name="config_isCameraCompatSimulateRequestedOrientationTreatmentEnabled">true</bool>

    <!-- Which aspect ratio to use when camera compat treatment is enabled and an activity eligible
        for treatment is connected to the camera. -->
    <item name="config_windowManagerCameraCompatAspectRatio" format="float" type="dimen">1.0</item>

    <!-- Docking is a uiMode configuration change and will cause activities to relaunch if it's not
         handled. If true, the configuration change will be sent but activities will not be
         relaunched upon docking. Apps with desk resources will behave like normal, since they may
+0 −1
Original line number Diff line number Diff line
@@ -4961,7 +4961,6 @@
  <java-symbol type="bool" name="config_isWindowManagerCameraCompatTreatmentEnabled" />
  <java-symbol type="bool" name="config_isWindowManagerCameraCompatSplitScreenAspectRatioEnabled" />
  <java-symbol type="bool" name="config_isCameraCompatSimulateRequestedOrientationTreatmentEnabled" />
  <java-symbol type="dimen" name="config_windowManagerCameraCompatAspectRatio" />
  <java-symbol type="bool" name="config_skipActivityRelaunchWhenDocking" />

  <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" />
+4 −5
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ final class AppCompatConfiguration {

    private static final boolean DEFAULT_VALUE_ENABLE_CAMERA_COMPAT_TREATMENT = true;

    private static final float DEFAULT_VALUE_CAMERA_COMPAT_MIN_ASPECT_RATIO = 16 / 9f;

    // Whether enabling rotation compat policy for immersive apps that prevents auto
    // rotation into non-optimal screen orientation while in fullscreen. This is needed
    // because immersive apps, such as games, are often not optimized for all
@@ -299,7 +301,7 @@ final class AppCompatConfiguration {

    // Which aspect ratio to use when camera compat treatment is enabled and an activity eligible
    // for treatment is connected to the camera.
    private float mCameraCompatAspectRatio;
    private float mCameraCompatAspectRatio = DEFAULT_VALUE_CAMERA_COMPAT_MIN_ASPECT_RATIO;

    // Whether activity "refresh" in camera compatibility treatment is enabled.
    // See RefreshCallbackItem for context.
@@ -384,8 +386,6 @@ final class AppCompatConfiguration {
        mIsCameraCompatSimulateRequestedOrientationTreatmentEnabled = mContext.getResources()
                .getBoolean(R.bool
                        .config_isCameraCompatSimulateRequestedOrientationTreatmentEnabled);
        mCameraCompatAspectRatio = mContext.getResources().getFloat(
                R.dimen.config_windowManagerCameraCompatAspectRatio);
        mIsPolicyForIgnoringRequestedOrientationEnabled = mContext.getResources().getBoolean(
                R.bool.config_letterboxIsPolicyForIgnoringRequestedOrientationEnabled);

@@ -1363,8 +1363,7 @@ final class AppCompatConfiguration {
     * for treatment is connected to the camera.
     */
    void resetCameraCompatAspectRatio() {
        mCameraCompatAspectRatio = mContext.getResources().getFloat(R.dimen
                .config_windowManagerCameraCompatAspectRatio);
        mCameraCompatAspectRatio = DEFAULT_VALUE_CAMERA_COMPAT_MIN_ASPECT_RATIO;
    }

    /**