Add neutral palette, rename main and accent
Added new netrual colors palette, and renamed main and accent palettes to primary and secondary respectively. This was done to align with the new color spec. Test: atest SystemPalette Test: atest ColorTest Test: atest ThemeOverlayControllerTest Bug: 171916625 Change-Id: Ia56eb1e96a01c3ff8a64de0e1d632d4436bc9048
This commit is contained in:
@@ -1708,30 +1708,42 @@ package android {
|
||||
field @Deprecated public static final int secondary_text_dark_nodisable = 17170438; // 0x1060006
|
||||
field @Deprecated public static final int secondary_text_light = 17170439; // 0x1060007
|
||||
field @Deprecated public static final int secondary_text_light_nodisable = 17170440; // 0x1060008
|
||||
field public static final int system_accent_0 = 17170473; // 0x1060029
|
||||
field public static final int system_accent_100 = 17170475; // 0x106002b
|
||||
field public static final int system_accent_1000 = 17170484; // 0x1060034
|
||||
field public static final int system_accent_200 = 17170476; // 0x106002c
|
||||
field public static final int system_accent_300 = 17170477; // 0x106002d
|
||||
field public static final int system_accent_400 = 17170478; // 0x106002e
|
||||
field public static final int system_accent_50 = 17170474; // 0x106002a
|
||||
field public static final int system_accent_500 = 17170479; // 0x106002f
|
||||
field public static final int system_accent_600 = 17170480; // 0x1060030
|
||||
field public static final int system_accent_700 = 17170481; // 0x1060031
|
||||
field public static final int system_accent_800 = 17170482; // 0x1060032
|
||||
field public static final int system_accent_900 = 17170483; // 0x1060033
|
||||
field public static final int system_main_0 = 17170461; // 0x106001d
|
||||
field public static final int system_main_100 = 17170463; // 0x106001f
|
||||
field public static final int system_main_1000 = 17170472; // 0x1060028
|
||||
field public static final int system_main_200 = 17170464; // 0x1060020
|
||||
field public static final int system_main_300 = 17170465; // 0x1060021
|
||||
field public static final int system_main_400 = 17170466; // 0x1060022
|
||||
field public static final int system_main_50 = 17170462; // 0x106001e
|
||||
field public static final int system_main_500 = 17170467; // 0x1060023
|
||||
field public static final int system_main_600 = 17170468; // 0x1060024
|
||||
field public static final int system_main_700 = 17170469; // 0x1060025
|
||||
field public static final int system_main_800 = 17170470; // 0x1060026
|
||||
field public static final int system_main_900 = 17170471; // 0x1060027
|
||||
field public static final int system_neutral_0 = 17170485; // 0x1060035
|
||||
field public static final int system_neutral_100 = 17170487; // 0x1060037
|
||||
field public static final int system_neutral_1000 = 17170496; // 0x1060040
|
||||
field public static final int system_neutral_200 = 17170488; // 0x1060038
|
||||
field public static final int system_neutral_300 = 17170489; // 0x1060039
|
||||
field public static final int system_neutral_400 = 17170490; // 0x106003a
|
||||
field public static final int system_neutral_50 = 17170486; // 0x1060036
|
||||
field public static final int system_neutral_500 = 17170491; // 0x106003b
|
||||
field public static final int system_neutral_600 = 17170492; // 0x106003c
|
||||
field public static final int system_neutral_700 = 17170493; // 0x106003d
|
||||
field public static final int system_neutral_800 = 17170494; // 0x106003e
|
||||
field public static final int system_neutral_900 = 17170495; // 0x106003f
|
||||
field public static final int system_primary_0 = 17170461; // 0x106001d
|
||||
field public static final int system_primary_100 = 17170463; // 0x106001f
|
||||
field public static final int system_primary_1000 = 17170472; // 0x1060028
|
||||
field public static final int system_primary_200 = 17170464; // 0x1060020
|
||||
field public static final int system_primary_300 = 17170465; // 0x1060021
|
||||
field public static final int system_primary_400 = 17170466; // 0x1060022
|
||||
field public static final int system_primary_50 = 17170462; // 0x106001e
|
||||
field public static final int system_primary_500 = 17170467; // 0x1060023
|
||||
field public static final int system_primary_600 = 17170468; // 0x1060024
|
||||
field public static final int system_primary_700 = 17170469; // 0x1060025
|
||||
field public static final int system_primary_800 = 17170470; // 0x1060026
|
||||
field public static final int system_primary_900 = 17170471; // 0x1060027
|
||||
field public static final int system_secondary_0 = 17170473; // 0x1060029
|
||||
field public static final int system_secondary_100 = 17170475; // 0x106002b
|
||||
field public static final int system_secondary_1000 = 17170484; // 0x1060034
|
||||
field public static final int system_secondary_200 = 17170476; // 0x106002c
|
||||
field public static final int system_secondary_300 = 17170477; // 0x106002d
|
||||
field public static final int system_secondary_400 = 17170478; // 0x106002e
|
||||
field public static final int system_secondary_50 = 17170474; // 0x106002a
|
||||
field public static final int system_secondary_500 = 17170479; // 0x106002f
|
||||
field public static final int system_secondary_600 = 17170480; // 0x1060030
|
||||
field public static final int system_secondary_700 = 17170481; // 0x1060031
|
||||
field public static final int system_secondary_800 = 17170482; // 0x1060032
|
||||
field public static final int system_secondary_900 = 17170483; // 0x1060033
|
||||
field public static final int tab_indicator_text = 17170441; // 0x1060009
|
||||
field @Deprecated public static final int tertiary_text_dark = 17170448; // 0x1060010
|
||||
field @Deprecated public static final int tertiary_text_light = 17170449; // 0x1060011
|
||||
|
||||
@@ -240,77 +240,114 @@
|
||||
|
||||
<color name="conversation_important_highlight">#F9AB00</color>
|
||||
|
||||
<!-- Lightest shade of the main color used by the system. White.
|
||||
<!-- Lightest shade of the primary color used by the system. White.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_0">#ffffff</color>
|
||||
<!-- Shade of the main system color at 95% lightness.
|
||||
<color name="system_primary_0">#ffffff</color>
|
||||
<!-- Shade of the primary system color at 95% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_50">#f2f2f2</color>
|
||||
<!-- Shade of the main system color at 90% lightness.
|
||||
<color name="system_primary_50">#f2f2f2</color>
|
||||
<!-- Shade of the primary system color at 90% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_100">#e3e3e3</color>
|
||||
<!-- Shade of the main system color at 80% lightness.
|
||||
<color name="system_primary_100">#e3e3e3</color>
|
||||
<!-- Shade of the primary system color at 80% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_200">#c7c7c7</color>
|
||||
<!-- Shade of the main system color at 70% lightness.
|
||||
<color name="system_primary_200">#c7c7c7</color>
|
||||
<!-- Shade of the primary system color at 70% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_300">#ababab</color>
|
||||
<!-- Shade of the main system color at 60% lightness.
|
||||
<color name="system_primary_300">#ababab</color>
|
||||
<!-- Shade of the primary system color at 60% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_400">#8f8f8f</color>
|
||||
<!-- Shade of the main system color at 50% lightness.
|
||||
<color name="system_primary_400">#8f8f8f</color>
|
||||
<!-- Shade of the primary system color at 50% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_500">#757575</color>
|
||||
<!-- Shade of the main system color at 40% lightness.
|
||||
<color name="system_primary_500">#757575</color>
|
||||
<!-- Shade of the primary system color at 40% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_600">#5e5e5e</color>
|
||||
<!-- Shade of the main system color at 30% lightness.
|
||||
<color name="system_primary_600">#5e5e5e</color>
|
||||
<!-- Shade of the primary system color at 30% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_700">#474747</color>
|
||||
<!-- Shade of the main system color at 20% lightness.
|
||||
<color name="system_primary_700">#474747</color>
|
||||
<!-- Shade of the primary system color at 20% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_800">#303030</color>
|
||||
<!-- Shade of the main system color at 10% lightness.
|
||||
<color name="system_primary_800">#303030</color>
|
||||
<!-- Shade of the primary system color at 10% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_900">#1f1f1f</color>
|
||||
<!-- Darkest shade of the main color used by the system. Black.
|
||||
<color name="system_primary_900">#1f1f1f</color>
|
||||
<!-- Darkest shade of the primary color used by the system. Black.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_main_1000">#000000</color>
|
||||
<color name="system_primary_1000">#000000</color>
|
||||
|
||||
<!-- Lightest shade of the accent color used by the system. White.
|
||||
<!-- Lightest shade of the secondary color used by the system. White.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_0">#ffffff</color>
|
||||
<!-- Shade of the accent system color at 95% lightness.
|
||||
<color name="system_secondary_0">#ffffff</color>
|
||||
<!-- Shade of the secondary system color at 95% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_50">#91fff4</color>
|
||||
<!-- Shade of the accent system color at 90% lightness.
|
||||
<color name="system_secondary_50">#91fff4</color>
|
||||
<!-- Shade of the secondary system color at 90% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_100">#83f6e5</color>
|
||||
<!-- Shade of the accent system color at 80% lightness.
|
||||
<color name="system_secondary_100">#83f6e5</color>
|
||||
<!-- Shade of the secondary system color at 80% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_200">#65d9c9</color>
|
||||
<!-- Shade of the accent system color at 70% lightness.
|
||||
<color name="system_secondary_200">#65d9c9</color>
|
||||
<!-- Shade of the secondary system color at 70% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_300">#45bdae</color>
|
||||
<!-- Shade of the accent system color at 60% lightness.
|
||||
<color name="system_secondary_300">#45bdae</color>
|
||||
<!-- Shade of the secondary system color at 60% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_400">#1fa293</color>
|
||||
<!-- Shade of the accent system color at 50% lightness.
|
||||
<color name="system_secondary_400">#1fa293</color>
|
||||
<!-- Shade of the secondary system color at 50% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_500">#008377</color>
|
||||
<!-- Shade of the accent system color at 40% lightness.
|
||||
<color name="system_secondary_500">#008377</color>
|
||||
<!-- Shade of the secondary system color at 40% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_600">#006d61</color>
|
||||
<!-- Shade of the accent system color at 30% lightness.
|
||||
<color name="system_secondary_600">#006d61</color>
|
||||
<!-- Shade of the secondary system color at 30% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_700">#005449</color>
|
||||
<!-- Shade of the accent system color at 20% lightness.
|
||||
<color name="system_secondary_700">#005449</color>
|
||||
<!-- Shade of the secondary system color at 20% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_800">#003c33</color>
|
||||
<!-- Shade of the accent system color at 10% lightness.
|
||||
<color name="system_secondary_800">#003c33</color>
|
||||
<!-- Shade of the secondary system color at 10% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_900">#00271e</color>
|
||||
<!-- Darkest shade of the accent color used by the system. Black.
|
||||
<color name="system_secondary_900">#00271e</color>
|
||||
<!-- Darkest shade of the secondary color used by the system. Black.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_accent_1000">#000000</color>
|
||||
<color name="system_secondary_1000">#000000</color>
|
||||
|
||||
<!-- Lightest shade of the neutral color used by the system. White.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_0">#ffffff</color>
|
||||
<!-- Shade of the neutral system color at 95% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_50">#f0f0f0</color>
|
||||
<!-- Shade of the neutral system color at 90% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_100">#e2e2e2</color>
|
||||
<!-- Shade of the neutral system color at 80% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_200">#c6c6c6</color>
|
||||
<!-- Shade of the neutral system color at 70% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_300">#ababab</color>
|
||||
<!-- Shade of the neutral system color at 60% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_400">#909090</color>
|
||||
<!-- Shade of the neutral system color at 50% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_500">#757575</color>
|
||||
<!-- Shade of the neutral system color at 40% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_600">#5e5e5e</color>
|
||||
<!-- Shade of the neutral system color at 30% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_700">#464646</color>
|
||||
<!-- Shade of the neutral system color at 20% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_800">#303030</color>
|
||||
<!-- Shade of the neutral system color at 10% lightness.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_900">#1b1b1b</color>
|
||||
<!-- Darkest shade of the neutral color used by the system. Black.
|
||||
This value can be overlaid at runtime by OverlayManager RROs. -->
|
||||
<color name="system_neutral_1000">#000000</color>
|
||||
</resources>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<!-- Colors specific to DeviceDefault themes. These are mostly pass-throughs to enable
|
||||
overlaying new theme colors. -->
|
||||
<resources>
|
||||
<color name="primary_device_default_dark">@color/system_main_800</color>
|
||||
<color name="primary_device_default_light">@color/system_main_50</color>
|
||||
<color name="primary_device_default_settings">@color/system_main_800</color>
|
||||
<color name="primary_device_default_dark">@color/system_primary_800</color>
|
||||
<color name="primary_device_default_light">@color/system_primary_50</color>
|
||||
<color name="primary_device_default_settings">@color/system_primary_800</color>
|
||||
<color name="primary_device_default_settings_light">@color/primary_device_default_light</color>
|
||||
<color name="primary_dark_device_default_dark">@color/primary_device_default_dark</color>
|
||||
<color name="primary_dark_device_default_light">@color/primary_device_default_light</color>
|
||||
@@ -33,21 +33,21 @@
|
||||
<color name="tertiary_device_default_settings">@color/tertiary_material_settings</color>
|
||||
<color name="quaternary_device_default_settings">@color/quaternary_material_settings</color>
|
||||
|
||||
<color name="accent_device_default_light">@color/system_accent_600</color>
|
||||
<color name="accent_device_default_dark">@color/system_accent_200</color>
|
||||
<color name="accent_device_default_light">@color/system_secondary_600</color>
|
||||
<color name="accent_device_default_dark">@color/system_secondary_200</color>
|
||||
<color name="accent_device_default">@color/accent_device_default_light</color>
|
||||
|
||||
<color name="background_device_default_dark">@color/system_main_800</color>
|
||||
<color name="background_device_default_light">@color/system_main_50</color>
|
||||
<color name="background_floating_device_default_dark">@color/system_main_900</color>
|
||||
<color name="background_floating_device_default_light">@color/system_main_100</color>
|
||||
<color name="background_device_default_dark">@color/system_primary_800</color>
|
||||
<color name="background_device_default_light">@color/system_primary_50</color>
|
||||
<color name="background_floating_device_default_dark">@color/system_primary_900</color>
|
||||
<color name="background_floating_device_default_light">@color/system_primary_100</color>
|
||||
|
||||
<color name="text_color_primary_device_default_light">@color/system_main_900</color>
|
||||
<color name="text_color_primary_device_default_dark">@color/system_main_50</color>
|
||||
<color name="text_color_secondary_device_default_light">@color/system_main_700</color>
|
||||
<color name="text_color_secondary_device_default_dark">@color/system_main_200</color>
|
||||
<color name="text_color_tertiary_device_default_light">@color/system_main_500</color>
|
||||
<color name="text_color_tertiary_device_default_dark">@color/system_main_400</color>
|
||||
<color name="text_color_primary_device_default_light">@color/system_primary_900</color>
|
||||
<color name="text_color_primary_device_default_dark">@color/system_primary_50</color>
|
||||
<color name="text_color_secondary_device_default_light">@color/system_primary_700</color>
|
||||
<color name="text_color_secondary_device_default_dark">@color/system_primary_200</color>
|
||||
<color name="text_color_tertiary_device_default_light">@color/system_primary_500</color>
|
||||
<color name="text_color_tertiary_device_default_dark">@color/system_primary_400</color>
|
||||
<color name="foreground_device_default_light">@color/text_color_primary_device_default_light</color>
|
||||
<color name="foreground_device_default_dark">@color/text_color_primary_device_default_dark</color>
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
<color name="error_color_device_default_dark">@color/error_color_material_dark</color>
|
||||
<color name="error_color_device_default_light">@color/error_color_material_light</color>
|
||||
|
||||
<color name="list_divider_color_light">@color/system_main_500</color>
|
||||
<color name="list_divider_color_dark">@color/system_main_400</color>
|
||||
<color name="list_divider_color_light">@color/system_primary_500</color>
|
||||
<color name="list_divider_color_dark">@color/system_primary_400</color>
|
||||
<color name="list_divider_opacity_device_default_light">@android:color/white</color>
|
||||
<color name="list_divider_opacity_device_default_dark">@android:color/white</color>
|
||||
|
||||
|
||||
@@ -3082,32 +3082,45 @@
|
||||
<!-- color definitions go here -->
|
||||
|
||||
<!-- Material design dynamic system palette:-->
|
||||
<!-- Dominant color -->
|
||||
<public name="system_main_0" />
|
||||
<public name="system_main_50" />
|
||||
<public name="system_main_100" />
|
||||
<public name="system_main_200" />
|
||||
<public name="system_main_300" />
|
||||
<public name="system_main_400" />
|
||||
<public name="system_main_500" />
|
||||
<public name="system_main_600" />
|
||||
<public name="system_main_700" />
|
||||
<public name="system_main_800" />
|
||||
<public name="system_main_900" />
|
||||
<public name="system_main_1000" />
|
||||
<!-- Accent color -->
|
||||
<public name="system_accent_0" />
|
||||
<public name="system_accent_50" />
|
||||
<public name="system_accent_100" />
|
||||
<public name="system_accent_200" />
|
||||
<public name="system_accent_300" />
|
||||
<public name="system_accent_400" />
|
||||
<public name="system_accent_500" />
|
||||
<public name="system_accent_600" />
|
||||
<public name="system_accent_700" />
|
||||
<public name="system_accent_800" />
|
||||
<public name="system_accent_900" />
|
||||
<public name="system_accent_1000" />
|
||||
<!-- Primary color -->
|
||||
<public name="system_primary_0" />
|
||||
<public name="system_primary_50" />
|
||||
<public name="system_primary_100" />
|
||||
<public name="system_primary_200" />
|
||||
<public name="system_primary_300" />
|
||||
<public name="system_primary_400" />
|
||||
<public name="system_primary_500" />
|
||||
<public name="system_primary_600" />
|
||||
<public name="system_primary_700" />
|
||||
<public name="system_primary_800" />
|
||||
<public name="system_primary_900" />
|
||||
<public name="system_primary_1000" />
|
||||
<!-- Secondary color -->
|
||||
<public name="system_secondary_0" />
|
||||
<public name="system_secondary_50" />
|
||||
<public name="system_secondary_100" />
|
||||
<public name="system_secondary_200" />
|
||||
<public name="system_secondary_300" />
|
||||
<public name="system_secondary_400" />
|
||||
<public name="system_secondary_500" />
|
||||
<public name="system_secondary_600" />
|
||||
<public name="system_secondary_700" />
|
||||
<public name="system_secondary_800" />
|
||||
<public name="system_secondary_900" />
|
||||
<public name="system_secondary_1000" />
|
||||
<!-- Neutral color -->
|
||||
<public name="system_neutral_0" />
|
||||
<public name="system_neutral_50" />
|
||||
<public name="system_neutral_100" />
|
||||
<public name="system_neutral_200" />
|
||||
<public name="system_neutral_300" />
|
||||
<public name="system_neutral_400" />
|
||||
<public name="system_neutral_500" />
|
||||
<public name="system_neutral_600" />
|
||||
<public name="system_neutral_700" />
|
||||
<public name="system_neutral_800" />
|
||||
<public name="system_neutral_900" />
|
||||
<public name="system_neutral_1000" />
|
||||
</public-group>
|
||||
|
||||
<public-group type="dimen" first-id="0x01050008">
|
||||
|
||||
@@ -65,6 +65,8 @@ public class ThemeOverlayApplier implements Dumpable {
|
||||
"android.theme.customization.accent_color";
|
||||
static final String OVERLAY_CATEGORY_SYSTEM_PALETTE =
|
||||
"android.theme.customization.system_palette";
|
||||
static final String OVERLAY_CATEGORY_NEUTRAL_PALETTE =
|
||||
"android.theme.customization.neutral_palette";
|
||||
@VisibleForTesting
|
||||
static final String OVERLAY_CATEGORY_FONT = "android.theme.customization.font";
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.systemui.theme;
|
||||
|
||||
import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_ACCENT_COLOR;
|
||||
import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_NEUTRAL_PALETTE;
|
||||
import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_SYSTEM_PALETTE;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
@@ -83,8 +84,9 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
protected static final String TAG = "ThemeOverlayController";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
protected static final int MAIN = 0;
|
||||
protected static final int ACCENT = 1;
|
||||
protected static final int PRIMARY = 0;
|
||||
protected static final int SECONDARY = 1;
|
||||
protected static final int NEUTRAL = 1;
|
||||
|
||||
// If lock screen wallpaper colors should also be considered when selecting the theme.
|
||||
// Doing this has performance impact, given that overlays would need to be swapped when
|
||||
@@ -111,9 +113,11 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
// Accent color extracted from wallpaper, NOT the color used on the overlay
|
||||
protected int mWallpaperAccentColor = Color.TRANSPARENT;
|
||||
// System colors overlay
|
||||
private FabricatedOverlay mSystemOverlay;
|
||||
private FabricatedOverlay mPrimaryOverlay;
|
||||
// Accent colors overlay
|
||||
private FabricatedOverlay mAccentOverlay;
|
||||
private FabricatedOverlay mSecondaryOverlay;
|
||||
// Neutral system colors overlay
|
||||
private FabricatedOverlay mNeutralOverlay;
|
||||
|
||||
@Inject
|
||||
public ThemeOverlayController(Context context, BroadcastDispatcher broadcastDispatcher,
|
||||
@@ -232,12 +236,13 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
mWallpaperAccentColor = accentCandidate;
|
||||
|
||||
if (mIsMonetEnabled) {
|
||||
mSystemOverlay = getOverlay(mMainWallpaperColor, MAIN);
|
||||
mAccentOverlay = getOverlay(mWallpaperAccentColor, ACCENT);
|
||||
mPrimaryOverlay = getOverlay(mMainWallpaperColor, PRIMARY);
|
||||
mSecondaryOverlay = getOverlay(mWallpaperAccentColor, SECONDARY);
|
||||
mNeutralOverlay = getOverlay(mMainWallpaperColor, NEUTRAL);
|
||||
mNeedsOverlayCreation = true;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "fetched overlays. system: " + mSystemOverlay + " accent: "
|
||||
+ mAccentOverlay);
|
||||
Log.d(TAG, "fetched overlays. primary: " + mPrimaryOverlay + " secondary: "
|
||||
+ mSecondaryOverlay + " neutral: " + mNeutralOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +301,9 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
if (mIsMonetEnabled && systemPalette != null && systemPalette.getPackageName() != null) {
|
||||
try {
|
||||
int color = Integer.parseInt(systemPalette.getPackageName().toLowerCase(), 16);
|
||||
mSystemOverlay = getOverlay(color, MAIN);
|
||||
mPrimaryOverlay = getOverlay(color, PRIMARY);
|
||||
// Neutral palette is always derived from primary color.
|
||||
mNeutralOverlay = getOverlay(color, NEUTRAL);
|
||||
mNeedsOverlayCreation = true;
|
||||
categoryToPackage.remove(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -309,7 +316,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
if (mIsMonetEnabled && accentPalette != null && accentPalette.getPackageName() != null) {
|
||||
try {
|
||||
int color = Integer.parseInt(accentPalette.getPackageName().toLowerCase(), 16);
|
||||
mAccentOverlay = getOverlay(color, ACCENT);
|
||||
mSecondaryOverlay = getOverlay(color, SECONDARY);
|
||||
mNeedsOverlayCreation = true;
|
||||
categoryToPackage.remove(OVERLAY_CATEGORY_ACCENT_COLOR);
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -320,12 +327,14 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
// Compatibility with legacy themes, where full packages were defined, instead of just
|
||||
// colors.
|
||||
if (!categoryToPackage.containsKey(OVERLAY_CATEGORY_SYSTEM_PALETTE)
|
||||
&& mSystemOverlay != null) {
|
||||
categoryToPackage.put(OVERLAY_CATEGORY_SYSTEM_PALETTE, mSystemOverlay.getIdentifier());
|
||||
&& mPrimaryOverlay != null) {
|
||||
categoryToPackage.put(OVERLAY_CATEGORY_SYSTEM_PALETTE, mPrimaryOverlay.getIdentifier());
|
||||
categoryToPackage.put(OVERLAY_CATEGORY_NEUTRAL_PALETTE,
|
||||
mNeutralOverlay.getIdentifier());
|
||||
}
|
||||
if (!categoryToPackage.containsKey(OVERLAY_CATEGORY_ACCENT_COLOR)
|
||||
&& mAccentOverlay != null) {
|
||||
categoryToPackage.put(OVERLAY_CATEGORY_ACCENT_COLOR, mAccentOverlay.getIdentifier());
|
||||
&& mSecondaryOverlay != null) {
|
||||
categoryToPackage.put(OVERLAY_CATEGORY_ACCENT_COLOR, mSecondaryOverlay.getIdentifier());
|
||||
}
|
||||
|
||||
Set<UserHandle> userHandles = Sets.newHashSet(UserHandle.of(currentUser));
|
||||
@@ -342,7 +351,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
if (mNeedsOverlayCreation) {
|
||||
mNeedsOverlayCreation = false;
|
||||
mThemeManager.applyCurrentUserOverlays(categoryToPackage, new FabricatedOverlay[] {
|
||||
mSystemOverlay, mAccentOverlay
|
||||
mPrimaryOverlay, mSecondaryOverlay, mNeutralOverlay
|
||||
}, userHandles);
|
||||
} else {
|
||||
mThemeManager.applyCurrentUserOverlays(categoryToPackage, null, userHandles);
|
||||
@@ -356,8 +365,9 @@ public class ThemeOverlayController extends SystemUI implements Dumpable {
|
||||
pw.println("mSystemColors=" + mSystemColors);
|
||||
pw.println("mMainWallpaperColor=" + Integer.toHexString(mMainWallpaperColor));
|
||||
pw.println("mWallpaperAccentColor=" + Integer.toHexString(mWallpaperAccentColor));
|
||||
pw.println("mSystemOverlayColor=" + mSystemOverlay);
|
||||
pw.println("mAccentOverlayColor=" + mAccentOverlay);
|
||||
pw.println("mPrimaryOverlay=" + mPrimaryOverlay);
|
||||
pw.println("mSecondaryOverlay=" + mSecondaryOverlay);
|
||||
pw.println("mNeutralOverlay=" + mNeutralOverlay);
|
||||
pw.println("mIsMonetEnabled=" + mIsMonetEnabled);
|
||||
pw.println("mNeedsOverlayCreation=" + mNeedsOverlayCreation);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.theme;
|
||||
|
||||
import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_ACCENT_COLOR;
|
||||
import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_NEUTRAL_PALETTE;
|
||||
import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_SYSTEM_PALETTE;
|
||||
import static com.android.systemui.theme.ThemeOverlayController.USE_LOCK_SCREEN_WALLPAPER;
|
||||
|
||||
@@ -147,6 +148,8 @@ public class ThemeOverlayControllerTest extends SysuiTestCase {
|
||||
// Assert that we received the colors that we were expecting
|
||||
assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_SYSTEM_PALETTE))
|
||||
.isEqualTo(new OverlayIdentifier("ffff0000"));
|
||||
assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_NEUTRAL_PALETTE))
|
||||
.isEqualTo(new OverlayIdentifier("ffff0000"));
|
||||
assertThat(themeOverlays.getValue().get(OVERLAY_CATEGORY_ACCENT_COLOR))
|
||||
.isEqualTo(new OverlayIdentifier("ff0000ff"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user