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

Commit 480643fb authored by Yein Jo's avatar Yein Jo
Browse files

Add turbulence noise effects after ripple in UMO.

There will be a follow up CL to polish the turbulence noise.
This is a first pass.
Please find the recording in the bug.

Bug: 249536060
Test: TurbulenceNoiseControllerTest, MultiRippleControllerTest, MediaControlPanelTest, ColorSchemeTransitionTest

Change-Id: Iab2e9725e2b9fc6ec2eaa9f7721054458731fd0b
parent 4bfda868
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -53,6 +53,15 @@
        app:layout_constraintTop_toTopOf="@id/album_art"
        app:layout_constraintBottom_toBottomOf="@id/album_art" />

    <com.android.systemui.surfaceeffects.turbulencenoise.TurbulenceNoiseView
        android:id="@+id/turbulence_noise_view"
        android:layout_width="match_parent"
        android:layout_height="@dimen/qs_media_session_height_expanded"
        app:layout_constraintStart_toStartOf="@id/album_art"
        app:layout_constraintEnd_toEndOf="@id/album_art"
        app:layout_constraintTop_toTopOf="@id/album_art"
        app:layout_constraintBottom_toBottomOf="@id/album_art" />

    <!-- Guideline for output switcher -->
    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/center_vertical_guideline"
+10 −0
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@
        app:layout_constraintTop_toTopOf="@+id/album_art"
        app:layout_constraintBottom_toBottomOf="@+id/album_art" />

    <!-- Turbulence noise must have the same constraint as the album art. -->
    <Constraint
        android:id="@+id/turbulence_noise_view"
        android:layout_width="match_parent"
        android:layout_height="@dimen/qs_media_session_height_collapsed"
        app:layout_constraintStart_toStartOf="@+id/album_art"
        app:layout_constraintEnd_toEndOf="@+id/album_art"
        app:layout_constraintTop_toTopOf="@+id/album_art"
        app:layout_constraintBottom_toBottomOf="@+id/album_art" />

    <Constraint
        android:id="@+id/header_title"
        android:layout_width="wrap_content"
+10 −0
Original line number Diff line number Diff line
@@ -37,6 +37,16 @@
        app:layout_constraintTop_toTopOf="@+id/album_art"
        app:layout_constraintBottom_toBottomOf="@+id/album_art" />

    <!-- Turbulence noise must have the same constraint as the album art. -->
    <Constraint
        android:id="@+id/turbulence_noise_view"
        android:layout_width="match_parent"
        android:layout_height="@dimen/qs_media_session_height_expanded"
        app:layout_constraintStart_toStartOf="@+id/album_art"
        app:layout_constraintEnd_toEndOf="@+id/album_art"
        app:layout_constraintTop_toTopOf="@+id/album_art"
        app:layout_constraintBottom_toBottomOf="@+id/album_art" />

    <Constraint
        android:id="@+id/header_title"
        android:layout_width="wrap_content"
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import androidx.constraintlayout.widget.Barrier
import com.android.systemui.R
import com.android.systemui.media.controls.models.GutsViewHolder
import com.android.systemui.surfaceeffects.ripple.MultiRippleView
import com.android.systemui.surfaceeffects.turbulencenoise.TurbulenceNoiseView
import com.android.systemui.util.animation.TransitionLayout

private const val TAG = "MediaViewHolder"
@@ -38,6 +39,8 @@ class MediaViewHolder constructor(itemView: View) {
    // Player information
    val albumView = itemView.requireViewById<ImageView>(R.id.album_art)
    val multiRippleView = itemView.requireViewById<MultiRippleView>(R.id.touch_ripple_view)
    val turbulenceNoiseView =
        itemView.requireViewById<TurbulenceNoiseView>(R.id.turbulence_noise_view)
    val appIcon = itemView.requireViewById<ImageView>(R.id.icon)
    val titleText = itemView.requireViewById<TextView>(R.id.header_title)
    val artistText = itemView.requireViewById<TextView>(R.id.header_artist)
+11 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.settingslib.Utils
import com.android.systemui.media.controls.models.player.MediaViewHolder
import com.android.systemui.monet.ColorScheme
import com.android.systemui.surfaceeffects.ripple.MultiRippleController
import com.android.systemui.surfaceeffects.turbulencenoise.TurbulenceNoiseController

/**
 * A [ColorTransition] is an object that updates the colors of views each time [updateColorScheme]
@@ -102,13 +103,21 @@ internal constructor(
    private val context: Context,
    private val mediaViewHolder: MediaViewHolder,
    private val multiRippleController: MultiRippleController,
    private val turbulenceNoiseController: TurbulenceNoiseController,
    animatingColorTransitionFactory: AnimatingColorTransitionFactory
) {
    constructor(
        context: Context,
        mediaViewHolder: MediaViewHolder,
        multiRippleController: MultiRippleController,
    ) : this(context, mediaViewHolder, multiRippleController, ::AnimatingColorTransition)
        turbulenceNoiseController: TurbulenceNoiseController
    ) : this(
        context,
        mediaViewHolder,
        multiRippleController,
        turbulenceNoiseController,
        ::AnimatingColorTransition
    )

    val bgColor = context.getColor(com.android.systemui.R.color.material_dynamic_secondary95)
    val surfaceColor =
@@ -129,6 +138,7 @@ internal constructor(
            mediaViewHolder.actionPlayPause.backgroundTintList = accentColorList
            mediaViewHolder.gutsViewHolder.setAccentPrimaryColor(accentPrimary)
            multiRippleController.updateColor(accentPrimary)
            turbulenceNoiseController.updateNoiseColor(accentPrimary)
        }

    val accentSecondary =
Loading