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

Commit f8d80c9c authored by Evan Laird's avatar Evan Laird
Browse files

[shade] use black and white instead of onSurface for colors

onSurface doesn't have enough contrast to be visible in all cases.

Test: manual
Test: ShadeHeaderScreenshotTest
Bug: 421970953
Flag: com.android.systemui.shade_header_blur_font_color
Change-Id: I177b174a5e26a2b472884fe7004c9d960889c0e8
parent 2a8cf295
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@
    <!-- The dark background color behind the shade -->
    <color name="shade_scrim_background_dark">@androidprv:color/system_under_surface_dark</color>

    <!-- The main FG tint for shade header items -->
    <!-- Only applicable when com.android.systemui.shade_header_blur_font_color is enabled -->
    <color name="shade_header_text_color" android:featureFlag="com.android.systemui.shade_header_blur_font_color">#FFFFFFFF</color>
    <color name="shade_header_text_color_bg" android:featureFlag="com.android.systemui.shade_header_blur_font_color">#FF000000</color>

    <!-- The color of the legacy notifications with customs backgrounds (gingerbread and lollipop.)
    It's fine to override this color since at that point the shade was dark. -->
    <color name="notification_legacy_background_color">@color/GM2_grey_900</color>
+4 −1
Original line number Diff line number Diff line
@@ -24,7 +24,10 @@
    <color name="qs_tile_divider">#29ffffff</color><!-- 16% white -->
    <color name="qs_detail_button_white">#B3FFFFFF</color><!-- 70% white -->
    <color name="status_bar_clock_color">#FFFFFFFF</color>
    <color name="shade_header_text_color">#FFFFFFFF</color>
    <!-- The main FG tint for shade header items -->
    <color name="shade_header_text_color">#FF000000</color>
    <!-- The main BG tint for shade header items -->
    <color name="shade_header_text_color_bg">#FFFFFFFF</color>
    <color name="qs_tile_disabled_color">#9E9E9E</color> <!-- 38% black -->
    <color name="status_bar_icons_hover_color_light">#38FFFFFF</color> <!-- 22% white -->
    <color name="status_bar_icons_hover_color_dark">#38000000</color> <!-- 22% black -->
+1 −2
Original line number Diff line number Diff line
@@ -184,8 +184,7 @@
    <style name="TextAppearance.QS.Status">
        <item name="android:fontFamily" android:featureFlag="!com.android.systemui.shade_header_font_update">@*android:string/config_headlineFontFamily</item>
        <item name="android:fontFamily" android:featureFlag="com.android.systemui.shade_header_font_update">variable-body-medium-emphasized</item>
        <item name="android:textColor" android:featureFlag="!com.android.systemui.shade_header_blur_font_color">@color/shade_header_text_color</item>
        <item name="android:textColor" android:featureFlag="com.android.systemui.shade_header_blur_font_color">@androidprv:color/materialColorOnSurface</item>
        <item name="android:textColor">@color/shade_header_text_color</item>
        <item name="android:textSize">14sp</item>
        <item name="android:letterSpacing">0.01</item>
    </style>
+6 −4
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.widget.TextView
import androidx.annotation.VisibleForTesting
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -150,10 +149,12 @@ constructor(
    companion object {
        /** IDs for transitions and constraints for the [MotionLayout]. */
        @VisibleForTesting internal val HEADER_TRANSITION_ID = R.id.header_transition

        @VisibleForTesting
        internal val LARGE_SCREEN_HEADER_TRANSITION_ID = R.id.large_screen_header_transition
        @VisibleForTesting internal val QQS_HEADER_CONSTRAINT = R.id.qqs_header_constraint
        @VisibleForTesting internal val QS_HEADER_CONSTRAINT = R.id.qs_header_constraint

        @VisibleForTesting
        internal val LARGE_SCREEN_HEADER_CONSTRAINT = R.id.large_screen_header_constraint

@@ -410,14 +411,14 @@ constructor(

    private fun getBgColor() =
        if (notificationShadeBlur()) {
            header.context.getColor(com.android.internal.R.color.materialColorSurfaceDim)
            header.context.getColor(R.color.shade_header_text_color_bg)
        } else {
            android.graphics.Color.BLACK
        }

    private fun getFgColor() =
        if (notificationShadeBlur()) {
            header.context.getColor(com.android.internal.R.color.materialColorOnSurface)
            header.context.getColor(R.color.shade_header_text_color)
        } else {
            android.graphics.Color.WHITE
        }
@@ -453,7 +454,8 @@ constructor(
                            viewModelFactory = unifiedBatteryViewModelFactory,
                            isDarkProvider = { IsAreaDark { dark } },
                            textColor =
                                if (notificationShadeBlur()) MaterialTheme.colorScheme.onSurface
                                if (notificationShadeBlur())
                                    Color(context.getColor(R.color.shade_header_text_color))
                                else Color.White,
                            showEstimate = showBatteryEstimate,
                        )
+2 −2
Original line number Diff line number Diff line
@@ -305,8 +305,8 @@ class ShadeHeaderControllerTest : SysuiTestCase() {

        verify(clock).setTextAppearance(R.style.TextAppearance_QS_Status)
        verify(date).setTextAppearance(R.style.TextAppearance_QS_Status)
        val fgColor = context.getColor(com.android.internal.R.color.materialColorOnSurface)
        val bgColor = context.getColor(com.android.internal.R.color.materialColorSurfaceDim)
        val fgColor = context.getColor(R.color.shade_header_text_color)
        val bgColor = context.getColor(R.color.shade_header_text_color_bg)
        verify(carrierGroup)
            .updateTextAppearanceAndTint(R.style.TextAppearance_QS_Status, fgColor, bgColor)
    }