Merge "Revert "Fix issue with white and black themes""

This commit is contained in:
Lucas Dupin
2020-12-08 23:56:40 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 35 deletions

View File

@@ -254,12 +254,6 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
ColorUtils.RGBToHSL(Color.red(color), Color.green(color), Color.blue(color), hslMain);
hslMain[0] /= 360f;
// To close to white or black, let's use the default system theme instead of
// applying a colorized one.
if (hslMain[2] < 0.05 || hslMain[2] > 0.95) {
return Color.TRANSPARENT;
}
float minDistance = Float.MAX_VALUE;
int closestColor = Color.TRANSPARENT;
for (int candidate: candidates) {
@@ -287,7 +281,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
final String overlayPackageJson = mSecureSettings.getStringForUser(
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
currentUser);
if (DEBUG) Log.d(TAG, "updateThemeOverlays. Setting: " + overlayPackageJson);
if (DEBUG) Log.d(TAG, "updateThemeOverlays: " + overlayPackageJson);
boolean hasSystemPalette = false;
boolean hasAccentColor = false;
final Map<String, String> categoryToPackage = new ArrayMap<>();

View File

@@ -147,37 +147,11 @@ public class ThemeOverlayControllerTest extends SysuiTestCase {
verifyNoMoreInteractions(mThemeOverlayApplier);
}
@Test
public void onWallpaperColorsChanged_whiteTheme() {
WallpaperColors mainColors = new WallpaperColors(Color.valueOf(Color.WHITE),
Color.valueOf(Color.BLUE), null);
mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM);
ArgumentCaptor<Map<String, String>> themeOverlays = ArgumentCaptor.forClass(Map.class);
verify(mThemeOverlayApplier).applyCurrentUserOverlays(themeOverlays.capture(), any());
// Assert that we received the colors that we were expecting
assertThat(!themeOverlays.getValue().containsKey(OVERLAY_CATEGORY_SYSTEM_PALETTE));
}
@Test
public void onWallpaperColorsChanged_blackTheme() {
WallpaperColors mainColors = new WallpaperColors(Color.valueOf(Color.BLACK),
Color.valueOf(Color.BLUE), null);
mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM);
ArgumentCaptor<Map<String, String>> themeOverlays = ArgumentCaptor.forClass(Map.class);
verify(mThemeOverlayApplier).applyCurrentUserOverlays(themeOverlays.capture(), any());
// Assert that we received the colors that we were expecting
assertThat(!themeOverlays.getValue().containsKey(OVERLAY_CATEGORY_SYSTEM_PALETTE));
}
@Test
public void onWallpaperColorsChanged_addsLeadingZerosToColors() {
// Should ask for a new theme when wallpaper colors change
WallpaperColors mainColors = new WallpaperColors(Color.valueOf(0x0CCCCC),
Color.valueOf(0x000CCC), null);
Color.valueOf(0x000111), null);
mColorsListener.getValue().onColorsChanged(mainColors, WallpaperManager.FLAG_SYSTEM);
ArgumentCaptor<Map<String, String>> themeOverlays = ArgumentCaptor.forClass(Map.class);
@@ -187,7 +161,7 @@ public class ThemeOverlayControllerTest extends SysuiTestCase {
assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE))
.isEqualTo(MONET_SYSTEM_PALETTE_PACKAGE + "0CCCCC");
assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_ACCENT_COLOR))
.isEqualTo(MONET_ACCENT_COLOR_PACKAGE + "000CCC");
.isEqualTo(MONET_ACCENT_COLOR_PACKAGE + "000111");
}
@Test