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

Commit f0c01d43 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Remove duplicate bouncer blur in dream overlay" into main

parents 08b03fb3 3affd058
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.dreams;

import static com.android.systemui.Flags.FLAG_BOUNCER_UI_REVAMP;

import static kotlinx.coroutines.flow.FlowKt.emptyFlow;
import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;

@@ -32,6 +34,7 @@ import android.app.DreamManager;
import android.content.res.Resources;
import android.graphics.Region;
import android.os.Handler;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.testing.TestableLooper.RunWithLooper;
import android.view.AttachedSurfaceControl;
@@ -231,6 +234,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FLAG_BOUNCER_UI_REVAMP)
    public void testBouncerAnimation_updateBlur() {
        final ArgumentCaptor<PrimaryBouncerExpansionCallback> bouncerExpansionCaptor =
                ArgumentCaptor.forClass(PrimaryBouncerExpansionCallback.class);
@@ -252,6 +256,26 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
        verify(mBlurUtils).applyBlur(mViewRoot, (int) blurRadius, false);
    }

    @Test
    @EnableFlags(FLAG_BOUNCER_UI_REVAMP)
    public void testBouncerAnimation_doesNotBlur_whenBouncerRevampEnabled() {
        final ArgumentCaptor<PrimaryBouncerExpansionCallback> bouncerExpansionCaptor =
                ArgumentCaptor.forClass(PrimaryBouncerExpansionCallback.class);
        mController.onViewAttached();
        verify(mPrimaryBouncerCallbackInteractor).addBouncerExpansionCallback(
                bouncerExpansionCaptor.capture());

        final float blurRadius = 1337f;
        when(mBlurUtils.blurRadiusOfRatio(anyFloat())).thenReturn(blurRadius);

        bouncerExpansionCaptor.getValue().onStartingToShow();
        final float bouncerHideAmount = 0.05f;

        bouncerExpansionCaptor.getValue().onExpansionChanged(bouncerHideAmount);
        verify(mBlurUtils, never()).blurRadiusOfRatio(anyFloat());
        verify(mBlurUtils, never()).applyBlur(eq(mViewRoot), anyInt(), anyBoolean());
    }

    @Test
    public void testStartDreamEntryAnimationsOnAttachedNonLowLight() {
        when(mStateController.isLowLightActive()).thenReturn(false);
+6 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.service.dreams.Flags.dreamHandlesBeingObscured;
import static com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress;
import static com.android.keyguard.BouncerPanelExpansionCalculator.getDreamAlphaScaledExpansion;
import static com.android.keyguard.BouncerPanelExpansionCalculator.getDreamYPositionScaledExpansion;
import static com.android.systemui.Flags.bouncerUiRevamp;
import static com.android.systemui.complication.ComplicationLayoutParams.POSITION_BOTTOM;
import static com.android.systemui.complication.ComplicationLayoutParams.POSITION_TOP;
import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;
@@ -362,10 +363,12 @@ public class DreamOverlayContainerViewController extends
            });
        }

        if (!bouncerUiRevamp()) {
            mBlurUtils.applyBlur(mView.getViewRootImpl(),
                    (int) mBlurUtils.blurRadiusOfRatio(
                            1 - aboutToShowBouncerProgress(bouncerHideAmount)), false);
        }
    }

    private static float getAlpha(int position, float expansion) {
        return Interpolators.LINEAR_OUT_SLOW_IN.getInterpolation(