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

Commit 8fe8ac09 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Reduce the blur radius of AOD wallpaper blur" into main

parents bdb97099 5242054f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -116,6 +116,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        `when`(blurUtils.blurRadiusOfRatio(anyFloat())).then { answer ->
            answer.arguments[0] as Float * maxBlur.toFloat()
        }
        `when`(blurUtils.blurRadiusOfRatioForAod(anyFloat())).then { answer ->
            answer.arguments[0] as Float * maxBlur.toFloat() / 2
        }
        `when`(blurUtils.ratioOfBlurRadius(anyFloat())).then { answer ->
            answer.arguments[0] as Float / maxBlur.toFloat()
        }
@@ -332,7 +335,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {

        statusBarStateListener.onDozeAmountChanged(1f, 1f)
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false), anyFloat())
        verify(blurUtils).applyBlur(any(), eq((maxBlur / 2f).toInt()), eq(false), anyFloat())
    }

    @Test
+11 −0
Original line number Diff line number Diff line
@@ -82,6 +82,17 @@ constructor(
        return MathUtils.lerp(minBlurRadius, maxBlurRadius, ratio)
    }

    /**
     * Translates a ratio from 0 to 1 to a blur radius in pixels for AOD. We use half of the
     * maxBlurRadius for AOD wallpaper blur.
     */
    fun blurRadiusOfRatioForAod(ratio: Float): Float {
        if (ratio == 0f) {
            return 0f
        }
        return MathUtils.lerp(minBlurRadius, maxBlurRadius / 2, ratio)
    }

    /** Translates a blur radius in pixels to a ratio between 0 to 1. */
    fun ratioOfBlurRadius(blur: Float): Float {
        if (blur == 0f) {
+2 −2
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ constructor(
                        addUpdateListener { animation: ValueAnimator ->
                            wakeAndUnlockBlurData =
                                WakeAndUnlockBlurData(
                                    blurUtils.blurRadiusOfRatio(animation.animatedValue as Float)
                                    blurUtils.blurRadiusOfRatioForAod(animation.animatedValue as Float)
                                )
                        }
                        addListener(
@@ -466,7 +466,7 @@ constructor(
        return if (!wallpaperSupportsAmbientMode) {
            0f
        } else {
            blurUtils.blurRadiusOfRatio(ratio)
            blurUtils.blurRadiusOfRatioForAod(ratio)
        }
    }