Loading packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java +1 −3 Original line number Diff line number Diff line Loading @@ -178,8 +178,7 @@ public class ThemeOverlayApplier implements Dumpable { Map<String, OverlayIdentifier> categoryToPackage, FabricatedOverlay[] pendingCreation, int currentUser, Set<UserHandle> managedProfiles, Runnable onOverlaysApplied) { Set<UserHandle> managedProfiles) { mBgExecutor.execute(() -> { // Disable all overlays that have not been specified in the user setting. Loading Loading @@ -226,7 +225,6 @@ public class ThemeOverlayApplier implements Dumpable { try { mOverlayManager.commit(transaction.build()); mMainExecutor.execute(onOverlaysApplied); } catch (SecurityException | IllegalStateException e) { Log.e(TAG, "setEnabled failed", e); } Loading packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +2 −6 Original line number Diff line number Diff line Loading @@ -521,21 +521,17 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { .map(key -> key + " -> " + categoryToPackage.get(key)).collect( Collectors.joining(", "))); } Runnable overlaysAppliedRunnable = () -> onOverlaysApplied(); if (mNeedsOverlayCreation) { mNeedsOverlayCreation = false; mThemeManager.applyCurrentUserOverlays(categoryToPackage, new FabricatedOverlay[] { mSecondaryOverlay, mNeutralOverlay }, currentUser, managedProfiles, overlaysAppliedRunnable); }, currentUser, managedProfiles); } else { mThemeManager.applyCurrentUserOverlays(categoryToPackage, null, currentUser, managedProfiles, overlaysAppliedRunnable); managedProfiles); } } protected void onOverlaysApplied() { } @Override public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) { pw.println("mSystemColors=" + mCurrentColors); Loading packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayApplierTest.java +8 −11 Original line number Diff line number Diff line Loading @@ -96,8 +96,6 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { DumpManager mDumpManager; @Mock OverlayManagerTransaction.Builder mTransactionBuilder; @Mock Runnable mOnOverlaysApplied; private ThemeOverlayApplier mManager; private boolean mGetOverlayInfoEnabled = true; Loading Loading @@ -176,7 +174,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { @Test public void allCategoriesSpecified_allEnabledExclusively() { mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); verify(mOverlayManager).commit(any()); for (OverlayIdentifier overlayPackage : ALL_CATEGORIES_MAP.values()) { Loading @@ -188,7 +186,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { @Test public void allCategoriesSpecified_sysuiCategoriesAlsoAppliedToSysuiUser() { mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); for (Map.Entry<String, OverlayIdentifier> entry : ALL_CATEGORIES_MAP.entrySet()) { if (SYSTEM_USER_CATEGORIES.contains(entry.getKey())) { Loading @@ -205,9 +203,8 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { public void allCategoriesSpecified_enabledForAllUserHandles() { Set<UserHandle> userHandles = Sets.newHashSet(TEST_USER_HANDLES); mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), userHandles, mOnOverlaysApplied); userHandles); verify(mOnOverlaysApplied).run(); for (OverlayIdentifier overlayPackage : ALL_CATEGORIES_MAP.values()) { verify(mTransactionBuilder).setEnabled(eq(overlayPackage), eq(true), eq(TEST_USER.getIdentifier())); Loading @@ -223,7 +220,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { Set<UserHandle> userHandles = Sets.newHashSet(TEST_USER_HANDLES); mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), userHandles, mOnOverlaysApplied); userHandles); for (OverlayIdentifier overlayPackage : ALL_CATEGORIES_MAP.values()) { verify(mTransactionBuilder, never()).setEnabled(eq(overlayPackage), eq(true), Loading @@ -237,7 +234,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { mock(FabricatedOverlay.class) }; mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, pendingCreation, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER.getIdentifier(), TEST_USER_HANDLES); for (FabricatedOverlay overlay : pendingCreation) { verify(mTransactionBuilder).registerFabricatedOverlay(eq(overlay)); Loading @@ -251,7 +248,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { categoryToPackage.remove(OVERLAY_CATEGORY_ICON_ANDROID); mManager.applyCurrentUserOverlays(categoryToPackage, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); for (OverlayIdentifier overlayPackage : categoryToPackage.values()) { verify(mTransactionBuilder).setEnabled(eq(overlayPackage), eq(true), Loading @@ -268,7 +265,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { @Test public void zeroCategoriesSpecified_allDisabled() { mManager.applyCurrentUserOverlays(Maps.newArrayMap(), null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); for (String category : THEME_CATEGORIES) { verify(mTransactionBuilder).setEnabled( Loading @@ -283,7 +280,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { categoryToPackage.put("blah.category", new OverlayIdentifier("com.example.blah.category")); mManager.applyCurrentUserOverlays(categoryToPackage, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); verify(mTransactionBuilder, never()).setEnabled( eq(new OverlayIdentifier("com.example.blah.category")), eq(false), Loading packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java +25 −25 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(Map.class); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any()); // Assert that we received the colors that we were expecting assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE)) Loading @@ -183,7 +183,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_WALLPAPER_CHANGED)); mColorsListener.getValue().onColorsChanged(new WallpaperColors(Color.valueOf(Color.BLACK), null, null), WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -204,7 +204,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(Map.class); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any()); // Assert that we received the colors that we were expecting assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE)) Loading Loading @@ -240,7 +240,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { .isFalse(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -270,7 +270,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { "android.theme.customization.color_both\":\"0")).isTrue(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -300,7 +300,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { "android.theme.customization.color_both\":\"1")).isTrue(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -327,7 +327,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { assertThat(updatedSetting.getValue().contains("android.theme.customization.color_index")) .isFalse(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -354,7 +354,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { assertThat(updatedSetting.getValue().contains("android.theme.customization.color_index")) .isFalse(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -382,7 +382,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { eq(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES), updatedSetting.capture()); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -411,14 +411,14 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test public void onProfileAdded_setsTheme() { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED)); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -428,7 +428,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED)); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -438,7 +438,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED)); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -450,7 +450,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { Color.valueOf(Color.BLUE), null); mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); // Regression test: null events should not reset the internal state and allow colors to be // applied again. Loading @@ -458,11 +458,11 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_WALLPAPER_CHANGED)); mColorsListener.getValue().onColorsChanged(null, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); any()); mColorsListener.getValue().onColorsChanged(new WallpaperColors(Color.valueOf(Color.GREEN), null, null), WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); any()); } @Test Loading Loading @@ -499,7 +499,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { verify(mDeviceProvisionedController).addCallback(mDeviceProvisionedListener.capture()); // Colors were applied during controller initialization. verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); clearInvocations(mThemeOverlayApplier); } Loading Loading @@ -533,7 +533,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { verify(mDeviceProvisionedController).addCallback(mDeviceProvisionedListener.capture()); // Colors were applied during controller initialization. verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); clearInvocations(mThemeOverlayApplier); WallpaperColors mainColors = new WallpaperColors(Color.valueOf(Color.RED), Loading @@ -542,12 +542,12 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { // Defers event because we already have initial colors. verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); // Then event happens after setup phase is over. when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true); mDeviceProvisionedListener.getValue().onUserSetupChanged(); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -568,11 +568,11 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { Color.valueOf(Color.RED), null); mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); mWakefulnessLifecycle.dispatchFinishedGoingToSleep(); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -592,10 +592,10 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { Color.valueOf(Color.RED), null); mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); mWakefulnessLifecycleObserver.getValue().onFinishedGoingToSleep(); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -614,7 +614,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(Map.class); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any()); // Assert that we received the colors that we were expecting assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE)) Loading Loading
packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java +1 −3 Original line number Diff line number Diff line Loading @@ -178,8 +178,7 @@ public class ThemeOverlayApplier implements Dumpable { Map<String, OverlayIdentifier> categoryToPackage, FabricatedOverlay[] pendingCreation, int currentUser, Set<UserHandle> managedProfiles, Runnable onOverlaysApplied) { Set<UserHandle> managedProfiles) { mBgExecutor.execute(() -> { // Disable all overlays that have not been specified in the user setting. Loading Loading @@ -226,7 +225,6 @@ public class ThemeOverlayApplier implements Dumpable { try { mOverlayManager.commit(transaction.build()); mMainExecutor.execute(onOverlaysApplied); } catch (SecurityException | IllegalStateException e) { Log.e(TAG, "setEnabled failed", e); } Loading
packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +2 −6 Original line number Diff line number Diff line Loading @@ -521,21 +521,17 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { .map(key -> key + " -> " + categoryToPackage.get(key)).collect( Collectors.joining(", "))); } Runnable overlaysAppliedRunnable = () -> onOverlaysApplied(); if (mNeedsOverlayCreation) { mNeedsOverlayCreation = false; mThemeManager.applyCurrentUserOverlays(categoryToPackage, new FabricatedOverlay[] { mSecondaryOverlay, mNeutralOverlay }, currentUser, managedProfiles, overlaysAppliedRunnable); }, currentUser, managedProfiles); } else { mThemeManager.applyCurrentUserOverlays(categoryToPackage, null, currentUser, managedProfiles, overlaysAppliedRunnable); managedProfiles); } } protected void onOverlaysApplied() { } @Override public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) { pw.println("mSystemColors=" + mCurrentColors); Loading
packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayApplierTest.java +8 −11 Original line number Diff line number Diff line Loading @@ -96,8 +96,6 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { DumpManager mDumpManager; @Mock OverlayManagerTransaction.Builder mTransactionBuilder; @Mock Runnable mOnOverlaysApplied; private ThemeOverlayApplier mManager; private boolean mGetOverlayInfoEnabled = true; Loading Loading @@ -176,7 +174,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { @Test public void allCategoriesSpecified_allEnabledExclusively() { mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); verify(mOverlayManager).commit(any()); for (OverlayIdentifier overlayPackage : ALL_CATEGORIES_MAP.values()) { Loading @@ -188,7 +186,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { @Test public void allCategoriesSpecified_sysuiCategoriesAlsoAppliedToSysuiUser() { mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); for (Map.Entry<String, OverlayIdentifier> entry : ALL_CATEGORIES_MAP.entrySet()) { if (SYSTEM_USER_CATEGORIES.contains(entry.getKey())) { Loading @@ -205,9 +203,8 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { public void allCategoriesSpecified_enabledForAllUserHandles() { Set<UserHandle> userHandles = Sets.newHashSet(TEST_USER_HANDLES); mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), userHandles, mOnOverlaysApplied); userHandles); verify(mOnOverlaysApplied).run(); for (OverlayIdentifier overlayPackage : ALL_CATEGORIES_MAP.values()) { verify(mTransactionBuilder).setEnabled(eq(overlayPackage), eq(true), eq(TEST_USER.getIdentifier())); Loading @@ -223,7 +220,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { Set<UserHandle> userHandles = Sets.newHashSet(TEST_USER_HANDLES); mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, null, TEST_USER.getIdentifier(), userHandles, mOnOverlaysApplied); userHandles); for (OverlayIdentifier overlayPackage : ALL_CATEGORIES_MAP.values()) { verify(mTransactionBuilder, never()).setEnabled(eq(overlayPackage), eq(true), Loading @@ -237,7 +234,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { mock(FabricatedOverlay.class) }; mManager.applyCurrentUserOverlays(ALL_CATEGORIES_MAP, pendingCreation, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER.getIdentifier(), TEST_USER_HANDLES); for (FabricatedOverlay overlay : pendingCreation) { verify(mTransactionBuilder).registerFabricatedOverlay(eq(overlay)); Loading @@ -251,7 +248,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { categoryToPackage.remove(OVERLAY_CATEGORY_ICON_ANDROID); mManager.applyCurrentUserOverlays(categoryToPackage, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); for (OverlayIdentifier overlayPackage : categoryToPackage.values()) { verify(mTransactionBuilder).setEnabled(eq(overlayPackage), eq(true), Loading @@ -268,7 +265,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { @Test public void zeroCategoriesSpecified_allDisabled() { mManager.applyCurrentUserOverlays(Maps.newArrayMap(), null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); for (String category : THEME_CATEGORIES) { verify(mTransactionBuilder).setEnabled( Loading @@ -283,7 +280,7 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { categoryToPackage.put("blah.category", new OverlayIdentifier("com.example.blah.category")); mManager.applyCurrentUserOverlays(categoryToPackage, null, TEST_USER.getIdentifier(), TEST_USER_HANDLES, mOnOverlaysApplied); TEST_USER_HANDLES); verify(mTransactionBuilder, never()).setEnabled( eq(new OverlayIdentifier("com.example.blah.category")), eq(false), Loading
packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java +25 −25 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(Map.class); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any()); // Assert that we received the colors that we were expecting assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE)) Loading @@ -183,7 +183,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_WALLPAPER_CHANGED)); mColorsListener.getValue().onColorsChanged(new WallpaperColors(Color.valueOf(Color.BLACK), null, null), WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -204,7 +204,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(Map.class); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any()); // Assert that we received the colors that we were expecting assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE)) Loading Loading @@ -240,7 +240,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { .isFalse(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -270,7 +270,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { "android.theme.customization.color_both\":\"0")).isTrue(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -300,7 +300,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { "android.theme.customization.color_both\":\"1")).isTrue(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -327,7 +327,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { assertThat(updatedSetting.getValue().contains("android.theme.customization.color_index")) .isFalse(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -354,7 +354,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { assertThat(updatedSetting.getValue().contains("android.theme.customization.color_index")) .isFalse(); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -382,7 +382,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { eq(Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES), updatedSetting.capture()); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading Loading @@ -411,14 +411,14 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test public void onProfileAdded_setsTheme() { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED)); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -428,7 +428,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED)); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -438,7 +438,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED)); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -450,7 +450,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { Color.valueOf(Color.BLUE), null); mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); // Regression test: null events should not reset the internal state and allow colors to be // applied again. Loading @@ -458,11 +458,11 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { mBroadcastReceiver.getValue().onReceive(null, new Intent(Intent.ACTION_WALLPAPER_CHANGED)); mColorsListener.getValue().onColorsChanged(null, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); any()); mColorsListener.getValue().onColorsChanged(new WallpaperColors(Color.valueOf(Color.GREEN), null, null), WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); any()); } @Test Loading Loading @@ -499,7 +499,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { verify(mDeviceProvisionedController).addCallback(mDeviceProvisionedListener.capture()); // Colors were applied during controller initialization. verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); clearInvocations(mThemeOverlayApplier); } Loading Loading @@ -533,7 +533,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { verify(mDeviceProvisionedController).addCallback(mDeviceProvisionedListener.capture()); // Colors were applied during controller initialization. verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); clearInvocations(mThemeOverlayApplier); WallpaperColors mainColors = new WallpaperColors(Color.valueOf(Color.RED), Loading @@ -542,12 +542,12 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { // Defers event because we already have initial colors. verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); // Then event happens after setup phase is over. when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true); mDeviceProvisionedListener.getValue().onUserSetupChanged(); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -568,11 +568,11 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { Color.valueOf(Color.RED), null); mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); mWakefulnessLifecycle.dispatchFinishedGoingToSleep(); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -592,10 +592,10 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { Color.valueOf(Color.RED), null); mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM); verify(mThemeOverlayApplier, never()) .applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(any(), any(), anyInt(), any()); mWakefulnessLifecycleObserver.getValue().onFinishedGoingToSleep(); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any(), any()); verify(mThemeOverlayApplier).applyCurrentUserOverlays(any(), any(), anyInt(), any()); } @Test Loading @@ -614,7 +614,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase { ArgumentCaptor.forClass(Map.class); verify(mThemeOverlayApplier) .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any(), any()); .applyCurrentUserOverlays(themeOverlays.capture(), any(), anyInt(), any()); // Assert that we received the colors that we were expecting assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE)) Loading