Loading core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java +2 −13 Original line number Diff line number Diff line Loading @@ -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); } /** Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +8 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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"); Loading Loading @@ -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"); Loading Loading
core/tests/mockingcoretests/src/android/window/SizeConfigurationBucketsTest.java +2 −13 Original line number Diff line number Diff line Loading @@ -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); } /** Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +8 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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"); Loading Loading @@ -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"); Loading