diff options
| author | 2022-06-28 06:57:09 +0000 | |
|---|---|---|
| committer | 2022-06-28 14:12:01 +0000 | |
| commit | 9e6553e0853868c374a042bf61c03e17ddc4efda (patch) | |
| tree | aa43919ce36ba73fd06dfa270e1ac55dbc10e71e | |
| parent | cf3b16d69b5f769a2bb45cc860ddbce79cdef9d0 (diff) | |
Fix WM presubmit failures
The changes in SizeConfigurationBuckets in commit 8ec32dd
was not verified by wm presubmit and therefore broke a few
wm unit tests.
Bug: 235774601
Bug: 237348419
Test: ActivityRecordTests
Test: SizeConfigurationBucketsTest
Change-Id: I23299e329c2bf2ca94fc156859993ea31ad3dc75
| -rw-r--r-- | core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java | 15 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java | 10 |
2 files changed, 10 insertions, 15 deletions
diff --git a/core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java b/core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java index fa4aa803c75e..ed857e8fc960 100644 --- a/core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java +++ b/core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java @@ -88,26 +88,15 @@ public class SizeConfigurationBucketsTest { } /** - * Tests that null size configuration buckets unflips the correct configuration flags. + * Tests that {@code null} size configuration buckets do not unflip the configuration flags. */ @Test public void testNullSizeConfigurationBuckets() { - // Check that all 3 size configurations are filtered out of the diff if the buckets are null - // and non-size attributes of screen layout are unchanged. Add a non-size related config - // change (i.e. CONFIG_LOCALE) to test that the diff is not set to zero. final int diff = CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_SCREEN_LAYOUT | CONFIG_LOCALE; final int filteredDiffNonSizeLayoutUnchanged = SizeConfigurationBuckets.filterDiff(diff, Configuration.EMPTY, Configuration.EMPTY, null); - assertEquals(CONFIG_LOCALE, filteredDiffNonSizeLayoutUnchanged); - - // Check that only screen size and smallest screen size are filtered out of the diff if the - // buckets are null and non-size attributes of screen layout are changed. - final Configuration newConfig = new Configuration(); - newConfig.screenLayout |= SCREENLAYOUT_ROUND_YES; - final int filteredDiffNonSizeLayoutChanged = SizeConfigurationBuckets.filterDiff(diff, - Configuration.EMPTY, newConfig, null); - assertEquals(CONFIG_SCREEN_LAYOUT | CONFIG_LOCALE, filteredDiffNonSizeLayoutChanged); + assertEquals(diff, filteredDiffNonSizeLayoutUnchanged); } /** diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index cfeaf850da03..6aeb9fa02a8e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -29,6 +29,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION; import static android.content.pm.ActivityInfo.CONFIG_SCREEN_LAYOUT; +import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE; +import static android.content.pm.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE; import static android.content.pm.ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE; import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS; import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_DEFAULT; @@ -182,6 +184,10 @@ public class ActivityRecordTests extends WindowTestsBase { private final String mPackageName = getInstrumentation().getTargetContext().getPackageName(); + private static final int ORIENTATION_CONFIG_CHANGES = + CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT | CONFIG_SCREEN_SIZE + | CONFIG_SMALLEST_SCREEN_SIZE; + @Before public void setUp() throws Exception { setBooted(mAtm); @@ -487,7 +493,7 @@ public class ActivityRecordTests extends WindowTestsBase { public void testSetRequestedOrientationUpdatesConfiguration() throws Exception { final ActivityRecord activity = new ActivityBuilder(mAtm) .setCreateTask(true) - .setConfigChanges(CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT) + .setConfigChanges(ORIENTATION_CONFIG_CHANGES) .build(); activity.setState(RESUMED, "Testing"); @@ -710,7 +716,7 @@ public class ActivityRecordTests extends WindowTestsBase { final ActivityRecord activity = new ActivityBuilder(mAtm) .setCreateTask(true) .setLaunchTaskBehind(true) - .setConfigChanges(CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT) + .setConfigChanges(ORIENTATION_CONFIG_CHANGES) .build(); final Task task = activity.getTask(); activity.setState(STOPPED, "Testing"); |