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

Commit c537c47c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check after config recompute that apps is runnning on external display." into main

parents eb53b9c0 24f8de90
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ final class AppCompatCameraSimReqOrientationPolicy implements AppCompatCameraSta
                        // TODO(b/365725400): support landscape cameras.
                        .setShouldOverrideSensorOrientation(false)
                        .setShouldAllowTransformInverseDisplay(false);
            } else if (mCameraStateMonitor.isCameraRunningForActivity(activityRecord)) {
            } else if (isExternalDisplaySandboxEnabledForActivity(activityRecord)) {
                // Sandbox only display rotation if needed, for external display.
                cameraCompatibilityInfoBuilder.setDisplayRotationSandbox(
                                mCameraDisplayRotationProvider.getCameraDeviceRotation())
@@ -508,10 +508,11 @@ final class AppCompatCameraSimReqOrientationPolicy implements AppCompatCameraSta
     * treatment is more suitable (most likely if it is a fixed-orientation activity).
     */
    boolean isExternalDisplaySandboxEnabledForActivity(@NonNull ActivityRecord activity) {
        // For compatibility apps (fixed-orientation), apply the full treatment: sandboxing display
        // rotation to match app's requested orientation, letterboxing, and rotating-and-cropping
        // the camera feed.
        if (!Flags.enableCameraCompatSandboxDisplayRotationOnExternalDisplaysBugfix()
                || !mCameraStateMonitor.isCameraRunningForActivity(activity)
                // For compatibility apps (fixed-orientation), apply the full treatment: sandboxing
                // display rotation to match app's requested orientation, letterboxing, and
                // rotating-and-cropping the camera feed.
                || isCompatibilityTreatmentEnabledForActivity(activity,
                /* checkOrientation= */ true)) {
            return false;
+8 −2
Original line number Diff line number Diff line
@@ -282,13 +282,19 @@ public class AppCompatCameraSimReqOrientationPolicyTests extends WindowTestsBase
    }

    @Test
    @EnableFlags(FLAG_ENABLE_CAMERA_COMPAT_FOR_DESKTOP_WINDOWING)
    @EnableCompatChanges({OVERRIDE_CAMERA_COMPAT_ENABLE_FREEFORM_WINDOWING_TREATMENT})
    @EnableFlags({FLAG_ENABLE_CAMERA_COMPAT_FOR_DESKTOP_WINDOWING,
            FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES,
            FLAG_ENABLE_CAMERA_COMPAT_EXTERNAL_DISPLAY_ROTATION_BUGFIX,
            FLAG_ENABLE_CAMERA_COMPAT_SANDBOX_DISPLAY_ROTATION_ON_EXTERNAL_DISPLAYS_BUGFIX})
    public void testOrientationUnspecified_doesNotActivateCameraCompatMode() {
        runTestScenario((robot) -> {
            robot.configureActivity(SCREEN_ORIENTATION_UNSPECIFIED);

            robot.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);

            robot.assertNotInCameraCompatMode();
            robot.assertActivityRefreshRequested(false);
            robot.assertActivityRefreshed(false);
        });
    }