Fix AppConfigurationTests failures
Test cases failed because ignore_orientation_request is enabled on
the project. It ignores the orientation request from the test cases.
This CL allows the requesting organization during the testing.
Bug: 225758780
Test: atest AppConfigurationTests
Change-Id: Ia410bdc8dcfd9c65a891b35c7d1fd416010e4fc5
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
index 39dcbd5..b2790bb 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
@@ -366,6 +366,7 @@
@Test
public void testTranslucentAppOrientationRequests() {
assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
+ disableIgnoreOrientationRequest();
separateTestJournal();
launchActivity(PORTRAIT_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
@@ -537,6 +538,7 @@
assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
// TODO(b/209920544) remove assumeFalse after issue fix.
assumeFalse(ENABLE_SHELL_TRANSITIONS);
+ disableIgnoreOrientationRequest();
final RotationSession rotationSession = createManagedRotationSession();
rotationSession.set(ROTATION_0);
@@ -555,6 +557,7 @@
@Test
public void testTaskCloseRestoreFixedOrientation() {
assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
+ disableIgnoreOrientationRequest();
// Start landscape activity.
launchActivity(LANDSCAPE_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
@@ -760,6 +763,7 @@
// TODO(b/110533226): Fix test on devices with display cutout
assumeFalse("Skipping test: display cutout present, can't predict exact lifecycle",
hasDisplayCutout());
+ disableIgnoreOrientationRequest();
// Start portrait-fixed activity
separateTestJournal();
@@ -803,6 +807,7 @@
@Test
public void testTaskMoveToBackOrientation() {
assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
+ disableIgnoreOrientationRequest();
// Start landscape activity.
launchActivity(LANDSCAPE_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
index 9e47208..ca72abc 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
@@ -1333,6 +1333,11 @@
return mObjectTracker.manage(new FontScaleSession());
}
+ /** Allows requesting orientation in case ignore_orientation_request is set to true. */
+ protected void disableIgnoreOrientationRequest() {
+ mObjectTracker.manage(new IgnoreOrientationRequestSession(DEFAULT_DISPLAY, false));
+ }
+
/**
* Test @Rule class that disables screen doze settings before each test method running and
* restoring to initial values after test method finished.