Fix Settings test that uses OverlayInfo
Now that targetOverlayableName has been added to OverlayInfo, the tests
that construct the info objects must be fixed.
Bug: 128830059
Test: atest SettingsRoboTestStub
Change-Id: I2cee25e417ec643f758ebe40551cc97b1f0828ac
diff --git a/tests/robotests/src/com/android/settings/development/OverlayCategoryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/OverlayCategoryPreferenceControllerTest.java
index 8a90b20..b2e8013 100644
--- a/tests/robotests/src/com/android/settings/development/OverlayCategoryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/OverlayCategoryPreferenceControllerTest.java
@@ -221,6 +221,7 @@
return new OverlayInfo(pkg /* packageName */,
"android" /* targetPackageName */,
+ null /* targetOverlayableName */,
TEST_CATEGORY/* category */,
pkg + ".baseCodePath" /* baseCodePath */,
state /* state */,
diff --git a/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java
index 41947a0..5133ae6 100644
--- a/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java
@@ -84,7 +84,7 @@
when(mPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn(
new PackageInfo());
when(mOverlayManager.getOverlayInfosForTarget(any(), anyInt()))
- .thenReturn(Arrays.asList(new OverlayInfo("", "", "", "", 0, 0, 0, false)));
+ .thenReturn(Arrays.asList(new OverlayInfo("", "", "", "", "", 0, 0, 0, false)));
assertThat(mController.isAvailable()).isFalse();
}
@@ -94,8 +94,9 @@
new PackageInfo());
when(mOverlayManager.getOverlayInfosForTarget(any(), anyInt()))
.thenReturn(Arrays.asList(
- new OverlayInfo("", "", OverlayInfo.CATEGORY_THEME, "", 0, 0, 0, true),
- new OverlayInfo("", "", OverlayInfo.CATEGORY_THEME, "", 0, 0, 0, true)));
+ new OverlayInfo("", "", "", OverlayInfo.CATEGORY_THEME, "", 0, 0, 0, true),
+ new OverlayInfo("", "", "", OverlayInfo.CATEGORY_THEME, "", 0, 0, 0,
+ true)));
assertThat(mController.isAvailable()).isTrue();
}
@@ -140,9 +141,9 @@
@Test
public void getCurrentTheme_withEnabledState() throws Exception {
- OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android",
+ OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", "",
OverlayInfo.CATEGORY_THEME, "", OverlayInfo.STATE_ENABLED, 0, 0, true);
- OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android",
+ OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", "",
OverlayInfo.CATEGORY_THEME, "", 0, 0, 0, true);
when(mOverlayManager.getOverlayInfosForTarget(any(), anyInt())).thenReturn(
Arrays.asList(info1, info2));
@@ -154,9 +155,9 @@
@Test
public void testGetCurrentTheme_withoutEnabledState() throws Exception {
- OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android",
+ OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", "",
OverlayInfo.CATEGORY_THEME, "", OverlayInfo.STATE_DISABLED, 0, 0, true);
- OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android",
+ OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", "",
OverlayInfo.CATEGORY_THEME, "", 0, 0, 0, true);
when(mOverlayManager.getOverlayInfosForTarget(any(), anyInt())).thenReturn(
Arrays.asList(info1, info2));
diff --git a/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java b/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java
index 3cdfb7c..c5ee000 100644
--- a/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java
@@ -69,9 +69,9 @@
@Test
public void testUpdateState() throws Exception {
- OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android",
+ OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", "",
OverlayInfo.CATEGORY_THEME, "", OverlayInfo.STATE_ENABLED, 0, 0, true);
- OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android",
+ OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", "",
OverlayInfo.CATEGORY_THEME, "", 0, 0, 0, true);
when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> {
ApplicationInfo info = mock(ApplicationInfo.class);
@@ -105,9 +105,9 @@
@Test
public void testUpdateState_withStaticOverlay() throws Exception {
- OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android",
+ OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", "",
OverlayInfo.CATEGORY_THEME, "", OverlayInfo.STATE_ENABLED, 0, 0, true);
- OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android",
+ OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", "",
OverlayInfo.CATEGORY_THEME, "", OverlayInfo.STATE_ENABLED, 0, 0, true);
when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> {
ApplicationInfo info = mock(ApplicationInfo.class);