Loading packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -1341,16 +1341,6 @@ flag { bug: "379044958" } flag { name: "media_controls_a11y_colors" namespace: "systemui" description: "Color scheme updates for improved a11y" bug: "378848399" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "media_controls_device_manager_background_execution" namespace: "systemui" Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/animation/ColorSchemeTransition.kt +11 −169 Original line number Diff line number Diff line Loading @@ -21,14 +21,10 @@ import android.animation.ValueAnimator import android.animation.ValueAnimator.AnimatorUpdateListener import android.content.Context import android.content.res.ColorStateList import android.content.res.Configuration import android.content.res.Configuration.UI_MODE_NIGHT_YES import android.graphics.drawable.RippleDrawable import com.android.internal.R import com.android.internal.annotations.VisibleForTesting import com.android.media.flags.Flags.enableSuggestedDeviceApi import com.android.settingslib.Utils import com.android.systemui.Flags import com.android.systemui.media.controls.ui.view.MediaViewHolder import com.android.systemui.monet.ColorScheme import com.android.systemui.surfaceeffects.loadingeffect.LoadingEffect Loading Loading @@ -168,183 +164,32 @@ internal constructor( } } // TODO(media_controls_a11y_colors): remove the below color definitions private val bgColor = context.getColor(com.google.android.material.R.color.material_dynamic_neutral20) private val surfaceColor: AnimatingColorTransition by lazy { animatingColorTransitionFactory(bgColor, ::surfaceFromScheme) { surfaceColor -> val colorList = ColorStateList.valueOf(surfaceColor) mediaViewHolder.seamlessIcon.imageTintList = colorList mediaViewHolder.seamlessText.setTextColor(surfaceColor) mediaViewHolder.albumView.backgroundTintList = colorList mediaViewHolder.gutsViewHolder.setSurfaceColor(surfaceColor) } } private val accentPrimary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::accentPrimaryFromScheme, ) { accentPrimary -> val accentColorList = ColorStateList.valueOf(accentPrimary) mediaViewHolder.actionPlayPause.backgroundTintList = accentColorList mediaViewHolder.gutsViewHolder.setAccentPrimaryColor(accentPrimary) multiRippleController.updateColor(accentPrimary) turbulenceNoiseController.updateNoiseColor(accentPrimary) loadingEffect?.updateColor(accentPrimary) } } private val accentSecondary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::accentSecondaryFromScheme, ) { accentSecondary -> val colorList = ColorStateList.valueOf(accentSecondary) (mediaViewHolder.seamlessButton.background as? RippleDrawable)?.let { it.setColor(colorList) it.effectColor = colorList } if (enableSuggestedDeviceApi()) { (mediaViewHolder.deviceSuggestionButton.background as? RippleDrawable)?.let { it.setColor(colorList) it.effectColor = colorList } } } } private val colorSeamlessAndSuggested: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), { colorScheme: ColorScheme -> // A1-100 dark in dark theme, A1-200 in light theme if ( context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES ) colorScheme.accent1.s100 else colorScheme.accent1.s200 }, { seamlessAndSuggestedColor: Int -> val accentColorList = ColorStateList.valueOf(seamlessAndSuggestedColor) mediaViewHolder.seamlessButton.backgroundTintList = accentColorList if (enableSuggestedDeviceApi()) { mediaViewHolder.deviceSuggestionButton.backgroundTintList = accentColorList } }, ) } private val textPrimary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::textPrimaryFromScheme, ) { textPrimary -> mediaViewHolder.titleText.setTextColor(textPrimary) val textColorList = ColorStateList.valueOf(textPrimary) mediaViewHolder.seekBar.thumb.setTintList(textColorList) mediaViewHolder.seekBar.progressTintList = textColorList mediaViewHolder.scrubbingElapsedTimeView.setTextColor(textColorList) mediaViewHolder.scrubbingTotalTimeView.setTextColor(textColorList) for (button in mediaViewHolder.getTransparentActionButtons()) { button.imageTintList = textColorList } mediaViewHolder.gutsViewHolder.setTextPrimaryColor(textPrimary) } } private val textPrimaryInverse: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimaryInverse), ::textPrimaryInverseFromScheme, ) { textPrimaryInverse -> mediaViewHolder.actionPlayPause.imageTintList = ColorStateList.valueOf(textPrimaryInverse) } } private val textSecondary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorSecondary), ::textSecondaryFromScheme, ) { textSecondary -> mediaViewHolder.artistText.setTextColor(textSecondary) } } private val textTertiary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorTertiary), ::textTertiaryFromScheme, ) { textTertiary -> mediaViewHolder.seekBar.progressBackgroundTintList = ColorStateList.valueOf(textTertiary) } } fun getDeviceIconColor(): Int { if (Flags.mediaControlsA11yColors()) { return onPrimaryColor.targetColor } return surfaceColor.targetColor } fun getAppIconColor(): Int { if (Flags.mediaControlsA11yColors()) { return primaryColor.targetColor } return accentPrimary.targetColor } fun getSurfaceEffectColor(): Int { if (Flags.mediaControlsA11yColors()) { return primaryColor.targetColor } return accentPrimary.targetColor } fun getGutsTextColor(): Int { if (Flags.mediaControlsA11yColors()) { return context.getColor(com.android.systemui.res.R.color.media_on_background) } return textPrimary.targetColor } private fun getColorTransitions(): Array<AnimatingColorTransition> { return if (Flags.mediaControlsA11yColors()) { arrayOf(backgroundColor, primaryColor, onPrimaryColor) } else { arrayOf( surfaceColor, colorSeamlessAndSuggested, accentPrimary, accentSecondary, textPrimary, textPrimaryInverse, textSecondary, textTertiary, ) } } private fun loadDefaultColor(id: Int): Int { return Utils.getColorAttr(context, id).defaultColor return arrayOf(backgroundColor, primaryColor, onPrimaryColor) } fun updateColorScheme(colorScheme: ColorScheme?): Boolean { var anyChanged = false getColorTransitions().forEach { val isChanged = it.updateColorScheme(colorScheme) // Ignore changes to colorSeamlessAndSuggested, since that is expected when toggling // dark mode // TODO(media_controls_a11y_colors): remove, not necessary if (it == colorSeamlessAndSuggested) return@forEach anyChanged = isChanged || anyChanged } if (Flags.mediaControlsA11yColors()) { getSurfaceEffectColor().let { multiRippleController.updateColor(it) turbulenceNoiseController.updateNoiseColor(it) Loading @@ -352,9 +197,6 @@ internal constructor( } mediaViewHolder.gutsViewHolder.setTextColor(getGutsTextColor()) colorScheme?.let { mediaViewHolder.gutsViewHolder.setColors(it) } } else { colorScheme?.let { mediaViewHolder.gutsViewHolder.colorScheme = colorScheme } } return anyChanged } } packages/SystemUI/src/com/android/systemui/media/controls/ui/animation/MediaColorSchemes.kt +0 −36 Original line number Diff line number Diff line Loading @@ -18,42 +18,6 @@ package com.android.systemui.media.controls.ui.animation import com.android.systemui.monet.ColorScheme /** Returns the surface color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun surfaceFromScheme(scheme: ColorScheme) = scheme.accent2.s800 // A2-800 /** Returns the primary accent color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun accentPrimaryFromScheme(scheme: ColorScheme) = scheme.accent1.s100 // A1-100 /** Returns the secondary accent color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun accentSecondaryFromScheme(scheme: ColorScheme) = scheme.accent1.s200 // A1-200 /** Returns the primary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textPrimaryFromScheme(scheme: ColorScheme) = scheme.neutral1.s50 // N1-50 /** Returns the inverse of the primary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textPrimaryInverseFromScheme(scheme: ColorScheme) = scheme.neutral1.s900 // N1-900 /** Returns the secondary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textSecondaryFromScheme(scheme: ColorScheme) = scheme.neutral2.s200 // N2-200 /** Returns the tertiary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textTertiaryFromScheme(scheme: ColorScheme) = scheme.neutral2.s400 // N2-400 /** Returns the color for the start of the background gradient based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun backgroundStartFromScheme(scheme: ColorScheme) = scheme.accent2.s700 // A2-700 /** Returns the color for the end of the background gradient based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun backgroundEndFromScheme(scheme: ColorScheme) = scheme.accent1.s700 // A1-700 internal fun backgroundFromScheme(scheme: ColorScheme) = scheme.materialScheme.getOnSurface() internal fun primaryFromScheme(scheme: ColorScheme) = scheme.materialScheme.getPrimaryFixed() Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/binder/MediaControlViewBinder.kt +3 −16 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch import com.android.settingslib.widget.AdaptiveIcon import com.android.systemui.Flags import com.android.systemui.animation.Expandable import com.android.systemui.common.shared.model.Icon import com.android.systemui.dagger.qualifiers.Background Loading @@ -50,9 +49,7 @@ import com.android.systemui.media.controls.ui.view.MediaViewHolder import com.android.systemui.media.controls.ui.viewmodel.MediaActionViewModel import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_END_ALPHA import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_START_ALPHA import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.SEMANTIC_ACTIONS_ALL import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.SEMANTIC_ACTIONS_COMPACT import com.android.systemui.media.controls.ui.viewmodel.MediaOutputSwitcherViewModel Loading Loading @@ -436,7 +433,7 @@ object MediaControlViewBinder { TAG, ) val isArtworkBound = wallpaperColors != null val darkTheme = !Flags.mediaControlsA11yColors() val darkTheme = false val scheme = wallpaperColors?.let { ColorScheme(it, darkTheme, Style.CONTENT) } ?: let { Loading Loading @@ -538,18 +535,8 @@ object MediaControlViewBinder { height: Int, ): LayerDrawable { val albumArt = MediaArtworkHelper.getScaledBackground(context, artworkIcon, width, height) val startAlpha = if (Flags.mediaControlsA11yColors()) { MEDIA_PLAYER_SCRIM_START_ALPHA } else { MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY } val endAlpha = if (Flags.mediaControlsA11yColors()) { MEDIA_PLAYER_SCRIM_END_ALPHA } else { MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY } val startAlpha = MEDIA_PLAYER_SCRIM_START_ALPHA val endAlpha = MEDIA_PLAYER_SCRIM_END_ALPHA return MediaArtworkHelper.setUpGradientColorOnDrawable( albumArt, context.getDrawable(R.drawable.qs_media_scrim)?.mutate() as GradientDrawable, Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaControlPanel.java +6 −26 Original line number Diff line number Diff line Loading @@ -23,9 +23,7 @@ import static com.android.systemui.Flags.communalHub; import static com.android.systemui.Flags.mediaLockscreenLaunchAnimation; import static com.android.systemui.media.controls.domain.pipeline.MediaActionsKt.getNotificationActions; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_END_ALPHA; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_START_ALPHA; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY; import android.animation.Animator; import android.animation.AnimatorInflater; Loading Loading @@ -921,7 +919,7 @@ public class MediaControlPanel { boolean isArtworkBound; Icon artworkIcon = data.getArtwork(); WallpaperColors wallpaperColors = getWallpaperColor(artworkIcon); boolean darkTheme = !Flags.mediaControlsA11yColors(); boolean darkTheme = false; if (wallpaperColors != null) { mutableColorScheme = new ColorScheme(wallpaperColors, darkTheme, Style.CONTENT); artwork = addGradientToPlayerAlbum(artworkIcon, mutableColorScheme, finalWidth, Loading Loading @@ -1036,32 +1034,16 @@ public class MediaControlPanel { Drawable albumArt = getScaledBackground(artworkIcon, width, height); GradientDrawable gradient = (GradientDrawable) mContext.getDrawable( R.drawable.qs_media_scrim).mutate(); if (Flags.mediaControlsA11yColors()) { return setupGradientColorOnDrawable(albumArt, gradient, mutableColorScheme, MEDIA_PLAYER_SCRIM_START_ALPHA, MEDIA_PLAYER_SCRIM_END_ALPHA); } return setupGradientColorOnDrawable(albumArt, gradient, mutableColorScheme, MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY, MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY); } private LayerDrawable setupGradientColorOnDrawable(Drawable albumArt, GradientDrawable gradient, ColorScheme mutableColorScheme, float startAlpha, float endAlpha) { int startColor; int endColor; if (Flags.mediaControlsA11yColors()) { startColor = MediaColorSchemesKt.backgroundFromScheme(mutableColorScheme); endColor = startColor; } else { startColor = MediaColorSchemesKt.backgroundStartFromScheme(mutableColorScheme); endColor = MediaColorSchemesKt.backgroundEndFromScheme(mutableColorScheme); } int color = MediaColorSchemesKt.backgroundFromScheme(mutableColorScheme); gradient.setColors(new int[]{ ColorUtilKt.getColorWithAlpha( startColor, startAlpha), ColorUtilKt.getColorWithAlpha( endColor, endAlpha), ColorUtilKt.getColorWithAlpha(color, startAlpha), ColorUtilKt.getColorWithAlpha(color, endAlpha), }); return new LayerDrawable(new Drawable[]{albumArt, gradient}); } Loading Loading @@ -1271,9 +1253,7 @@ public class MediaControlPanel { int width = targetView.getWidth(); int height = targetView.getHeight(); Random random = new Random(); float luminosity = (Flags.mediaControlsA11yColors()) ? 0.6f : TurbulenceNoiseAnimationConfig.DEFAULT_LUMINOSITY_MULTIPLIER; float luminosity = 0.6f; return new TurbulenceNoiseAnimationConfig( /* gridCount= */ 2.14f, Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -1341,16 +1341,6 @@ flag { bug: "379044958" } flag { name: "media_controls_a11y_colors" namespace: "systemui" description: "Color scheme updates for improved a11y" bug: "378848399" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "media_controls_device_manager_background_execution" namespace: "systemui" Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/animation/ColorSchemeTransition.kt +11 −169 Original line number Diff line number Diff line Loading @@ -21,14 +21,10 @@ import android.animation.ValueAnimator import android.animation.ValueAnimator.AnimatorUpdateListener import android.content.Context import android.content.res.ColorStateList import android.content.res.Configuration import android.content.res.Configuration.UI_MODE_NIGHT_YES import android.graphics.drawable.RippleDrawable import com.android.internal.R import com.android.internal.annotations.VisibleForTesting import com.android.media.flags.Flags.enableSuggestedDeviceApi import com.android.settingslib.Utils import com.android.systemui.Flags import com.android.systemui.media.controls.ui.view.MediaViewHolder import com.android.systemui.monet.ColorScheme import com.android.systemui.surfaceeffects.loadingeffect.LoadingEffect Loading Loading @@ -168,183 +164,32 @@ internal constructor( } } // TODO(media_controls_a11y_colors): remove the below color definitions private val bgColor = context.getColor(com.google.android.material.R.color.material_dynamic_neutral20) private val surfaceColor: AnimatingColorTransition by lazy { animatingColorTransitionFactory(bgColor, ::surfaceFromScheme) { surfaceColor -> val colorList = ColorStateList.valueOf(surfaceColor) mediaViewHolder.seamlessIcon.imageTintList = colorList mediaViewHolder.seamlessText.setTextColor(surfaceColor) mediaViewHolder.albumView.backgroundTintList = colorList mediaViewHolder.gutsViewHolder.setSurfaceColor(surfaceColor) } } private val accentPrimary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::accentPrimaryFromScheme, ) { accentPrimary -> val accentColorList = ColorStateList.valueOf(accentPrimary) mediaViewHolder.actionPlayPause.backgroundTintList = accentColorList mediaViewHolder.gutsViewHolder.setAccentPrimaryColor(accentPrimary) multiRippleController.updateColor(accentPrimary) turbulenceNoiseController.updateNoiseColor(accentPrimary) loadingEffect?.updateColor(accentPrimary) } } private val accentSecondary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::accentSecondaryFromScheme, ) { accentSecondary -> val colorList = ColorStateList.valueOf(accentSecondary) (mediaViewHolder.seamlessButton.background as? RippleDrawable)?.let { it.setColor(colorList) it.effectColor = colorList } if (enableSuggestedDeviceApi()) { (mediaViewHolder.deviceSuggestionButton.background as? RippleDrawable)?.let { it.setColor(colorList) it.effectColor = colorList } } } } private val colorSeamlessAndSuggested: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), { colorScheme: ColorScheme -> // A1-100 dark in dark theme, A1-200 in light theme if ( context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES ) colorScheme.accent1.s100 else colorScheme.accent1.s200 }, { seamlessAndSuggestedColor: Int -> val accentColorList = ColorStateList.valueOf(seamlessAndSuggestedColor) mediaViewHolder.seamlessButton.backgroundTintList = accentColorList if (enableSuggestedDeviceApi()) { mediaViewHolder.deviceSuggestionButton.backgroundTintList = accentColorList } }, ) } private val textPrimary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimary), ::textPrimaryFromScheme, ) { textPrimary -> mediaViewHolder.titleText.setTextColor(textPrimary) val textColorList = ColorStateList.valueOf(textPrimary) mediaViewHolder.seekBar.thumb.setTintList(textColorList) mediaViewHolder.seekBar.progressTintList = textColorList mediaViewHolder.scrubbingElapsedTimeView.setTextColor(textColorList) mediaViewHolder.scrubbingTotalTimeView.setTextColor(textColorList) for (button in mediaViewHolder.getTransparentActionButtons()) { button.imageTintList = textColorList } mediaViewHolder.gutsViewHolder.setTextPrimaryColor(textPrimary) } } private val textPrimaryInverse: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorPrimaryInverse), ::textPrimaryInverseFromScheme, ) { textPrimaryInverse -> mediaViewHolder.actionPlayPause.imageTintList = ColorStateList.valueOf(textPrimaryInverse) } } private val textSecondary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorSecondary), ::textSecondaryFromScheme, ) { textSecondary -> mediaViewHolder.artistText.setTextColor(textSecondary) } } private val textTertiary: AnimatingColorTransition by lazy { animatingColorTransitionFactory( loadDefaultColor(R.attr.textColorTertiary), ::textTertiaryFromScheme, ) { textTertiary -> mediaViewHolder.seekBar.progressBackgroundTintList = ColorStateList.valueOf(textTertiary) } } fun getDeviceIconColor(): Int { if (Flags.mediaControlsA11yColors()) { return onPrimaryColor.targetColor } return surfaceColor.targetColor } fun getAppIconColor(): Int { if (Flags.mediaControlsA11yColors()) { return primaryColor.targetColor } return accentPrimary.targetColor } fun getSurfaceEffectColor(): Int { if (Flags.mediaControlsA11yColors()) { return primaryColor.targetColor } return accentPrimary.targetColor } fun getGutsTextColor(): Int { if (Flags.mediaControlsA11yColors()) { return context.getColor(com.android.systemui.res.R.color.media_on_background) } return textPrimary.targetColor } private fun getColorTransitions(): Array<AnimatingColorTransition> { return if (Flags.mediaControlsA11yColors()) { arrayOf(backgroundColor, primaryColor, onPrimaryColor) } else { arrayOf( surfaceColor, colorSeamlessAndSuggested, accentPrimary, accentSecondary, textPrimary, textPrimaryInverse, textSecondary, textTertiary, ) } } private fun loadDefaultColor(id: Int): Int { return Utils.getColorAttr(context, id).defaultColor return arrayOf(backgroundColor, primaryColor, onPrimaryColor) } fun updateColorScheme(colorScheme: ColorScheme?): Boolean { var anyChanged = false getColorTransitions().forEach { val isChanged = it.updateColorScheme(colorScheme) // Ignore changes to colorSeamlessAndSuggested, since that is expected when toggling // dark mode // TODO(media_controls_a11y_colors): remove, not necessary if (it == colorSeamlessAndSuggested) return@forEach anyChanged = isChanged || anyChanged } if (Flags.mediaControlsA11yColors()) { getSurfaceEffectColor().let { multiRippleController.updateColor(it) turbulenceNoiseController.updateNoiseColor(it) Loading @@ -352,9 +197,6 @@ internal constructor( } mediaViewHolder.gutsViewHolder.setTextColor(getGutsTextColor()) colorScheme?.let { mediaViewHolder.gutsViewHolder.setColors(it) } } else { colorScheme?.let { mediaViewHolder.gutsViewHolder.colorScheme = colorScheme } } return anyChanged } }
packages/SystemUI/src/com/android/systemui/media/controls/ui/animation/MediaColorSchemes.kt +0 −36 Original line number Diff line number Diff line Loading @@ -18,42 +18,6 @@ package com.android.systemui.media.controls.ui.animation import com.android.systemui.monet.ColorScheme /** Returns the surface color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun surfaceFromScheme(scheme: ColorScheme) = scheme.accent2.s800 // A2-800 /** Returns the primary accent color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun accentPrimaryFromScheme(scheme: ColorScheme) = scheme.accent1.s100 // A1-100 /** Returns the secondary accent color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun accentSecondaryFromScheme(scheme: ColorScheme) = scheme.accent1.s200 // A1-200 /** Returns the primary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textPrimaryFromScheme(scheme: ColorScheme) = scheme.neutral1.s50 // N1-50 /** Returns the inverse of the primary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textPrimaryInverseFromScheme(scheme: ColorScheme) = scheme.neutral1.s900 // N1-900 /** Returns the secondary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textSecondaryFromScheme(scheme: ColorScheme) = scheme.neutral2.s200 // N2-200 /** Returns the tertiary text color for media controls based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun textTertiaryFromScheme(scheme: ColorScheme) = scheme.neutral2.s400 // N2-400 /** Returns the color for the start of the background gradient based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun backgroundStartFromScheme(scheme: ColorScheme) = scheme.accent2.s700 // A2-700 /** Returns the color for the end of the background gradient based on the scheme. */ @Deprecated("Remove with media_controls_a11y_colors") internal fun backgroundEndFromScheme(scheme: ColorScheme) = scheme.accent1.s700 // A1-700 internal fun backgroundFromScheme(scheme: ColorScheme) = scheme.materialScheme.getOnSurface() internal fun primaryFromScheme(scheme: ColorScheme) = scheme.materialScheme.getPrimaryFixed() Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/binder/MediaControlViewBinder.kt +3 −16 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch import com.android.settingslib.widget.AdaptiveIcon import com.android.systemui.Flags import com.android.systemui.animation.Expandable import com.android.systemui.common.shared.model.Icon import com.android.systemui.dagger.qualifiers.Background Loading @@ -50,9 +49,7 @@ import com.android.systemui.media.controls.ui.view.MediaViewHolder import com.android.systemui.media.controls.ui.viewmodel.MediaActionViewModel import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_END_ALPHA import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_START_ALPHA import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.SEMANTIC_ACTIONS_ALL import com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.Companion.SEMANTIC_ACTIONS_COMPACT import com.android.systemui.media.controls.ui.viewmodel.MediaOutputSwitcherViewModel Loading Loading @@ -436,7 +433,7 @@ object MediaControlViewBinder { TAG, ) val isArtworkBound = wallpaperColors != null val darkTheme = !Flags.mediaControlsA11yColors() val darkTheme = false val scheme = wallpaperColors?.let { ColorScheme(it, darkTheme, Style.CONTENT) } ?: let { Loading Loading @@ -538,18 +535,8 @@ object MediaControlViewBinder { height: Int, ): LayerDrawable { val albumArt = MediaArtworkHelper.getScaledBackground(context, artworkIcon, width, height) val startAlpha = if (Flags.mediaControlsA11yColors()) { MEDIA_PLAYER_SCRIM_START_ALPHA } else { MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY } val endAlpha = if (Flags.mediaControlsA11yColors()) { MEDIA_PLAYER_SCRIM_END_ALPHA } else { MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY } val startAlpha = MEDIA_PLAYER_SCRIM_START_ALPHA val endAlpha = MEDIA_PLAYER_SCRIM_END_ALPHA return MediaArtworkHelper.setUpGradientColorOnDrawable( albumArt, context.getDrawable(R.drawable.qs_media_scrim)?.mutate() as GradientDrawable, Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaControlPanel.java +6 −26 Original line number Diff line number Diff line Loading @@ -23,9 +23,7 @@ import static com.android.systemui.Flags.communalHub; import static com.android.systemui.Flags.mediaLockscreenLaunchAnimation; import static com.android.systemui.media.controls.domain.pipeline.MediaActionsKt.getNotificationActions; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_END_ALPHA; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_START_ALPHA; import static com.android.systemui.media.controls.ui.viewmodel.MediaControlViewModel.MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY; import android.animation.Animator; import android.animation.AnimatorInflater; Loading Loading @@ -921,7 +919,7 @@ public class MediaControlPanel { boolean isArtworkBound; Icon artworkIcon = data.getArtwork(); WallpaperColors wallpaperColors = getWallpaperColor(artworkIcon); boolean darkTheme = !Flags.mediaControlsA11yColors(); boolean darkTheme = false; if (wallpaperColors != null) { mutableColorScheme = new ColorScheme(wallpaperColors, darkTheme, Style.CONTENT); artwork = addGradientToPlayerAlbum(artworkIcon, mutableColorScheme, finalWidth, Loading Loading @@ -1036,32 +1034,16 @@ public class MediaControlPanel { Drawable albumArt = getScaledBackground(artworkIcon, width, height); GradientDrawable gradient = (GradientDrawable) mContext.getDrawable( R.drawable.qs_media_scrim).mutate(); if (Flags.mediaControlsA11yColors()) { return setupGradientColorOnDrawable(albumArt, gradient, mutableColorScheme, MEDIA_PLAYER_SCRIM_START_ALPHA, MEDIA_PLAYER_SCRIM_END_ALPHA); } return setupGradientColorOnDrawable(albumArt, gradient, mutableColorScheme, MEDIA_PLAYER_SCRIM_START_ALPHA_LEGACY, MEDIA_PLAYER_SCRIM_END_ALPHA_LEGACY); } private LayerDrawable setupGradientColorOnDrawable(Drawable albumArt, GradientDrawable gradient, ColorScheme mutableColorScheme, float startAlpha, float endAlpha) { int startColor; int endColor; if (Flags.mediaControlsA11yColors()) { startColor = MediaColorSchemesKt.backgroundFromScheme(mutableColorScheme); endColor = startColor; } else { startColor = MediaColorSchemesKt.backgroundStartFromScheme(mutableColorScheme); endColor = MediaColorSchemesKt.backgroundEndFromScheme(mutableColorScheme); } int color = MediaColorSchemesKt.backgroundFromScheme(mutableColorScheme); gradient.setColors(new int[]{ ColorUtilKt.getColorWithAlpha( startColor, startAlpha), ColorUtilKt.getColorWithAlpha( endColor, endAlpha), ColorUtilKt.getColorWithAlpha(color, startAlpha), ColorUtilKt.getColorWithAlpha(color, endAlpha), }); return new LayerDrawable(new Drawable[]{albumArt, gradient}); } Loading Loading @@ -1271,9 +1253,7 @@ public class MediaControlPanel { int width = targetView.getWidth(); int height = targetView.getHeight(); Random random = new Random(); float luminosity = (Flags.mediaControlsA11yColors()) ? 0.6f : TurbulenceNoiseAnimationConfig.DEFAULT_LUMINOSITY_MULTIPLIER; float luminosity = 0.6f; return new TurbulenceNoiseAnimationConfig( /* gridCount= */ 2.14f, Loading