From 6110d25881958fd3dd2ee9833663b244f186a18f Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 16 Mar 2021 15:54:26 -0700 Subject: [PATCH] Update system palette APIs UX landed on a format where we have 2 neutral palettes, and 3 accent palettes. It's the ideal format to play with elevation and hue rotation, in order to have a more vibrant and less muddy UI. Fixes: 181986389 Bug: 173553055 Test: atest SystemPalette Test: atest ThemeOverlayControllerTest Test: atest ThemeOverlayApplierTest Test: atest DeviceDefaultThemeTest Change-Id: I80d3f7d1cc92e97efcb40fe6dc9f09918321d273 --- core/api/current.txt | 96 +++++---- .../android/appwidget/AppWidgetHostView.java | 4 +- core/java/android/widget/RemoteViews.java | 8 +- .../values/colors.xml | 96 +++++---- .../values/public.xml | 96 +++++---- ...text_color_primary_device_default_dark.xml | 5 +- ...ext_color_primary_device_default_light.xml | 5 +- ...xt_color_secondary_device_default_dark.xml | 4 +- ...t_color_secondary_device_default_light.xml | 4 +- ...ext_color_tertiary_device_default_dark.xml | 4 +- ...xt_color_tertiary_device_default_light.xml | 4 +- core/res/res/values/colors.xml | 196 ++++++++++++------ .../res/res/values/colors_device_defaults.xml | 22 +- core/res/res/values/public.xml | 101 +++++---- .../systemui/theme/ThemeOverlayApplier.java | 8 +- .../theme/ThemeOverlayController.java | 31 +-- .../theme/ThemeOverlayApplierTest.java | 5 - .../theme/ThemeOverlayControllerTest.java | 3 - 18 files changed, 419 insertions(+), 273 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 481850e5c1384..b38c3512e2819 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -1728,42 +1728,66 @@ 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_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 system_accent1_0 = 17170485; // 0x1060035 + field public static final int system_accent1_100 = 17170487; // 0x1060037 + field public static final int system_accent1_1000 = 17170496; // 0x1060040 + field public static final int system_accent1_200 = 17170488; // 0x1060038 + field public static final int system_accent1_300 = 17170489; // 0x1060039 + field public static final int system_accent1_400 = 17170490; // 0x106003a + field public static final int system_accent1_50 = 17170486; // 0x1060036 + field public static final int system_accent1_500 = 17170491; // 0x106003b + field public static final int system_accent1_600 = 17170492; // 0x106003c + field public static final int system_accent1_700 = 17170493; // 0x106003d + field public static final int system_accent1_800 = 17170494; // 0x106003e + field public static final int system_accent1_900 = 17170495; // 0x106003f + field public static final int system_accent2_0 = 17170497; // 0x1060041 + field public static final int system_accent2_100 = 17170499; // 0x1060043 + field public static final int system_accent2_1000 = 17170508; // 0x106004c + field public static final int system_accent2_200 = 17170500; // 0x1060044 + field public static final int system_accent2_300 = 17170501; // 0x1060045 + field public static final int system_accent2_400 = 17170502; // 0x1060046 + field public static final int system_accent2_50 = 17170498; // 0x1060042 + field public static final int system_accent2_500 = 17170503; // 0x1060047 + field public static final int system_accent2_600 = 17170504; // 0x1060048 + field public static final int system_accent2_700 = 17170505; // 0x1060049 + field public static final int system_accent2_800 = 17170506; // 0x106004a + field public static final int system_accent2_900 = 17170507; // 0x106004b + field public static final int system_accent3_0 = 17170509; // 0x106004d + field public static final int system_accent3_100 = 17170511; // 0x106004f + field public static final int system_accent3_1000 = 17170520; // 0x1060058 + field public static final int system_accent3_200 = 17170512; // 0x1060050 + field public static final int system_accent3_300 = 17170513; // 0x1060051 + field public static final int system_accent3_400 = 17170514; // 0x1060052 + field public static final int system_accent3_50 = 17170510; // 0x106004e + field public static final int system_accent3_500 = 17170515; // 0x1060053 + field public static final int system_accent3_600 = 17170516; // 0x1060054 + field public static final int system_accent3_700 = 17170517; // 0x1060055 + field public static final int system_accent3_800 = 17170518; // 0x1060056 + field public static final int system_accent3_900 = 17170519; // 0x1060057 + field public static final int system_neutral1_0 = 17170461; // 0x106001d + field public static final int system_neutral1_100 = 17170463; // 0x106001f + field public static final int system_neutral1_1000 = 17170472; // 0x1060028 + field public static final int system_neutral1_200 = 17170464; // 0x1060020 + field public static final int system_neutral1_300 = 17170465; // 0x1060021 + field public static final int system_neutral1_400 = 17170466; // 0x1060022 + field public static final int system_neutral1_50 = 17170462; // 0x106001e + field public static final int system_neutral1_500 = 17170467; // 0x1060023 + field public static final int system_neutral1_600 = 17170468; // 0x1060024 + field public static final int system_neutral1_700 = 17170469; // 0x1060025 + field public static final int system_neutral1_800 = 17170470; // 0x1060026 + field public static final int system_neutral1_900 = 17170471; // 0x1060027 + field public static final int system_neutral2_0 = 17170473; // 0x1060029 + field public static final int system_neutral2_100 = 17170475; // 0x106002b + field public static final int system_neutral2_1000 = 17170484; // 0x1060034 + field public static final int system_neutral2_200 = 17170476; // 0x106002c + field public static final int system_neutral2_300 = 17170477; // 0x106002d + field public static final int system_neutral2_400 = 17170478; // 0x106002e + field public static final int system_neutral2_50 = 17170474; // 0x106002a + field public static final int system_neutral2_500 = 17170479; // 0x106002f + field public static final int system_neutral2_600 = 17170480; // 0x1060030 + field public static final int system_neutral2_700 = 17170481; // 0x1060031 + field public static final int system_neutral2_800 = 17170482; // 0x1060032 + field public static final int system_neutral2_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 diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java index 8fd0de7dbb39d..b317f26cb57c1 100644 --- a/core/java/android/appwidget/AppWidgetHostView.java +++ b/core/java/android/appwidget/AppWidgetHostView.java @@ -843,8 +843,8 @@ public class AppWidgetHostView extends FrameLayout { * Calling this method will trigger a full re-inflation of the App Widget. * * The color resources that can be overloaded are the ones whose name is prefixed with - * {@code system_primary_}, {@code system_secondary_} or {@code system_neutral_}, for example - * {@link android.R.color#system_primary_500}. + * {@code system_neutral} or {@code system_accent}, for example + * {@link android.R.color#system_neutral1_500}. */ public void setColorResources(@NonNull SparseIntArray colorMapping) { mColorResources = RemoteViews.ColorResources.create(mContext, colorMapping); diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 2b73923fc5f49..d20109130f2d8 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -5456,14 +5456,14 @@ public class RemoteViews implements Parcelable, Filter { /** * Object allowing the modification of a context to overload the system's dynamic colors. * - * Only colors from {@link android.R.color#system_primary_0} to - * {@link android.R.color#system_neutral_1000} can be overloaded. + * Only colors from {@link android.R.color#system_accent1_0} to + * {@link android.R.color#system_neutral2_1000} can be overloaded. * @hide */ public static final class ColorResources { // Set of valid colors resources. - private static final int FIRST_RESOURCE_COLOR_ID = android.R.color.system_primary_0; - private static final int LAST_RESOURCE_COLOR_ID = android.R.color.system_neutral_1000; + private static final int FIRST_RESOURCE_COLOR_ID = android.R.color.system_neutral1_0; + private static final int LAST_RESOURCE_COLOR_ID = android.R.color.system_accent3_1000; // Size, in bytes, of an entry in the array of colors in an ARSC file. private static final int ARSC_ENTRY_SIZE = 16; diff --git a/core/res/remote_color_resources_res/values/colors.xml b/core/res/remote_color_resources_res/values/colors.xml index 295f16e959e6a..e4bcae43a0e5a 100644 --- a/core/res/remote_color_resources_res/values/colors.xml +++ b/core/res/remote_color_resources_res/values/colors.xml @@ -1,40 +1,64 @@ - #01010101 - #02020202 - #03030303 - #04040404 - #05050505 - #06060606 - #07070707 - #08080808 - #09090909 - #0a0a0a0a - #0b0b0b0b - #0c0c0c0c - #10101010 - #20202020 - #30303030 - #40404040 - #50505050 - #60606060 - #70707070 - #80808080 - #90909090 - #a0a0a0a0 - #b0b0b0b0 - #c0c0c0c0 - #1f1f1f1f - #2f2f2f2f - #3f3f3f3f - #4f4f4f4f - #5f5f5f5f - #6f6f6f6f - #7f7f7f7f - #8f8f8f8f - #9f9f9f9f - #afafafaf - #bfbfbfbf - #cfcfcfcf + #ffffff + #91fff4 + #83f6e5 + #65d9c9 + #45bdae + #1fa293 + #008377 + #006d61 + #005449 + #003c33 + #00271e + #000000 + #ffffff + #91fff4 + #83f6e5 + #65d9c9 + #45bdae + #1fa293 + #008377 + #006d61 + #005449 + #003c33 + #00271e + #000000 + #ffffff + #91fff4 + #83f6e5 + #65d9c9 + #45bdae + #1fa293 + #008377 + #006d61 + #005449 + #003c33 + #00271e + #000000 + #ffffff + #f0f0f0 + #e2e2e2 + #c6c6c6 + #ababab + #909090 + #757575 + #5e5e5e + #464646 + #303030 + #1b1b1b + #000000 + #ffffff + #f0f0f0 + #e2e2e2 + #c6c6c6 + #ababab + #909090 + #757575 + #5e5e5e + #464646 + #303030 + #1b1b1b + #000000 diff --git a/core/res/remote_color_resources_res/values/public.xml b/core/res/remote_color_resources_res/values/public.xml index e628f09b83279..9616628ac6939 100644 --- a/core/res/remote_color_resources_res/values/public.xml +++ b/core/res/remote_color_resources_res/values/public.xml @@ -1,41 +1,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/color/text_color_primary_device_default_dark.xml b/core/res/res/color/text_color_primary_device_default_dark.xml index 90d6b07b24bdb..5926fde42c20f 100644 --- a/core/res/res/color/text_color_primary_device_default_dark.xml +++ b/core/res/res/color/text_color_primary_device_default_dark.xml @@ -17,7 +17,6 @@ - + android:color="@color/system_neutral1_500"/> + diff --git a/core/res/res/color/text_color_primary_device_default_light.xml b/core/res/res/color/text_color_primary_device_default_light.xml index bdc4fa92b2f2f..1379523258de1 100644 --- a/core/res/res/color/text_color_primary_device_default_light.xml +++ b/core/res/res/color/text_color_primary_device_default_light.xml @@ -17,7 +17,6 @@ - + android:color="@color/system_neutral1_400"/> + diff --git a/core/res/res/color/text_color_secondary_device_default_dark.xml b/core/res/res/color/text_color_secondary_device_default_dark.xml index 799636addd4b9..f79fd6242d54b 100644 --- a/core/res/res/color/text_color_secondary_device_default_dark.xml +++ b/core/res/res/color/text_color_secondary_device_default_dark.xml @@ -18,6 +18,6 @@ - + android:color="@color/system_neutral2_200"/> + diff --git a/core/res/res/color/text_color_secondary_device_default_light.xml b/core/res/res/color/text_color_secondary_device_default_light.xml index 4793bb8e03606..c58f565b568b1 100644 --- a/core/res/res/color/text_color_secondary_device_default_light.xml +++ b/core/res/res/color/text_color_secondary_device_default_light.xml @@ -18,6 +18,6 @@ - + android:color="@color/system_neutral2_700"/> + diff --git a/core/res/res/color/text_color_tertiary_device_default_dark.xml b/core/res/res/color/text_color_tertiary_device_default_dark.xml index c82863109e7d5..63fdc81f73f6d 100644 --- a/core/res/res/color/text_color_tertiary_device_default_dark.xml +++ b/core/res/res/color/text_color_tertiary_device_default_dark.xml @@ -18,6 +18,6 @@ - + android:color="@color/system_neutral2_400"/> + diff --git a/core/res/res/color/text_color_tertiary_device_default_light.xml b/core/res/res/color/text_color_tertiary_device_default_light.xml index 82c420ad97fc0..1ad6f6a791d47 100644 --- a/core/res/res/color/text_color_tertiary_device_default_light.xml +++ b/core/res/res/color/text_color_tertiary_device_default_light.xml @@ -18,6 +18,6 @@ - + android:color="@color/system_neutral2_500"/> + diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 22467e4c14025..91896febc5711 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -244,114 +244,188 @@ #F9AB00 - - #ffffff - - #f2f2f2 - - #e3e3e3 - - #c7c7c7 - - #ababab - - #8f8f8f - - #757575 - - #5e5e5e - - #474747 - - #303030 - - #1f1f1f - - #000000 + #000000 - - #ffffff - - #91fff4 - - #83f6e5 - - #65d9c9 - - #45bdae - - #1fa293 - - #008377 - - #006d61 - - #005449 - - #003c33 - - #00271e - - #000000 + #000000 + + + #ffffff + + #91fff4 + + #83f6e5 + + #65d9c9 + + #45bdae + + #1fa293 + + #008377 + + #006d61 + + #005449 + + #003c33 + + #00271e + + #000000 - #ffffff + #ffffff - #f0f0f0 + #f0f0f0 - #e2e2e2 + #e2e2e2 - #c6c6c6 + #c6c6c6 - #ababab + #ababab - #909090 - - #757575 + #757575 - #5e5e5e + #5e5e5e - #464646 + #464646 - #303030 + #303030 - #1b1b1b + #1b1b1b - #000000 + #000000 + + + #ffffff + + #f0f0f0 + + #e2e2e2 + + #c6c6c6 + + #ababab + + #909090 + + #757575 + + #5e5e5e + + #464646 + + #303030 + + #1b1b1b + + #000000 diff --git a/core/res/res/values/colors_device_defaults.xml b/core/res/res/values/colors_device_defaults.xml index 9b5632174e44b..3fbd7caf48751 100644 --- a/core/res/res/values/colors_device_defaults.xml +++ b/core/res/res/values/colors_device_defaults.xml @@ -17,9 +17,9 @@ - @color/system_primary_800 - @color/system_primary_50 - @color/system_primary_800 + @color/system_neutral1_800 + @color/system_neutral1_50 + @color/system_neutral1_800 @color/primary_device_default_light @color/primary_device_default_dark @color/primary_device_default_light @@ -33,14 +33,14 @@ @color/tertiary_material_settings @color/quaternary_material_settings - @color/system_secondary_600 - @color/system_secondary_200 + @color/system_accent1_600 + @color/system_accent1_200 @color/accent_device_default_light - @color/system_primary_800 - @color/system_primary_50 - @color/system_primary_900 - @color/system_primary_100 + @color/system_neutral1_800 + @color/system_neutral1_50 + @color/system_neutral1_900 + @color/system_neutral1_100 @color/text_color_primary_device_default_light @@ -50,8 +50,8 @@ @color/error_color_material_dark @color/error_color_material_light - @color/system_primary_500 - @color/system_primary_400 + @color/system_neutral1_200 + @color/system_neutral1_700 @android:color/white @android:color/white diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 33cc89d2ab6e1..a07646970a85a 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3101,45 +3101,68 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java index bbb2f1a5259a2..278663b270bc2 100644 --- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java +++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java @@ -65,8 +65,6 @@ 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 @@ -94,7 +92,6 @@ public class ThemeOverlayApplier implements Dumpable { */ static final List THEME_CATEGORIES = Lists.newArrayList( OVERLAY_CATEGORY_SYSTEM_PALETTE, - OVERLAY_CATEGORY_NEUTRAL_PALETTE, OVERLAY_CATEGORY_ICON_LAUNCHER, OVERLAY_CATEGORY_SHAPE, OVERLAY_CATEGORY_FONT, @@ -108,7 +105,6 @@ public class ThemeOverlayApplier implements Dumpable { @VisibleForTesting static final Set SYSTEM_USER_CATEGORIES = Sets.newHashSet( OVERLAY_CATEGORY_SYSTEM_PALETTE, - OVERLAY_CATEGORY_NEUTRAL_PALETTE, OVERLAY_CATEGORY_ACCENT_COLOR, OVERLAY_CATEGORY_FONT, OVERLAY_CATEGORY_SHAPE, @@ -131,8 +127,8 @@ public class ThemeOverlayApplier implements Dumpable { mLauncherPackage = launcherPackage; mThemePickerPackage = themePickerPackage; mTargetPackageToCategories.put(ANDROID_PACKAGE, Sets.newHashSet( - OVERLAY_CATEGORY_SYSTEM_PALETTE, OVERLAY_CATEGORY_NEUTRAL_PALETTE, - OVERLAY_CATEGORY_ACCENT_COLOR, OVERLAY_CATEGORY_FONT, OVERLAY_CATEGORY_SHAPE, + OVERLAY_CATEGORY_SYSTEM_PALETTE, OVERLAY_CATEGORY_ACCENT_COLOR, + OVERLAY_CATEGORY_FONT, OVERLAY_CATEGORY_SHAPE, OVERLAY_CATEGORY_ICON_ANDROID)); mTargetPackageToCategories.put(SYSUI_PACKAGE, Sets.newHashSet(OVERLAY_CATEGORY_ICON_SYSUI)); diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java index f19228783b884..d317712ce87cb 100644 --- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java @@ -16,7 +16,6 @@ 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; @@ -82,9 +81,8 @@ 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 PRIMARY = 0; - protected static final int SECONDARY = 1; - protected static final int NEUTRAL = 2; + protected static final int NEUTRAL = 0; + protected static final int ACCENT = 1; private final ThemeOverlayApplier mThemeManager; private final UserManager mUserManager; @@ -103,8 +101,6 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { protected int mMainWallpaperColor = Color.TRANSPARENT; // Accent color extracted from wallpaper, NOT the color used on the overlay protected int mWallpaperAccentColor = Color.TRANSPARENT; - // System colors overlay - private FabricatedOverlay mPrimaryOverlay; // Accent colors overlay private FabricatedOverlay mSecondaryOverlay; // Neutral system colors overlay @@ -205,7 +201,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { mainColor = Color.TRANSPARENT; accentCandidate = Color.TRANSPARENT; } else { - mainColor = getDominantColor(currentColors); + mainColor = getNeutralColor(currentColors); accentCandidate = getAccentColor(currentColors); } @@ -218,13 +214,12 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { mWallpaperAccentColor = accentCandidate; if (mIsMonetEnabled) { - mPrimaryOverlay = getOverlay(mMainWallpaperColor, PRIMARY); - mSecondaryOverlay = getOverlay(mWallpaperAccentColor, SECONDARY); + mSecondaryOverlay = getOverlay(mWallpaperAccentColor, ACCENT); mNeutralOverlay = getOverlay(mMainWallpaperColor, NEUTRAL); mNeedsOverlayCreation = true; if (DEBUG) { - Log.d(TAG, "fetched overlays. primary: " + mPrimaryOverlay + " secondary: " - + mSecondaryOverlay + " neutral: " + mNeutralOverlay); + Log.d(TAG, "fetched overlays. accent: " + mSecondaryOverlay + + " neutral: " + mNeutralOverlay); } } @@ -234,7 +229,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { /** * Return the main theme color from a given {@link WallpaperColors} instance. */ - protected int getDominantColor(@NonNull WallpaperColors wallpaperColors) { + protected int getNeutralColor(@NonNull WallpaperColors wallpaperColors) { return wallpaperColors.getPrimaryColor().toArgb(); } @@ -283,8 +278,6 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { if (mIsMonetEnabled && systemPalette != null && systemPalette.getPackageName() != null) { try { int color = Integer.parseInt(systemPalette.getPackageName().toLowerCase(), 16); - mPrimaryOverlay = getOverlay(color, PRIMARY); - // Neutral palette is always derived from primary color. mNeutralOverlay = getOverlay(color, NEUTRAL); mNeedsOverlayCreation = true; categoryToPackage.remove(OVERLAY_CATEGORY_SYSTEM_PALETTE); @@ -308,7 +301,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { if (mIsMonetEnabled && accentPalette != null && accentPalette.getPackageName() != null) { try { int color = Integer.parseInt(accentPalette.getPackageName().toLowerCase(), 16); - mSecondaryOverlay = getOverlay(color, SECONDARY); + mSecondaryOverlay = getOverlay(color, ACCENT); mNeedsOverlayCreation = true; categoryToPackage.remove(OVERLAY_CATEGORY_ACCENT_COLOR); } catch (NumberFormatException e) { @@ -326,9 +319,8 @@ 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) - && mPrimaryOverlay != null) { - categoryToPackage.put(OVERLAY_CATEGORY_SYSTEM_PALETTE, mPrimaryOverlay.getIdentifier()); - categoryToPackage.put(OVERLAY_CATEGORY_NEUTRAL_PALETTE, + && mNeutralOverlay != null) { + categoryToPackage.put(OVERLAY_CATEGORY_SYSTEM_PALETTE, mNeutralOverlay.getIdentifier()); } if (!categoryToPackage.containsKey(OVERLAY_CATEGORY_ACCENT_COLOR) @@ -350,7 +342,7 @@ public class ThemeOverlayController extends SystemUI implements Dumpable { if (mNeedsOverlayCreation) { mNeedsOverlayCreation = false; mThemeManager.applyCurrentUserOverlays(categoryToPackage, new FabricatedOverlay[] { - mPrimaryOverlay, mSecondaryOverlay, mNeutralOverlay + mSecondaryOverlay, mNeutralOverlay }, currentUser, managedProfiles); } else { mThemeManager.applyCurrentUserOverlays(categoryToPackage, null, currentUser, @@ -363,7 +355,6 @@ 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("mPrimaryOverlay=" + mPrimaryOverlay); pw.println("mSecondaryOverlay=" + mSecondaryOverlay); pw.println("mNeutralOverlay=" + mNeutralOverlay); pw.println("mIsMonetEnabled=" + mIsMonetEnabled); diff --git a/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayApplierTest.java b/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayApplierTest.java index 6067b42e0ef84..eb6fc2e950c91 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayApplierTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayApplierTest.java @@ -23,7 +23,6 @@ import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_IC import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_ICON_SETTINGS; import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_ICON_SYSUI; import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_ICON_THEME_PICKER; -import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_NEUTRAL_PALETTE; import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_SHAPE; import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_CATEGORY_SYSTEM_PALETTE; import static com.android.systemui.theme.ThemeOverlayApplier.SETTINGS_PACKAGE; @@ -116,8 +115,6 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { ANDROID_PACKAGE, OVERLAY_CATEGORY_ACCENT_COLOR, false), createOverlayInfo(TEST_DISABLED_PREFIX + OVERLAY_CATEGORY_SYSTEM_PALETTE, ANDROID_PACKAGE, OVERLAY_CATEGORY_SYSTEM_PALETTE, false), - createOverlayInfo(TEST_DISABLED_PREFIX + OVERLAY_CATEGORY_NEUTRAL_PALETTE, - ANDROID_PACKAGE, OVERLAY_CATEGORY_NEUTRAL_PALETTE, false), createOverlayInfo(TEST_DISABLED_PREFIX + OVERLAY_CATEGORY_FONT, ANDROID_PACKAGE, OVERLAY_CATEGORY_FONT, false), createOverlayInfo(TEST_DISABLED_PREFIX + OVERLAY_CATEGORY_SHAPE, @@ -128,8 +125,6 @@ public class ThemeOverlayApplierTest extends SysuiTestCase { ANDROID_PACKAGE, OVERLAY_CATEGORY_ACCENT_COLOR, true), createOverlayInfo(TEST_ENABLED_PREFIX + OVERLAY_CATEGORY_SYSTEM_PALETTE, ANDROID_PACKAGE, OVERLAY_CATEGORY_SYSTEM_PALETTE, true), - createOverlayInfo(TEST_ENABLED_PREFIX + OVERLAY_CATEGORY_NEUTRAL_PALETTE, - ANDROID_PACKAGE, OVERLAY_CATEGORY_NEUTRAL_PALETTE, true), createOverlayInfo(TEST_ENABLED_PREFIX + OVERLAY_CATEGORY_FONT, ANDROID_PACKAGE, OVERLAY_CATEGORY_FONT, true), createOverlayInfo(TEST_ENABLED_PREFIX + OVERLAY_CATEGORY_SHAPE, diff --git a/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java index 8a0ac1111b590..4e7e0a349aa6f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/theme/ThemeOverlayControllerTest.java @@ -17,7 +17,6 @@ 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.google.common.truth.Truth.assertThat; @@ -147,8 +146,6 @@ 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"));