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

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

Merge "Clean up com.android.systemui.spatial_model_pushback_in_shader flag" into main

parents b63b9a0c 84f47bf6
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -26,13 +26,6 @@ import com.android.wm.shell.shared.annotations.ExternalThread;
@ExternalThread
public interface AppZoomOut {

    /**
     * Called when the zoom out progress is updated, which is used to scale down the current app
     * surface from fullscreen to the max pushback level we want to apply. {@param progress} ranges
     * between [0,1], 0 when fullscreen, 1 when it's at the max pushback level.
     */
    void setProgress(float progress);

    /**
     * Sets the squeeze effect progress.
     *
+0 −10
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ 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;
@@ -131,11 +130,6 @@ public class AppZoomOutController implements RemoteCallable<AppZoomOutController
        return mImpl;
    }

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

    /**
     * Scales all content on the screen belonging to
@@ -197,10 +191,6 @@ public class AppZoomOutController implements RemoteCallable<AppZoomOutController

    @ExternalThread
    private class AppZoomOutImpl implements AppZoomOut {
        @Override
        public void setProgress(float progress) {
            mMainExecutor.execute(() -> AppZoomOutController.this.setProgress(progress));
        }

        @Override
        public void setTopLevelProgress(float progress, long vsyncId, Handler sysuiMainHandler) {
+1 −53
Original line number Diff line number Diff line
@@ -469,36 +469,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        verify(brightnessSpring).animateTo(eq(0))
    }

    @Test
    @DisableFlags(
        Flags.FLAG_BOUNCER_UI_REVAMP,
        Flags.FLAG_GLANCEABLE_HUB_BLURRED_BACKGROUND,
        Flags.FLAG_SPATIAL_MODEL_APP_PUSHBACK,
        Flags.FLAG_SPATIAL_MODEL_PUSHBACK_IN_SHADER
    )
    fun brightnessMirror_hidesShadeBlur() {
        // Brightness mirror is fully visible
        `when`(brightnessSpring.ratio).thenReturn(1f)
        // And shade is blurred
        notificationShadeDepthController.onPanelExpansionChanged(
            ShadeExpansionChangeEvent(fraction = 1f, expanded = true, tracking = false)
        )
        `when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())

        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        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),
            eq(notificationShadeDepthController.zoomOutAsScale(0f)))
    }

    @Test
    @DisableFlags(Flags.FLAG_BOUNCER_UI_REVAMP, Flags.FLAG_GLANCEABLE_HUB_BLURRED_BACKGROUND)
    @EnableFlags(Flags.FLAG_SPATIAL_MODEL_APP_PUSHBACK, Flags.FLAG_SPATIAL_MODEL_PUSHBACK_IN_SHADER)
    @EnableFlags(Flags.FLAG_SPATIAL_MODEL_APP_PUSHBACK)
    fun brightnessMirror_hidesShadeBlur_withAppPushback() {
        // Brightness mirror is fully visible
        `when`(brightnessSpring.ratio).thenReturn(1f)
@@ -519,35 +492,10 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
        )
    }

    @Test
    @EnableFlags(Flags.FLAG_BOUNCER_UI_REVAMP)
    @DisableFlags(
        Flags.FLAG_SPATIAL_MODEL_APP_PUSHBACK,
        Flags.FLAG_SPATIAL_MODEL_PUSHBACK_IN_SHADER
    )
    fun brightnessMirror_hidesShadeBlur_withWindowBlurFlag() {
        // Brightness mirror is fully visible
        `when`(brightnessSpring.ratio).thenReturn(1f)
        // And shade is blurred
        notificationShadeDepthController.onPanelExpansionChanged(
            ShadeExpansionChangeEvent(fraction = 1f, expanded = true, tracking = false)
        )
        `when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())

        notificationShadeDepthController.updateBlurCallback.doFrame(0)
        verify(notificationShadeWindowController).setBackgroundBlurRadius(eq(0))
        verify(wallpaperController).setNotificationShadeZoom(eq(1f))
        verify(windowRootViewBlurInteractor).requestBlurForShade(
            eq(0),
            eq(notificationShadeDepthController.zoomOutAsScale(1f))
        )
    }

    @Test
    @EnableFlags(
        Flags.FLAG_BOUNCER_UI_REVAMP,
        Flags.FLAG_SPATIAL_MODEL_APP_PUSHBACK,
        Flags.FLAG_SPATIAL_MODEL_PUSHBACK_IN_SHADER
    )
    fun brightnessMirror_hidesShadeBlur_withWindowBlurFlagAndAppPushback() {
        // Brightness mirror is fully visible
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ constructor(
    }

    private fun shouldScaleWithTransaction(): Boolean {
        return Flags.spatialModelPushbackInShader() && Flags.spatialModelAppPushback()
        return Flags.spatialModelAppPushback()
    }

    /**
+5 −24
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import com.android.app.tracing.coroutines.TrackTracer
import com.android.systemui.Dumpable
import com.android.systemui.Flags
import com.android.systemui.Flags.spatialModelAppPushback
import com.android.systemui.Flags.spatialModelPushbackInShader
import com.android.systemui.animation.ShadeInterpolation
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
@@ -282,10 +281,8 @@ constructor(
            shadeRadius = 0f
        }

        if (spatialModelAppPushback() || spatialModelPushbackInShader()) {
        // Brightness slider removes blur
        shadeRadius *= (1 - brightnessMirrorSpring.ratio)
        }

        var blur = shadeRadius.toInt()

@@ -309,13 +306,6 @@ constructor(
            blur = 0
        }

        if (!spatialModelAppPushback() && !spatialModelPushbackInShader()) {
            // Brightness slider removes blur, but doesn't affect zooms. This is the legacy behavior
            // that zoom out is only applied to the wallpaper (no homescreen, app or all apps
            // zoom out). The new behavior is under the same flag when it's on a few lines above.
            blur = (blur * (1f - brightnessMirrorSpring.ratio)).toInt()
        }

        return Pair(blur, zoomOut)
    }

@@ -338,8 +328,7 @@ constructor(

    @VisibleForTesting
    fun zoomOutAsScale(zoomOutProgress: Float): Float =
        if (!spatialModelPushbackInShader()) 1.0f
        else 1.0f - zoomOutProgress * getPushbackScale(isHomeFocused)
        1.0f - zoomOutProgress * getPushbackScale(isHomeFocused)

    private fun getPushbackScale(isHomeFocused: Boolean): Float =
        if (isHomeFocused) PUSHBACK_SCALE_FOR_LAUNCHER else PUSHBACK_SCALE_FOR_APP
@@ -367,13 +356,7 @@ constructor(
    private fun onZoomOutChanged(zoomOutFromShadeRadius: Float) {
        TrackTracer.instantForGroup("shade", "zoom_out", zoomOutFromShadeRadius)
        Log.v(TAG, "onZoomOutChanged $zoomOutFromShadeRadius")
        if (!spatialModelPushbackInShader()) {
            wallpaperController.setNotificationShadeZoom(zoomOutFromShadeRadius)
        }
        if (spatialModelAppPushback()) {
            appZoomOutOptional.ifPresent { appZoomOut ->
                appZoomOut.setProgress(zoomOutFromShadeRadius)
            }
            keyguardInteractor.setZoomOut(zoomOutFromShadeRadius)
        }
    }
@@ -480,10 +463,8 @@ constructor(
        }
        shadeAnimation.setStiffness(SpringForce.STIFFNESS_LOW)
        shadeAnimation.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY)
        if (spatialModelAppPushback() || spatialModelPushbackInShader()) {
        brightnessMirrorSpring.setStiffness(SpringForce.STIFFNESS_LOW)
        brightnessMirrorSpring.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY)
        }
        applicationScope.launch {
            focusedDisplayRepository.globallyFocusedTask.collect { focusedTask ->
                if (focusedTask == null || focusedTask.displayId != DEFAULT_DISPLAY) return@collect
Loading