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

Commit 72462c0c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "blur-dof-shade" into main

* changes:
  Track change to applyBlur function signature in tests
  Switch Notification Shade zoom to leverage DoF
parents 2ddfb2ea 0a54dff6
Loading
Loading
Loading
Loading
+28 −9
Original line number Diff line number Diff line
@@ -39,11 +39,12 @@ public class SyncRtSurfaceTransactionApplier {
    public static final int FLAG_LAYER = 1 << 3;
    public static final int FLAG_CORNER_RADIUS = 1 << 4;
    public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5;
    public static final int FLAG_VISIBILITY = 1 << 6;
    public static final int FLAG_TRANSACTION = 1 << 7;
    public static final int FLAG_EARLY_WAKEUP_START = 1 << 8;
    public static final int FLAG_EARLY_WAKEUP_END = 1 << 9;
    public static final int FLAG_OPAQUE = 1 << 10;
    public static final int FLAG_BACKGROUND_BLUR_SCALE = 1 << 6;
    public static final int FLAG_VISIBILITY = 1 << 7;
    public static final int FLAG_TRANSACTION = 1 << 8;
    public static final int FLAG_EARLY_WAKEUP_START = 1 << 9;
    public static final int FLAG_EARLY_WAKEUP_END = 1 << 10;
    public static final int FLAG_OPAQUE = 1 << 11;

    private SurfaceControl mTargetSc;
    private final ViewRootImpl mTargetViewRootImpl;
@@ -128,6 +129,9 @@ public class SyncRtSurfaceTransactionApplier {
        if ((params.flags & FLAG_BACKGROUND_BLUR_RADIUS) != 0) {
            t.setBackgroundBlurRadius(params.surface, params.backgroundBlurRadius);
        }
        if ((params.flags & FLAG_BACKGROUND_BLUR_SCALE) != 0) {
            t.setBackgroundBlurScale(params.surface, params.backgroundBlurScale);
        }
        if ((params.flags & FLAG_VISIBILITY) != 0) {
            if (params.visible) {
                t.show(params.surface);
@@ -183,6 +187,7 @@ public class SyncRtSurfaceTransactionApplier {
            float alpha;
            float cornerRadius;
            int backgroundBlurRadius;
            float backgroundBlurScale;
            Matrix matrix;
            Rect windowCrop;
            int layer;
@@ -252,12 +257,22 @@ public class SyncRtSurfaceTransactionApplier {
             * @param radius the Radius for blur to apply to the background surfaces.
             * @return this Builder
             */
            public Builder withBackgroundBlur(int radius) {
            public Builder withBackgroundBlurRadius(int radius) {
                this.backgroundBlurRadius = radius;
                flags |= FLAG_BACKGROUND_BLUR_RADIUS;
                return this;
            }

            /**
             * @param scale the Scale for blur to apply to the background surfaces.
             * @return this Builder
             */
            public Builder withBackgroundBlurScale(float scale) {
                this.backgroundBlurScale = scale;
                flags |= FLAG_BACKGROUND_BLUR_SCALE;
                return this;
            }

            /**
             * @param visible The visibility to apply to the surface.
             * @return this Builder
@@ -315,14 +330,14 @@ public class SyncRtSurfaceTransactionApplier {
             */
            public SurfaceParams build() {
                return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer,
                        cornerRadius, backgroundBlurRadius, visible, mergeTransaction,
                        opaque, earlyWakeupInfo);
                        cornerRadius, backgroundBlurRadius, backgroundBlurScale, visible,
                        mergeTransaction, opaque, earlyWakeupInfo);
            }
        }

        private SurfaceParams(SurfaceControl surface, int params, float alpha, Matrix matrix,
                Rect windowCrop, int layer, float cornerRadius,
                int backgroundBlurRadius, boolean visible,
                int backgroundBlurRadius, float backgroundBlurScale, boolean visible,
                Transaction mergeTransaction, boolean opaque, EarlyWakeupInfo earlyWakeupInfo) {
            this.flags = params;
            this.surface = surface;
@@ -332,6 +347,7 @@ public class SyncRtSurfaceTransactionApplier {
            this.layer = layer;
            this.cornerRadius = cornerRadius;
            this.backgroundBlurRadius = backgroundBlurRadius;
            this.backgroundBlurScale = backgroundBlurScale;
            this.visible = visible;
            this.mergeTransaction = mergeTransaction;
            this.opaque = opaque;
@@ -352,6 +368,9 @@ public class SyncRtSurfaceTransactionApplier {
        @VisibleForTesting
        public final int backgroundBlurRadius;

        @VisibleForTesting
        public final float backgroundBlurScale;

        @VisibleForTesting
        public final Matrix matrix;

+4 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.view.Display.DEFAULT_DISPLAY;

import static com.android.systemui.Flags.spatialModelAppPushback;
import static com.android.systemui.Flags.spatialModelPushbackInShader;
import static com.android.systemui.shared.Flags.enableLppAssistInvocationEffect;

import android.app.ActivityManager;
@@ -127,8 +128,10 @@ public class AppZoomOutController implements RemoteCallable<AppZoomOutController
    }

    public void setProgress(float progress) {
        if (!spatialModelPushbackInShader()) {
            mAppDisplayAreaOrganizer.setProgress(progress);
        }
    }

    /**
     * Scales all content on the screen belonging to
+5 −5
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
                bouncerExpansionCaptor.capture());

        bouncerExpansionCaptor.getValue().onExpansionChanged(0.5f);
        verify(mBlurUtils, never()).applyBlur(eq(mViewRoot), anyInt(), eq(false));
        verify(mBlurUtils, never()).applyBlur(eq(mViewRoot), anyInt(), eq(false), anyFloat());
    }

    @Test
@@ -242,8 +242,8 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
        verify(mPrimaryBouncerCallbackInteractor).addBouncerExpansionCallback(
                bouncerExpansionCaptor.capture());

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

        bouncerExpansionCaptor.getValue().onStartingToShow();

@@ -253,7 +253,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {

        bouncerExpansionCaptor.getValue().onExpansionChanged(bouncerHideAmount);
        verify(mBlurUtils).blurRadiusOfRatio(1 - scaledFraction);
        verify(mBlurUtils).applyBlur(mViewRoot, (int) blurRadius, false);
        verify(mBlurUtils).applyBlur(eq(mViewRoot), eq(blurRadius), eq(false), anyFloat());
    }

    @Test
@@ -273,7 +273,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {

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

    @Test
+16 −16
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
            ShadeExpansionChangeEvent(fraction = 1f, expanded = true, tracking = false)
        )
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false), anyFloat())
    }

    @Test
@@ -311,7 +311,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    fun setFullShadeTransition_appliesBlur() {
        notificationShadeDepthController.transitionToFullShadeProgress = 1f
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false), anyFloat())
    }

    @Test
@@ -320,7 +320,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {

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

    @Test
@@ -329,7 +329,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {

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

    @Test
@@ -346,7 +346,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {

        notificationShadeDepthController.transitionToFullShadeProgress = 1f
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), eq(0), eq(false))
        verify(blurUtils).applyBlur(any(), eq(0), eq(false), anyFloat())
        verify(wallpaperController).setNotificationShadeZoom(eq(1f))
    }

@@ -355,7 +355,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        notificationShadeDepthController.addListener(listener)
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(wallpaperController).setNotificationShadeZoom(anyFloat())
        verify(blurUtils).applyBlur(any(), anyInt(), eq(false))
        verify(blurUtils).applyBlur(any(), anyInt(), eq(false), anyFloat())
    }

    @Test
@@ -391,7 +391,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    fun updateBlurCallback_setsOpaque_whenScrim() {
        scrimVisibilityCaptor.value.accept(ScrimController.OPAQUE)
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), anyInt(), eq(true))
        verify(blurUtils).applyBlur(any(), anyInt(), eq(true), anyFloat())
    }

    @Test
@@ -401,7 +401,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        )
        `when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false), anyFloat())
    }

    @Test
@@ -412,7 +412,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        `when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
        notificationShadeDepthController.blursDisabledForAppLaunch = true
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(blurUtils).applyBlur(any(), eq(0), eq(false))
        verify(blurUtils).applyBlur(any(), eq(0), eq(false), anyFloat())
    }

    @Test
@@ -428,7 +428,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    @EnableFlags(Flags.FLAG_BOUNCER_UI_REVAMP)
    fun ignoreShadeBlurUntilHidden_requestsBlur_windowBlurFlag() {
        notificationShadeDepthController.blursDisabledForAppLaunch = true
        verify(windowRootViewBlurInteractor).requestBlurForShade(anyInt())
        verify(windowRootViewBlurInteractor).requestBlurForShade(anyInt(), anyFloat())
    }

    @Test
@@ -445,7 +445,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {

        // Since we are ignoring blurs for unlock, we should be applying blur = 0 despite setting it
        // to maxBlur above.
        verify(blurUtils).applyBlur(any(), eq(0), eq(false))
        verify(blurUtils).applyBlur(any(), eq(0), eq(false), anyFloat())
    }

    @Test
@@ -462,7 +462,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {

        // Since we are not ignoring blurs for unlock (or app launch), we should apply the blur we
        // returned above (maxBlur).
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
        verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false), anyFloat())
    }

    @Test
@@ -496,7 +496,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        verify(notificationShadeWindowController).setBackgroundBlurRadius(eq(0))
        verify(wallpaperController).setNotificationShadeZoom(eq(1f))
        verify(blurUtils).prepareBlur(any(), eq(0))
        verify(blurUtils).applyBlur(eq(viewRootImpl), eq(0), eq(false))
        verify(blurUtils).applyBlur(eq(viewRootImpl), eq(0), eq(false), anyFloat())
    }

    @Test
@@ -515,7 +515,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        verify(notificationShadeWindowController).setBackgroundBlurRadius(eq(0))
        verify(wallpaperController).setNotificationShadeZoom(eq(0f))
        verify(blurUtils).prepareBlur(any(), eq(0))
        verify(blurUtils).applyBlur(eq(viewRootImpl), eq(0), eq(false))
        verify(blurUtils).applyBlur(eq(viewRootImpl), eq(0), eq(false), anyFloat())
    }

    @Test
@@ -533,7 +533,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(notificationShadeWindowController).setBackgroundBlurRadius(eq(0))
        verify(wallpaperController).setNotificationShadeZoom(eq(1f))
        verify(windowRootViewBlurInteractor).requestBlurForShade(0)
        verify(windowRootViewBlurInteractor).requestBlurForShade(eq(0), eq(1f))
    }

    @Test
@@ -550,7 +550,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(notificationShadeWindowController).setBackgroundBlurRadius(eq(0))
        verify(wallpaperController).setNotificationShadeZoom(eq(0f))
        verify(windowRootViewBlurInteractor).requestBlurForShade(0)
        verify(windowRootViewBlurInteractor).requestBlurForShade(eq(0), eq(1f))
    }

    @Test
+1 −1
Original line number Diff line number Diff line
@@ -40,6 +40,6 @@ class WindowRootViewBlurInteractorTest : SysuiTestCase() {
        testScope.runTest {
            kosmos.fakeKeyguardBouncerRepository.setPrimaryShow(true)

            assertThat(underTest.requestBlurForShade(30)).isFalse()
            assertThat(underTest.requestBlurForShade(30, 1.0f)).isFalse()
        }
}
Loading