Merge "OMS: rebase settings when overlays update" into pi-dev

This commit is contained in:
Todd Kennedy
2018-05-11 17:44:53 +00:00
committed by Android (Google) Code Review

View File

@@ -69,9 +69,9 @@ public class ThemePreferenceControllerTest {
@Test @Test
public void testUpdateState() throws Exception { public void testUpdateState() throws Exception {
OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android",
"", "", OverlayInfo.STATE_ENABLED, 0); "", "", OverlayInfo.STATE_ENABLED, 0, 0, true);
OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android",
"", "", 0, 0); "", "", 0, 0, 0, true);
when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> { when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> {
ApplicationInfo info = mock(ApplicationInfo.class); ApplicationInfo info = mock(ApplicationInfo.class);
if ("com.android.Theme1".equals(inv.getArguments()[0])) { if ("com.android.Theme1".equals(inv.getArguments()[0])) {
@@ -105,9 +105,9 @@ public class ThemePreferenceControllerTest {
@Test @Test
public void testUpdateState_withStaticOverlay() throws Exception { public void testUpdateState_withStaticOverlay() throws Exception {
OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android",
"", "", OverlayInfo.STATE_ENABLED, 0); "", "", OverlayInfo.STATE_ENABLED, 0, 0, true);
OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android",
"", "", OverlayInfo.STATE_ENABLED, 0); "", "", OverlayInfo.STATE_ENABLED, 0, 0, true);
when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> { when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> {
ApplicationInfo info = mock(ApplicationInfo.class); ApplicationInfo info = mock(ApplicationInfo.class);
if ("com.android.Theme1".equals(inv.getArguments()[0])) { if ("com.android.Theme1".equals(inv.getArguments()[0])) {
@@ -145,7 +145,7 @@ public class ThemePreferenceControllerTest {
when(mMockPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn( when(mMockPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn(
new PackageInfo()); new PackageInfo());
when(mMockOverlayManager.getOverlayInfosForTarget(any(), anyInt())) when(mMockOverlayManager.getOverlayInfosForTarget(any(), anyInt()))
.thenReturn(list(new OverlayInfo("", "", "", "", 0, 0))); .thenReturn(list(new OverlayInfo("", "", "", "", 0, 0, 0, false)));
assertThat(mPreferenceController.isAvailable()).isFalse(); assertThat(mPreferenceController.isAvailable()).isFalse();
} }
@@ -154,8 +154,8 @@ public class ThemePreferenceControllerTest {
when(mMockPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn( when(mMockPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn(
new PackageInfo()); new PackageInfo());
when(mMockOverlayManager.getOverlayInfosForTarget(any(), anyInt())) when(mMockOverlayManager.getOverlayInfosForTarget(any(), anyInt()))
.thenReturn(list(new OverlayInfo("", "", "", "", 0, 0), .thenReturn(list(new OverlayInfo("", "", "", "", 0, 0, 0, true),
new OverlayInfo("", "", "", "", 0, 0))); new OverlayInfo("", "", "", "", 0, 0, 0, true)));
assertThat(mPreferenceController.isAvailable()).isTrue(); assertThat(mPreferenceController.isAvailable()).isTrue();
} }