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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user