Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ba5de5c authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Revert "Fix issue with white and black themes"

This reverts commit 860f61b4.

Reason for revert: Broke one sysui test

Change-Id: If43b21fc6588bbbb0e42e5159f70c94e52773c2a
parent 860f61b4
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -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<>();
+2 −28
Original line number Diff line number Diff line
@@ -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