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

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

Merge "Disable unify_camera_policies flag when testing force-rotate policy." into main

parents d2ea8aed 0b78267b
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -58,6 +58,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    public TestRule compatChangeRule = new PlatformCompatChangeRule();
    public TestRule compatChangeRule = new PlatformCompatChangeRule();


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testDisplayRotationCompatPolicy_presentWhenEnabled() {
    public void testDisplayRotationCompatPolicy_presentWhenEnabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
@@ -67,6 +68,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testDisplayRotationCompatPolicy_notPresentWhenDisabled() {
    public void testDisplayRotationCompatPolicy_notPresentWhenDisabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ false);
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ false);
@@ -76,6 +78,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testDisplayRotationCompatPolicy_startedWhenEnabled() {
    public void testDisplayRotationCompatPolicy_startedWhenEnabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
@@ -117,6 +120,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    @EnableFlags(FLAG_ENABLE_CAMERA_COMPAT_FOR_DESKTOP_WINDOWING)
    @EnableFlags(FLAG_ENABLE_CAMERA_COMPAT_FOR_DESKTOP_WINDOWING)
    public void testSimReqOrientationPolicy_notPresentWhenNoFlagAndNoDW() {
    public void testSimReqOrientationPolicy_notPresentWhenNoFlagAndNoDW() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
@@ -210,6 +214,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testIsCameraCompatTreatmentActive_whenTreatmentForTopActivityIsEnabled() {
    public void testIsCameraCompatTreatmentActive_whenTreatmentForTopActivityIsEnabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
@@ -223,6 +228,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testIsCameraCompatTreatmentNotActive_whenTreatmentForTopActivityIsDisabled() {
    public void testIsCameraCompatTreatmentNotActive_whenTreatmentForTopActivityIsDisabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
            robot.conf().enableCameraCompatForceRotateTreatmentAtBuildTime(/* enabled= */ true);
@@ -236,6 +242,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    @EnableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)
    @EnableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)
    public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsNotRunning() {
    public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsNotRunning() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
@@ -251,6 +258,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    @DisableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)
    @DisableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)
    public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsRunning_overrideDisabled() {
    public void testShouldOverrideMinAspectRatioForCamera_whenCameraIsRunning_overrideDisabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
@@ -266,6 +274,7 @@ public class AppCompatCameraPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    @EnableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)
    @EnableCompatChanges(OVERRIDE_MIN_ASPECT_RATIO_ONLY_FOR_CAMERA)
    public void testShouldOverrideMinAspectRatioForCameraFullscr_cameraIsRunning_overrideEnabled() {
    public void testShouldOverrideMinAspectRatioForCameraFullscr_cameraIsRunning_overrideEnabled() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
+7 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO
import static android.view.WindowManager.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION;
import static android.view.WindowManager.PROPERTY_COMPAT_IGNORE_REQUESTED_ORIENTATION;


import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.window.flags.Flags.FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES;
import static com.android.window.flags.Flags.FLAG_ENABLE_CAMERA_COMPAT_FOR_DESKTOP_WINDOWING;
import static com.android.window.flags.Flags.FLAG_ENABLE_CAMERA_COMPAT_FOR_DESKTOP_WINDOWING;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
@@ -47,6 +48,7 @@ import static org.mockito.Mockito.verify;
import android.compat.testing.PlatformCompatChangeRule;
import android.compat.testing.PlatformCompatChangeRule;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
import android.platform.test.annotations.Presubmit;


@@ -84,6 +86,7 @@ public class AppCompatOrientationPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    @EnableCompatChanges({OVERRIDE_ANY_ORIENTATION_TO_USER})
    @EnableCompatChanges({OVERRIDE_ANY_ORIENTATION_TO_USER})
    public void testOverrideOrientationIfNeeded_fullscreenOverrideEnabled_returnsUser() {
    public void testOverrideOrientationIfNeeded_fullscreenOverrideEnabled_returnsUser() {
        runTestScenarioWithActivity((robot) -> {
        runTestScenarioWithActivity((robot) -> {
@@ -275,6 +278,7 @@ public class AppCompatOrientationPolicyTest extends WindowTestsBase {
    @Test
    @Test
    @EnableCompatChanges({OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT,
    @EnableCompatChanges({OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT,
            OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA})
            OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA})
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testOverrideOrientationIfNeeded_whenCameraNotActive_isUnchanged() {
    public void testOverrideOrientationIfNeeded_whenCameraNotActive_isUnchanged() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.applyOnConf((c)-> {
            robot.applyOnConf((c)-> {
@@ -294,6 +298,7 @@ public class AppCompatOrientationPolicyTest extends WindowTestsBase {
    @Test
    @Test
    @EnableCompatChanges({OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT,
    @EnableCompatChanges({OVERRIDE_UNDEFINED_ORIENTATION_TO_PORTRAIT,
            OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA})
            OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA})
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testOverrideOrientationIfNeeded_whenCameraActive_returnsPortrait() {
    public void testOverrideOrientationIfNeeded_whenCameraActive_returnsPortrait() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.applyOnConf((c) -> {
            robot.applyOnConf((c) -> {
@@ -324,6 +329,7 @@ public class AppCompatOrientationPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    public void testOverrideOrientationIfNeeded_fullscreenOverride_cameraActivity_unchanged() {
    public void testOverrideOrientationIfNeeded_fullscreenOverride_cameraActivity_unchanged() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {
            robot.applyOnConf((c) -> {
            robot.applyOnConf((c) -> {
@@ -443,6 +449,7 @@ public class AppCompatOrientationPolicyTest extends WindowTestsBase {
    }
    }


    @Test
    @Test
    @DisableFlags(FLAG_CAMERA_COMPAT_UNIFY_CAMERA_POLICIES)
    @EnableCompatChanges({OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION})
    @EnableCompatChanges({OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION})
    public void testShouldIgnoreRequestedOrientation_cameraCompatTreatment_returnsTrue() {
    public void testShouldIgnoreRequestedOrientation_cameraCompatTreatment_returnsTrue() {
        runTestScenario((robot) -> {
        runTestScenario((robot) -> {