diff options
| author | 2024-10-08 16:34:00 +0200 | |
|---|---|---|
| committer | 2024-10-09 11:34:23 +0200 | |
| commit | 6d09b190fd0fde5586a9b4862c174279780e975b (patch) | |
| tree | 5ac4dfd604cf9c47901a49c65c8ae29033086691 | |
| parent | 69dae7aa05248146215132e98ba29ee8036b4dcf (diff) | |
Reconcile MaterialTheme.colorScheme and AndroidColorScheme (1/2)
This CL reconcicles MaterialTheme.colorScheme with AndroidColorScheme,
so that the only colors left in AndroidColorScheme are the ones not
already available in MaterialTheme.colorScheme. See
b/370422346#comment2 for details.
This CL also adds a test that ensures that the Material colors match
the associated value coming from attributes (R.attr.materialColorFoo).
Bug: 370422346
Test: atest PlatformThemeTest
Flag: NONE color alignment
Change-Id: Ieef5db28a4b60e9de0d998597ad489c7d5468ebf
22 files changed, 268 insertions, 130 deletions
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/BottomSheet.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/BottomSheet.kt index c48e7e40f77f..8df8a0761181 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/BottomSheet.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/BottomSheet.kt @@ -33,7 +33,6 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import com.android.compose.rememberSystemUiController -import com.android.compose.theme.LocalAndroidColorScheme import androidx.compose.ui.unit.dp import com.android.credentialmanager.common.material.ModalBottomSheetLayout import com.android.credentialmanager.common.material.ModalBottomSheetValue @@ -57,7 +56,7 @@ fun ModalBottomSheet( ) androidx.compose.material3.ModalBottomSheet( onDismissRequest = onDismiss, - containerColor = LocalAndroidColorScheme.current.surfaceBright, + containerColor = MaterialTheme.colorScheme.surfaceBright, sheetState = state, content = { Box( @@ -91,7 +90,7 @@ fun ModalBottomSheet( setBottomSheetSystemBarsColor(sysUiController) } ModalBottomSheetLayout( - sheetBackgroundColor = LocalAndroidColorScheme.current.surfaceBright, + sheetBackgroundColor = MaterialTheme.colorScheme.surfaceBright, modifier = Modifier.background(Color.Transparent), sheetState = state, sheetContent = { sheetContent() }, diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Cards.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Cards.kt index 006a2d9858c4..426fec2c412e 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Cards.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Cards.kt @@ -29,12 +29,12 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import com.android.compose.theme.LocalAndroidColorScheme import com.android.credentialmanager.ui.theme.Shapes /** @@ -54,7 +54,7 @@ fun SheetContainerCard( modifier = modifier.fillMaxWidth().wrapContentHeight(), border = null, colors = CardDefaults.cardColors( - containerColor = LocalAndroidColorScheme.current.surfaceBright, + containerColor = MaterialTheme.colorScheme.surfaceBright, ), ) { if (topAppBar != null) { diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt index 2c3c63bea95f..84078c469892 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt @@ -31,6 +31,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Lock import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SuggestionChip import androidx.compose.material3.SuggestionChipDefaults import androidx.compose.runtime.Composable @@ -52,7 +53,6 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp -import com.android.compose.theme.LocalAndroidColorScheme import com.android.credentialmanager.ui.theme.EntryShape import com.android.credentialmanager.ui.theme.Shapes @@ -172,7 +172,7 @@ fun Entry( // Decorative purpose only. contentDescription = null, modifier = Modifier.size(24.dp), - tint = LocalAndroidColorScheme.current.onSurfaceVariant, + tint = MaterialTheme.colorScheme.onSurfaceVariant, ) } } @@ -186,7 +186,7 @@ fun Entry( Icon( modifier = iconSize, bitmap = iconImageBitmap, - tint = LocalAndroidColorScheme.current.onSurfaceVariant, + tint = MaterialTheme.colorScheme.onSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -210,7 +210,7 @@ fun Entry( Icon( modifier = iconSize, imageVector = iconImageVector, - tint = LocalAndroidColorScheme.current.onSurfaceVariant, + tint = MaterialTheme.colorScheme.onSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -222,7 +222,7 @@ fun Entry( Icon( modifier = iconSize, painter = iconPainter, - tint = LocalAndroidColorScheme.current.onSurfaceVariant, + tint = MaterialTheme.colorScheme.onSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -233,9 +233,9 @@ fun Entry( }, border = null, colors = SuggestionChipDefaults.suggestionChipColors( - containerColor = LocalAndroidColorScheme.current.surfaceContainerHigh, - labelColor = LocalAndroidColorScheme.current.onSurfaceVariant, - iconContentColor = LocalAndroidColorScheme.current.onSurfaceVariant, + containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, + labelColor = MaterialTheme.colorScheme.onSurfaceVariant, + iconContentColor = MaterialTheme.colorScheme.onSurfaceVariant, ), ) } @@ -338,7 +338,7 @@ fun MoreOptionTopAppBar( imageVector = navigationIcon, contentDescription = navigationIconContentDescription, modifier = Modifier.size(24.dp).autoMirrored(), - tint = LocalAndroidColorScheme.current.onSurfaceVariant, + tint = MaterialTheme.colorScheme.onSurfaceVariant, ) } } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt index 342af3b134b0..37268ad42002 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt @@ -21,23 +21,23 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.runtime.Composable +import androidx.compose.material3.MaterialTheme import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import com.android.compose.theme.LocalAndroidColorScheme @Composable fun CredentialListSectionHeader(text: String, isFirstSection: Boolean) { InternalSectionHeader( text = text, - color = LocalAndroidColorScheme.current.onSurfaceVariant, + color = MaterialTheme.colorScheme.onSurfaceVariant, applyTopPadding = !isFirstSection ) } @Composable fun MoreAboutPasskeySectionHeader(text: String) { - InternalSectionHeader(text, LocalAndroidColorScheme.current.onSurface) + InternalSectionHeader(text, MaterialTheme.colorScheme.onSurface) } @Composable diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SystemUiControllerUtils.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SystemUiControllerUtils.kt index b4075f1c4d80..d325ebb32579 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SystemUiControllerUtils.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SystemUiControllerUtils.kt @@ -17,9 +17,9 @@ package com.android.credentialmanager.common.ui import androidx.compose.runtime.Composable +import androidx.compose.material3.MaterialTheme import androidx.compose.ui.graphics.Color import com.android.compose.SystemUiController -import com.android.compose.theme.LocalAndroidColorScheme import com.android.credentialmanager.common.material.ModalBottomSheetDefaults @Composable @@ -34,7 +34,7 @@ fun setBottomSheetSystemBarsColor(sysUiController: SystemUiController) { darkIcons = false ) sysUiController.setNavigationBarColor( - color = LocalAndroidColorScheme.current.surfaceBright, + color = MaterialTheme.colorScheme.surfaceBright, darkIcons = false ) }
\ No newline at end of file diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt index 68c2244f7622..3e999cbde113 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt @@ -26,7 +26,6 @@ import androidx.compose.ui.text.TextLayoutResult import androidx.compose.ui.text.style.Hyphens import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow -import com.android.compose.theme.LocalAndroidColorScheme /** * The headline for a screen. E.g. "Create a passkey for X", "Choose a saved sign-in for X". @@ -38,7 +37,7 @@ fun HeadlineText(text: String, modifier: Modifier = Modifier) { Text( modifier = modifier.wrapContentSize(), text = text, - color = LocalAndroidColorScheme.current.onSurface, + color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center, style = MaterialTheme.typography.headlineSmall.copy(hyphens = Hyphens.Auto), ) @@ -52,7 +51,7 @@ fun BodyMediumText(text: String, modifier: Modifier = Modifier) { Text( modifier = modifier.wrapContentSize(), text = text, - color = LocalAndroidColorScheme.current.onSurfaceVariant, + color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyMedium.copy(hyphens = Hyphens.Auto), ) } @@ -70,7 +69,7 @@ fun BodySmallText( Text( modifier = modifier.wrapContentSize(), text = text, - color = LocalAndroidColorScheme.current.onSurfaceVariant, + color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodySmall.copy(hyphens = Hyphens.Auto), overflow = TextOverflow.Ellipsis, maxLines = if (enforceOneLine) 1 else Int.MAX_VALUE, @@ -86,7 +85,7 @@ fun LargeTitleText(text: String, modifier: Modifier = Modifier) { Text( modifier = modifier.wrapContentSize(), text = text, - color = LocalAndroidColorScheme.current.onSurface, + color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.titleLarge.copy(hyphens = Hyphens.Auto), ) } @@ -104,7 +103,7 @@ fun SmallTitleText( Text( modifier = modifier.wrapContentSize(), text = text, - color = LocalAndroidColorScheme.current.onSurface, + color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.titleSmall.copy(hyphens = Hyphens.Auto), overflow = TextOverflow.Ellipsis, maxLines = if (enforceOneLine) 1 else Int.MAX_VALUE, @@ -160,7 +159,7 @@ fun LargeLabelTextOnSurfaceVariant(text: String, modifier: Modifier = Modifier) modifier = modifier.wrapContentSize(), text = text, textAlign = TextAlign.Center, - color = LocalAndroidColorScheme.current.onSurfaceVariant, + color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.labelLarge.copy(hyphens = Hyphens.Auto), ) } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt b/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt index 4993a1fa0672..d78889151c78 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt @@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material3.Divider +import androidx.compose.material3.MaterialTheme import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.NewReleases import androidx.compose.material.icons.filled.Add @@ -46,7 +47,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.core.graphics.drawable.toBitmap -import com.android.compose.theme.LocalAndroidColorScheme import com.android.credentialmanager.CredentialSelectorViewModel import com.android.credentialmanager.R import com.android.credentialmanager.common.BiometricError @@ -448,7 +448,7 @@ fun CreationSelectionCard( item { Divider( thickness = 1.dp, - color = LocalAndroidColorScheme.current.outlineVariant, + color = MaterialTheme.colorScheme.outlineVariant, modifier = Modifier.padding(vertical = 16.dp) ) } 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 37c37b01fc03..6b3223df9532 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 @@ -16,8 +16,8 @@ package com.android.compose.theme -import android.annotation.ColorInt import android.content.Context +import androidx.annotation.ColorRes import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color import com.android.internal.R @@ -34,62 +34,27 @@ val LocalAndroidColorScheme = /** * The Android color scheme. * - * Important: Use M3 colors from MaterialTheme.colorScheme whenever possible instead. In the future, - * most of the colors in this class will be removed in favor of their M3 counterpart. + * This scheme contains the Material3 colors that are not available on + * [androidx.compose.material3.MaterialTheme]. For other colors (e.g. primary), use + * `MaterialTheme.colorScheme` instead. */ -class AndroidColorScheme(context: Context) { - val onSecondaryFixedVariant = getColor(context, R.attr.materialColorOnSecondaryFixedVariant) - val onTertiaryFixedVariant = getColor(context, R.attr.materialColorOnTertiaryFixedVariant) - val surfaceContainerLowest = getColor(context, R.attr.materialColorSurfaceContainerLowest) - val onPrimaryFixedVariant = getColor(context, R.attr.materialColorOnPrimaryFixedVariant) - val onSecondaryContainer = getColor(context, R.attr.materialColorOnSecondaryContainer) - val onTertiaryContainer = getColor(context, R.attr.materialColorOnTertiaryContainer) - val surfaceContainerLow = getColor(context, R.attr.materialColorSurfaceContainerLow) - val onPrimaryContainer = getColor(context, R.attr.materialColorOnPrimaryContainer) - val secondaryFixedDim = getColor(context, R.attr.materialColorSecondaryFixedDim) - val onErrorContainer = getColor(context, R.attr.materialColorOnErrorContainer) - val onSecondaryFixed = getColor(context, R.attr.materialColorOnSecondaryFixed) - val onSurfaceInverse = getColor(context, R.attr.materialColorOnSurfaceInverse) - val tertiaryFixedDim = getColor(context, R.attr.materialColorTertiaryFixedDim) - val onTertiaryFixed = getColor(context, R.attr.materialColorOnTertiaryFixed) - val primaryFixedDim = getColor(context, R.attr.materialColorPrimaryFixedDim) - val secondaryContainer = getColor(context, R.attr.materialColorSecondaryContainer) - val errorContainer = getColor(context, R.attr.materialColorErrorContainer) - val onPrimaryFixed = getColor(context, R.attr.materialColorOnPrimaryFixed) - val primaryInverse = getColor(context, R.attr.materialColorPrimaryInverse) - val secondaryFixed = getColor(context, R.attr.materialColorSecondaryFixed) - val surfaceInverse = getColor(context, R.attr.materialColorSurfaceInverse) - val surfaceVariant = getColor(context, R.attr.materialColorSurfaceVariant) - val tertiaryContainer = getColor(context, R.attr.materialColorTertiaryContainer) - val tertiaryFixed = getColor(context, R.attr.materialColorTertiaryFixed) - val primaryContainer = getColor(context, R.attr.materialColorPrimaryContainer) - val onBackground = getColor(context, R.attr.materialColorOnBackground) - val primaryFixed = getColor(context, R.attr.materialColorPrimaryFixed) - val onSecondary = getColor(context, R.attr.materialColorOnSecondary) - val onTertiary = getColor(context, R.attr.materialColorOnTertiary) - val surfaceDim = getColor(context, R.attr.materialColorSurfaceDim) - val surfaceBright = getColor(context, R.attr.materialColorSurfaceBright) - val error = getColor(context, R.attr.materialColorError) - val onError = getColor(context, R.attr.materialColorOnError) - val surface = getColor(context, R.attr.materialColorSurface) - val surfaceContainerHigh = getColor(context, R.attr.materialColorSurfaceContainerHigh) - val surfaceContainerHighest = getColor(context, R.attr.materialColorSurfaceContainerHighest) - val onSurfaceVariant = getColor(context, R.attr.materialColorOnSurfaceVariant) - val outline = getColor(context, R.attr.materialColorOutline) - val outlineVariant = getColor(context, R.attr.materialColorOutlineVariant) - val onPrimary = getColor(context, R.attr.materialColorOnPrimary) - val onSurface = getColor(context, R.attr.materialColorOnSurface) - val surfaceContainer = getColor(context, R.attr.materialColorSurfaceContainer) - val primary = getColor(context, R.attr.materialColorPrimary) - val secondary = getColor(context, R.attr.materialColorSecondary) - val tertiary = getColor(context, R.attr.materialColorTertiary) +class AndroidColorScheme(val context: Context) { + val primaryFixed = color(context, R.color.system_primary_fixed) + val primaryFixedDim = color(context, R.color.system_primary_fixed_dim) + val onPrimaryFixed = color(context, R.color.system_on_primary_fixed) + val onPrimaryFixedVariant = color(context, R.color.system_on_primary_fixed_variant) + val secondaryFixed = color(context, R.color.system_secondary_fixed) + val secondaryFixedDim = color(context, R.color.system_secondary_fixed_dim) + val onSecondaryFixed = color(context, R.color.system_on_secondary_fixed) + val onSecondaryFixedVariant = color(context, R.color.system_on_secondary_fixed_variant) + val tertiaryFixed = color(context, R.color.system_tertiary_fixed) + val tertiaryFixedDim = color(context, R.color.system_tertiary_fixed_dim) + val onTertiaryFixed = color(context, R.color.system_on_tertiary_fixed) + val onTertiaryFixedVariant = color(context, R.color.system_on_tertiary_fixed_variant) companion object { - internal fun getColor(context: Context, attr: Int): Color { - val ta = context.obtainStyledAttributes(intArrayOf(attr)) - @ColorInt val color = ta.getColor(0, 0) - ta.recycle() - return Color(color) + internal fun color(context: Context, @ColorRes id: Int): Color { + return Color(context.resources.getColor(id, context.theme)) } } } diff --git a/packages/SystemUI/compose/core/src/com/android/compose/theme/Color.kt b/packages/SystemUI/compose/core/src/com/android/compose/theme/Color.kt index 5dbaff650a93..a499447fc367 100644 --- a/packages/SystemUI/compose/core/src/com/android/compose/theme/Color.kt +++ b/packages/SystemUI/compose/core/src/com/android/compose/theme/Color.kt @@ -17,6 +17,8 @@ package com.android.compose.theme import android.annotation.AttrRes +import android.annotation.ColorInt +import android.content.Context import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.ui.graphics.Color @@ -26,5 +28,13 @@ import androidx.compose.ui.platform.LocalContext @Composable @ReadOnlyComposable fun colorAttr(@AttrRes attribute: Int): Color { - return AndroidColorScheme.getColor(LocalContext.current, attribute) + return colorAttr(LocalContext.current, attribute) +} + +/** Return the [Color] from the given [attribute]. */ +fun colorAttr(context: Context, @AttrRes attr: Int): Color { + val ta = context.obtainStyledAttributes(intArrayOf(attr)) + @ColorInt val color = ta.getColor(0, 0) + ta.recycle() + return Color(color) } diff --git a/packages/SystemUI/compose/core/src/com/android/compose/theme/PlatformTheme.kt b/packages/SystemUI/compose/core/src/com/android/compose/theme/PlatformTheme.kt index 06618704e085..d31d7aa59489 100644 --- a/packages/SystemUI/compose/core/src/com/android/compose/theme/PlatformTheme.kt +++ b/packages/SystemUI/compose/core/src/com/android/compose/theme/PlatformTheme.kt @@ -16,7 +16,9 @@ package com.android.compose.theme +import android.content.Context import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.ColorScheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme @@ -24,6 +26,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext +import com.android.compose.theme.AndroidColorScheme.Companion.color import com.android.compose.theme.typography.TypeScaleTokens import com.android.compose.theme.typography.TypefaceNames import com.android.compose.theme.typography.TypefaceTokens @@ -31,23 +34,15 @@ import com.android.compose.theme.typography.TypographyTokens import com.android.compose.theme.typography.platformTypography import com.android.compose.windowsizeclass.LocalWindowSizeClass import com.android.compose.windowsizeclass.calculateWindowSizeClass +import com.android.internal.R /** The Material 3 theme that should wrap all Platform Composables. */ @Composable -fun PlatformTheme( - isDarkTheme: Boolean = isSystemInDarkTheme(), - content: @Composable () -> Unit, -) { +fun PlatformTheme(isDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { val context = LocalContext.current - // TODO(b/230605885): Define our color scheme. - val colorScheme = - if (isDarkTheme) { - dynamicDarkColorScheme(context) - } else { - dynamicLightColorScheme(context) - } - val androidColorScheme = AndroidColorScheme(context) + val colorScheme = remember(context, isDarkTheme) { platformColorScheme(isDarkTheme, context) } + val androidColorScheme = remember(context) { AndroidColorScheme(context) } val typefaceNames = remember(context) { TypefaceNames.get(context) } val typography = remember(typefaceNames) { @@ -55,12 +50,31 @@ fun PlatformTheme( } val windowSizeClass = calculateWindowSizeClass() - MaterialTheme(colorScheme, typography = typography) { + MaterialTheme(colorScheme = colorScheme, typography = typography) { CompositionLocalProvider( LocalAndroidColorScheme provides androidColorScheme, LocalWindowSizeClass provides windowSizeClass, - ) { - content() - } + content = content, + ) + } +} + +private fun platformColorScheme(isDarkTheme: Boolean, context: Context): ColorScheme { + return if (isDarkTheme) { + dynamicDarkColorScheme(context) + .copy( + error = color(context, R.color.system_error_dark), + onError = color(context, R.color.system_on_error_dark), + errorContainer = color(context, R.color.system_error_container_dark), + onErrorContainer = color(context, R.color.system_on_error_container_dark), + ) + } else { + dynamicLightColorScheme(context) + .copy( + error = color(context, R.color.system_error_light), + onError = color(context, R.color.system_on_error_light), + errorContainer = color(context, R.color.system_error_container_light), + onErrorContainer = color(context, R.color.system_on_error_container_light), + ) } } diff --git a/packages/SystemUI/compose/core/tests/Android.bp b/packages/SystemUI/compose/core/tests/Android.bp index 6e7a1425ef90..6a824d8d30f0 100644 --- a/packages/SystemUI/compose/core/tests/Android.bp +++ b/packages/SystemUI/compose/core/tests/Android.bp @@ -27,7 +27,6 @@ android_test { name: "PlatformComposeCoreTests", manifest: "AndroidManifest.xml", test_suites: ["device-tests"], - sdk_version: "current", certificate: "platform", srcs: [ diff --git a/packages/SystemUI/compose/core/tests/AndroidManifest.xml b/packages/SystemUI/compose/core/tests/AndroidManifest.xml index 1016340a7171..28f80d4af265 100644 --- a/packages/SystemUI/compose/core/tests/AndroidManifest.xml +++ b/packages/SystemUI/compose/core/tests/AndroidManifest.xml @@ -19,6 +19,11 @@ <application> <uses-library android:name="android.test.runner" /> + + <activity + android:name="androidx.activity.ComponentActivity" + android:theme="@android:style/Theme.DeviceDefault.DayNight" + android:exported="true" /> </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" diff --git a/packages/SystemUI/compose/core/tests/src/com/android/compose/theme/PlatformThemeTest.kt b/packages/SystemUI/compose/core/tests/src/com/android/compose/theme/PlatformThemeTest.kt index 23538e3fb702..de021a0677cf 100644 --- a/packages/SystemUI/compose/core/tests/src/com/android/compose/theme/PlatformThemeTest.kt +++ b/packages/SystemUI/compose/core/tests/src/com/android/compose/theme/PlatformThemeTest.kt @@ -16,11 +16,21 @@ package com.android.compose.theme +import android.content.Context +import androidx.annotation.AttrRes +import androidx.compose.material3.ColorScheme +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.android.internal.R +import com.google.common.truth.Truth.assertThat +import com.google.common.truth.Truth.assertWithMessage import org.junit.Assert.assertThrows import org.junit.Rule import org.junit.Test @@ -54,4 +64,145 @@ class PlatformThemeTest { } } } + + @Test + fun testMaterialColorsMatchAttributeValue() { + val colorValues = mutableListOf<ColorValue>() + + fun onLaunch(colorScheme: ColorScheme, context: Context) { + fun addValue(name: String, materialValue: Color, @AttrRes attr: Int) { + colorValues.add(ColorValue(name, materialValue, colorAttr(context, attr))) + } + + addValue("primary", colorScheme.primary, R.attr.materialColorPrimary) + addValue("onPrimary", colorScheme.onPrimary, R.attr.materialColorOnPrimary) + addValue( + "primaryContainer", + colorScheme.primaryContainer, + R.attr.materialColorPrimaryContainer, + ) + addValue( + "onPrimaryContainer", + colorScheme.onPrimaryContainer, + R.attr.materialColorOnPrimaryContainer, + ) + addValue( + "inversePrimary", + colorScheme.inversePrimary, + R.attr.materialColorPrimaryInverse, + ) + addValue("secondary", colorScheme.secondary, R.attr.materialColorSecondary) + addValue("onSecondary", colorScheme.onSecondary, R.attr.materialColorOnSecondary) + addValue( + "secondaryContainer", + colorScheme.secondaryContainer, + R.attr.materialColorSecondaryContainer, + ) + addValue( + "onSecondaryContainer", + colorScheme.onSecondaryContainer, + R.attr.materialColorOnSecondaryContainer, + ) + addValue("tertiary", colorScheme.tertiary, R.attr.materialColorTertiary) + addValue("onTertiary", colorScheme.onTertiary, R.attr.materialColorOnTertiary) + addValue( + "tertiaryContainer", + colorScheme.tertiaryContainer, + R.attr.materialColorTertiaryContainer, + ) + addValue( + "onTertiaryContainer", + colorScheme.onTertiaryContainer, + R.attr.materialColorOnTertiaryContainer, + ) + addValue("onBackground", colorScheme.onBackground, R.attr.materialColorOnBackground) + addValue("surface", colorScheme.surface, R.attr.materialColorSurface) + addValue("onSurface", colorScheme.onSurface, R.attr.materialColorOnSurface) + addValue( + "surfaceVariant", + colorScheme.surfaceVariant, + R.attr.materialColorSurfaceVariant, + ) + addValue( + "onSurfaceVariant", + colorScheme.onSurfaceVariant, + R.attr.materialColorOnSurfaceVariant, + ) + addValue( + "inverseSurface", + colorScheme.inverseSurface, + R.attr.materialColorSurfaceInverse, + ) + addValue( + "inverseOnSurface", + colorScheme.inverseOnSurface, + R.attr.materialColorOnSurfaceInverse, + ) + addValue("error", colorScheme.error, R.attr.materialColorError) + addValue("onError", colorScheme.onError, R.attr.materialColorOnError) + addValue( + "errorContainer", + colorScheme.errorContainer, + R.attr.materialColorErrorContainer, + ) + addValue( + "onErrorContainer", + colorScheme.onErrorContainer, + R.attr.materialColorOnErrorContainer, + ) + addValue("outline", colorScheme.outline, R.attr.materialColorOutline) + addValue( + "outlineVariant", + colorScheme.outlineVariant, + R.attr.materialColorOutlineVariant, + ) + addValue("surfaceBright", colorScheme.surfaceBright, R.attr.materialColorSurfaceBright) + addValue("surfaceDim", colorScheme.surfaceDim, R.attr.materialColorSurfaceDim) + addValue( + "surfaceContainer", + colorScheme.surfaceContainer, + R.attr.materialColorSurfaceContainer, + ) + addValue( + "surfaceContainerHigh", + colorScheme.surfaceContainerHigh, + R.attr.materialColorSurfaceContainerHigh, + ) + addValue( + "surfaceContainerHighest", + colorScheme.surfaceContainerHighest, + R.attr.materialColorSurfaceContainerHighest, + ) + addValue( + "surfaceContainerLow", + colorScheme.surfaceContainerLow, + R.attr.materialColorSurfaceContainerLow, + ) + addValue( + "surfaceContainerLowest", + colorScheme.surfaceContainerLowest, + R.attr.materialColorSurfaceContainerLowest, + ) + } + + composeRule.setContent { + PlatformTheme { + val colorScheme = MaterialTheme.colorScheme + val context = LocalContext.current + + LaunchedEffect(Unit) { onLaunch(colorScheme, context) } + } + } + + assertThat(colorValues).hasSize(33) + colorValues.forEach { colorValue -> + assertWithMessage( + "MaterialTheme.colorScheme.${colorValue.name} matches attribute color" + ) + .that(colorValue.materialValue) + .isEqualTo(colorValue.attrValue) + } + } + + private data class ColorValue(val name: String, val materialValue: Color, val attrValue: Color) } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt index 557257d6bdc0..f2db4608a04c 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt @@ -13,6 +13,7 @@ import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue @@ -44,8 +45,6 @@ import com.android.compose.animation.scene.Swipe import com.android.compose.animation.scene.SwipeDirection import com.android.compose.animation.scene.observableTransitionState import com.android.compose.animation.scene.transitions -import com.android.compose.theme.LocalAndroidColorScheme -import com.android.internal.R.attr.focusable import com.android.systemui.communal.shared.model.CommunalBackgroundType import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.communal.shared.model.CommunalTransitionKeys @@ -271,7 +270,7 @@ private fun BoxScope.DefaultBackground( /** Experimental hub background, static linear gradient */ @Composable private fun BoxScope.StaticLinearGradient() { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Box( Modifier.matchParentSize() .background( @@ -284,7 +283,7 @@ private fun BoxScope.StaticLinearGradient() { /** Experimental hub background, animated linear gradient */ @Composable private fun BoxScope.AnimatedLinearGradient() { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Box( Modifier.matchParentSize() .background(colors.primary) diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContent.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContent.kt index 6fca1785d768..9392b1afffa3 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContent.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContent.kt @@ -19,12 +19,12 @@ package com.android.systemui.communal.ui.compose import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.IntRect import com.android.compose.animation.scene.SceneScope -import com.android.compose.theme.LocalAndroidColorScheme import com.android.systemui.communal.smartspace.SmartspaceInteractionHandler import com.android.systemui.communal.ui.compose.section.AmbientStatusBarSection import com.android.systemui.communal.ui.compose.section.CommunalPopupSection @@ -71,7 +71,7 @@ constructor( } with(lockSection) { LockIcon( - overrideColor = LocalAndroidColorScheme.current.onPrimaryContainer, + overrideColor = MaterialTheme.colorScheme.onPrimaryContainer, modifier = Modifier.element(Communal.Elements.LockIcon) ) } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt index bcd333710497..a56dd06ce89e 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt @@ -160,7 +160,6 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.window.layout.WindowMetricsCalculator import com.android.compose.animation.Easings.Emphasized import com.android.compose.modifiers.thenIf -import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.internal.R.dimen.system_app_widget_background_radius import com.android.systemui.Flags @@ -470,7 +469,7 @@ fun CommunalHub( if (showBottomSheet) { val scope = rememberCoroutineScope() val sheetState = rememberModalBottomSheetState() - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme ModalBottomSheet( onDismissRequest = viewModel::onDisclaimerDismissed, @@ -498,7 +497,7 @@ val hubDimensions: Dimensions @Composable private fun DisclaimerBottomSheetContent(onButtonClicked: () -> Unit) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Column( modifier = Modifier.fillMaxWidth().padding(horizontal = 32.dp, vertical = 24.dp), @@ -762,7 +761,7 @@ private fun BoxScope.CommunalHubLazyGrid( */ @Composable private fun EmptyStateCta(contentPadding: PaddingValues, viewModel: BaseCommunalViewModel) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Card( modifier = Modifier.height(hubDimensions.GridHeight).padding(contentPadding), colors = CardDefaults.cardColors(containerColor = Color.Transparent), @@ -908,7 +907,7 @@ private fun ToolbarButton( modifier: Modifier = Modifier, content: @Composable RowScope.() -> Unit, ) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme AnimatedVisibility( visible = isPrimary, modifier = modifier, @@ -955,7 +954,7 @@ private fun ToolbarButton( @Composable private fun filledButtonColors(): ButtonColors { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme return ButtonDefaults.buttonColors( containerColor = colors.primary, contentColor = colors.onPrimary, @@ -1003,7 +1002,7 @@ private fun CommunalContent( /** Creates an empty card used to highlight a particular spot on the grid. */ @Composable fun HighlightedItem(modifier: Modifier = Modifier, alpha: Float = 1.0f) { - val brush = SolidColor(LocalAndroidColorScheme.current.primary) + val brush = SolidColor(MaterialTheme.colorScheme.primary) Box( modifier = // drawBehind lets us draw outside the bounds of the widgets so that we don't need to @@ -1030,7 +1029,7 @@ private fun CtaTileInViewModeContent( viewModel: BaseCommunalViewModel, modifier: Modifier = Modifier, ) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Card( modifier = modifier, colors = @@ -1246,7 +1245,7 @@ fun WidgetConfigureButton( modifier: Modifier = Modifier, widgetConfigurator: WidgetConfigurator, ) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme val scope = rememberCoroutineScope() AnimatedVisibility( diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt index df11206826b8..b2407fa33f70 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/EnableWidgetDialog.kt @@ -41,7 +41,6 @@ import androidx.compose.ui.platform.LocalView import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.android.compose.theme.LocalAndroidColorScheme import com.android.systemui.res.R import com.android.systemui.statusbar.phone.ComponentSystemUIDialog import com.android.systemui.statusbar.phone.SystemUIDialogFactory @@ -93,7 +92,7 @@ private fun DialogComposable( Box( Modifier.fillMaxWidth() .padding(top = 18.dp, bottom = 8.dp) - .background(LocalAndroidColorScheme.current.surfaceBright, RoundedCornerShape(28.dp)) + .background(MaterialTheme.colorScheme.surfaceBright, RoundedCornerShape(28.dp)) ) { Column( modifier = Modifier.fillMaxWidth(), @@ -106,7 +105,7 @@ private fun DialogComposable( Text( text = title, style = MaterialTheme.typography.titleMedium, - color = LocalAndroidColorScheme.current.onSurface, + color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center, maxLines = 1, ) diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResizeableItemFrame.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResizeableItemFrame.kt index fda46b855a65..f6cfb365a821 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResizeableItemFrame.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResizeableItemFrame.kt @@ -28,6 +28,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.grid.LazyGridState +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.snapshotFlow @@ -45,7 +46,6 @@ import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastIsFinite -import com.android.compose.theme.LocalAndroidColorScheme import com.android.systemui.communal.ui.viewmodel.DragHandle import com.android.systemui.communal.ui.viewmodel.ResizeInfo import com.android.systemui.communal.ui.viewmodel.ResizeableItemFrameViewModel @@ -169,7 +169,7 @@ fun ResizableItemFrame( modifier: Modifier = Modifier, enabled: Boolean = true, outlinePadding: Dp = 8.dp, - outlineColor: Color = LocalAndroidColorScheme.current.primary, + outlineColor: Color = MaterialTheme.colorScheme.primary, cornerRadius: Dp = 37.dp, strokeWidth: Dp = 3.dp, alpha: () -> Float = { 1f }, diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalPopupSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalPopupSection.kt index b4c1a2e85daf..868e136dbd85 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalPopupSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalPopupSection.kt @@ -55,7 +55,6 @@ import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Popup import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.android.compose.theme.LocalAndroidColorScheme import com.android.systemui.communal.ui.viewmodel.CommunalViewModel import com.android.systemui.communal.ui.viewmodel.PopupType import com.android.systemui.res.R @@ -112,7 +111,7 @@ constructor( offset = IntOffset(0, 40), onDismissRequest = onDismissRequest, ) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Button( modifier = Modifier.height(56.dp) @@ -182,7 +181,7 @@ constructor( offset = IntOffset(0, 40), onDismissRequest = onDismissRequest ) { - val colors = LocalAndroidColorScheme.current + val colors = MaterialTheme.colorScheme Row( modifier = Modifier.height(56.dp) diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt b/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt index e8da4bd2d2cd..e382e164d2d4 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt @@ -73,7 +73,6 @@ import androidx.lifecycle.repeatOnLifecycle import com.android.compose.animation.Expandable import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.background -import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.theme.colorAttr import com.android.systemui.animation.Expandable import com.android.systemui.common.shared.model.Icon @@ -163,7 +162,7 @@ fun FooterActions( } val backgroundColor = colorAttr(R.attr.underSurface) - val contentColor = LocalAndroidColorScheme.current.onSurface + val contentColor = MaterialTheme.colorScheme.onSurface val backgroundTopRadius = dimensionResource(R.dimen.qs_corner_radius) val backgroundModifier = remember( @@ -344,7 +343,7 @@ private fun NumberButton( @Composable private fun NewChangesDot(modifier: Modifier = Modifier) { val contentDescription = stringResource(R.string.fgs_dot_content_description) - val color = LocalAndroidColorScheme.current.tertiary + val color = MaterialTheme.colorScheme.tertiary Canvas(modifier.size(12.dp).semantics { this.contentDescription = contentDescription }) { drawCircle(color) @@ -363,7 +362,7 @@ private fun TextButton( Expandable( shape = CircleShape, color = colorAttr(R.attr.underSurface), - contentColor = LocalAndroidColorScheme.current.onSurfaceVariant, + contentColor = MaterialTheme.colorScheme.onSurfaceVariant, borderStroke = BorderStroke(1.dp, colorAttr(R.attr.shadeInactive)), modifier = modifier.padding(horizontal = 4.dp), onClick = onClick, diff --git a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt index 13b4aa9b55cb..6228ac5f84ae 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt @@ -32,9 +32,9 @@ import androidx.activity.result.contract.ActivityResultContracts.StartActivityFo import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme import androidx.compose.ui.Modifier import androidx.lifecycle.lifecycleScope -import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.theme.PlatformTheme import com.android.internal.logging.UiEventLogger import com.android.systemui.Flags.communalEditWidgetsActivityFinishFix @@ -227,7 +227,7 @@ constructor( Box( modifier = Modifier.fillMaxSize() - .background(LocalAndroidColorScheme.current.surfaceDim), + .background(MaterialTheme.colorScheme.surfaceDim), ) { CommunalHub( viewModel = communalViewModel, diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt index 411ff8b2b542..bfc5429b59d4 100644 --- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt +++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt @@ -16,6 +16,7 @@ package com.android.systemui.touchpad.tutorial.ui.composable +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import com.airbnb.lottie.compose.rememberLottieDynamicProperties @@ -57,7 +58,7 @@ fun BackGestureTutorialScreen( @Composable private fun rememberScreenColors(): TutorialScreenConfig.Colors { - val onTertiary = LocalAndroidColorScheme.current.onTertiary + val onTertiary = MaterialTheme.colorScheme.onTertiary val onTertiaryFixed = LocalAndroidColorScheme.current.onTertiaryFixed val onTertiaryFixedVariant = LocalAndroidColorScheme.current.onTertiaryFixedVariant val tertiaryFixedDim = LocalAndroidColorScheme.current.tertiaryFixedDim |