summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rahul Banerjee <rahulbanerjee@google.com> 2025-02-25 09:03:28 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-25 09:03:28 -0800
commit5e560296368d5a99c80a1a486bd3492c20dc53da (patch)
tree639d3657743e083186a719148d31cd8a9c194c3a
parent48978e4e872e292258aa3f5f3978e933d2ba47ff (diff)
parent149509dcc6126ce23c627502adad04f454ece1de (diff)
Merge "Update SurfaceEffect color tokens to allow use via Compose." into main
-rw-r--r--packages/SystemUI/compose/core/src/com/android/compose/theme/AndroidColorScheme.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/common/shared/colors/SurfaceEffectColors.kt22
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java4
5 files changed, 25 insertions, 13 deletions
diff --git a/packages/SystemUI/compose/core/src/com/android/compose/theme/AndroidColorScheme.kt b/packages/SystemUI/compose/core/src/com/android/compose/theme/AndroidColorScheme.kt
index ed144bd20234..375dadeba3ad 100644
--- a/packages/SystemUI/compose/core/src/com/android/compose/theme/AndroidColorScheme.kt
+++ b/packages/SystemUI/compose/core/src/com/android/compose/theme/AndroidColorScheme.kt
@@ -78,6 +78,10 @@ class AndroidColorScheme(
val underSurface: Color,
val weatherTemp: Color,
val widgetBackground: Color,
+ val surfaceEffect0: Color,
+ val surfaceEffect1: Color,
+ val surfaceEffect2: Color,
+ val surfaceEffect3: Color,
) {
companion object {
internal fun color(context: Context, @ColorRes id: Int): Color {
@@ -123,6 +127,10 @@ class AndroidColorScheme(
underSurface = color(context, R.color.customColorUnderSurface),
weatherTemp = color(context, R.color.customColorWeatherTemp),
widgetBackground = color(context, R.color.customColorWidgetBackground),
+ surfaceEffect0 = color(context, R.color.surface_effect_0),
+ surfaceEffect1 = color(context, R.color.surface_effect_1),
+ surfaceEffect2 = color(context, R.color.surface_effect_2),
+ surfaceEffect3 = color(context, R.color.surface_effect_3),
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/common/shared/colors/SurfaceEffectColors.kt b/packages/SystemUI/src/com/android/systemui/common/shared/colors/SurfaceEffectColors.kt
index 5e8c21f9abf5..4451f07318ef 100644
--- a/packages/SystemUI/src/com/android/systemui/common/shared/colors/SurfaceEffectColors.kt
+++ b/packages/SystemUI/src/com/android/systemui/common/shared/colors/SurfaceEffectColors.kt
@@ -16,23 +16,27 @@
package com.android.systemui.common.shared.colors
-import android.content.res.Resources
+import android.content.Context
object SurfaceEffectColors {
@JvmStatic
- fun surfaceEffect0(r: Resources): Int {
- return r.getColor(com.android.internal.R.color.surface_effect_0)
+ fun surfaceEffect0(context: Context): Int {
+ return context.resources.getColor(
+ com.android.internal.R.color.surface_effect_0, context.theme)
}
@JvmStatic
- fun surfaceEffect1(r: Resources): Int {
- return r.getColor(com.android.internal.R.color.surface_effect_1)
+ fun surfaceEffect1(context: Context): Int {
+ return context.resources.getColor(
+ com.android.internal.R.color.surface_effect_1, context.theme)
}
@JvmStatic
- fun surfaceEffect2(r: Resources): Int {
- return r.getColor(com.android.internal.R.color.surface_effect_2)
+ fun surfaceEffect2(context: Context): Int {
+ return context.resources.getColor(
+ com.android.internal.R.color.surface_effect_2, context.theme)
}
@JvmStatic
- fun surfaceEffect3(r: Resources): Int {
- return r.getColor(com.android.internal.R.color.surface_effect_3)
+ fun surfaceEffect3(context: Context): Int {
+ return context.resources.getColor(
+ com.android.internal.R.color.surface_effect_3, context.theme)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
index 25deec375c03..d09546fe80ca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/view/FooterView.java
@@ -391,7 +391,7 @@ public class FooterView extends StackScrollerDecorView {
if (!notificationFooterBackgroundTintOptimization()) {
if (notificationShadeBlur()) {
Color backgroundColor = Color.valueOf(
- SurfaceEffectColors.surfaceEffect1(getResources()));
+ SurfaceEffectColors.surfaceEffect1(getContext()));
scHigh = ColorUtils.setAlphaComponent(backgroundColor.toArgb(), 0xFF);
// Apply alpha on background drawables.
int backgroundAlpha = (int) (backgroundColor.alpha() * 0xFF);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
index 4ed9dcee072e..a081ad5bb82c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
@@ -129,7 +129,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
private void updateColors() {
if (notificationRowTransparency()) {
- mNormalColor = SurfaceEffectColors.surfaceEffect1(getResources());
+ mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
} else {
mNormalColor = mContext.getColor(
com.android.internal.R.color.materialColorSurfaceContainerHigh);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java
index 33c36d8c4c76..c0bc13270664 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java
@@ -88,7 +88,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
mDarkColoredStatefulColors = getResources().getColorStateList(
R.color.notification_state_color_dark);
if (notificationRowTransparency()) {
- mNormalColor = SurfaceEffectColors.surfaceEffect1(getResources());
+ mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
} else {
mNormalColor = mContext.getColor(
com.android.internal.R.color.materialColorSurfaceContainerHigh);
@@ -321,7 +321,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
new PorterDuffColorFilter(
isColorized()
? ColorUtils.setAlphaComponent(mTintColor, (int) (255 * 0.9f))
- : SurfaceEffectColors.surfaceEffect1(getResources()),
+ : SurfaceEffectColors.surfaceEffect1(getContext()),
PorterDuff.Mode.SRC)); // SRC operator discards the drawable's color+alpha
}