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

Commit a12ef62a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Keep window expanded when blurring it" into rvc-dev am: 60c9fcad

Change-Id: I0b3104ca85bcae5b361b6402ac9634a36cd89400
parents 956f97ea 60c9fcad
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.Interpolators
import com.android.systemui.dump.DumpManager
import com.android.systemui.statusbar.phone.BiometricUnlockController
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK
import com.android.systemui.statusbar.phone.NotificationShadeWindowController
import com.android.systemui.statusbar.phone.PanelExpansionListener
import com.android.systemui.statusbar.policy.KeyguardStateController
import java.io.FileDescriptor
@@ -50,6 +51,7 @@ class NotificationShadeDepthController @Inject constructor(
    private val keyguardStateController: KeyguardStateController,
    private val choreographer: Choreographer,
    private val wallpaperManager: WallpaperManager,
    private val notificationShadeWindowController: NotificationShadeWindowController,
    dumpManager: DumpManager
) : PanelExpansionListener, Dumpable {
    companion object {
@@ -62,7 +64,6 @@ class NotificationShadeDepthController @Inject constructor(
    private var keyguardAnimator: Animator? = null
    private var notificationAnimator: Animator? = null
    private var updateScheduled: Boolean = false
    private var shadeExpansion = 1.0f
    private val shadeSpring = SpringAnimation(this, object :
            FloatPropertyCompat<NotificationShadeDepthController>("shadeBlurRadius") {
        override fun setValue(rect: NotificationShadeDepthController?, value: Float) {
@@ -100,6 +101,7 @@ class NotificationShadeDepthController @Inject constructor(
        val rawZoom = max(blurUtils.ratioOfBlurRadius(blur), globalDialogVisibility)
        wallpaperManager.setWallpaperZoomOut(root.windowToken,
                zoomInterpolator.getInterpolation(rawZoom))
        notificationShadeWindowController.setBackgroundBlurRadius(blur)
    }

    /**
+16 −1
Original line number Diff line number Diff line
@@ -309,7 +309,8 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
        return !state.mForceCollapsed && (state.isKeyguardShowingAndNotOccluded()
                || state.mPanelVisible || state.mKeyguardFadingAway || state.mBouncerShowing
                || state.mHeadsUpShowing || state.mBubblesShowing
                || state.mScrimsVisibility != ScrimController.TRANSPARENT);
                || state.mScrimsVisibility != ScrimController.TRANSPARENT)
                || state.mBackgroundBlurRadius > 0;
    }

    private void applyFitsSystemWindows(State state) {
@@ -478,6 +479,19 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
        apply(mCurrentState);
    }

    /**
     * Current blur level, controller by
     * {@link com.android.systemui.statusbar.NotificationShadeDepthController}.
     * @param backgroundBlurRadius Radius in pixels.
     */
    public void setBackgroundBlurRadius(int backgroundBlurRadius) {
        if (mCurrentState.mBackgroundBlurRadius == backgroundBlurRadius) {
            return;
        }
        mCurrentState.mBackgroundBlurRadius = backgroundBlurRadius;
        apply(mCurrentState);
    }

    public void setHeadsUpShowing(boolean showing) {
        mCurrentState.mHeadsUpShowing = showing;
        apply(mCurrentState);
@@ -665,6 +679,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
        boolean mForcePluginOpen;
        boolean mDozing;
        int mScrimsVisibility;
        int mBackgroundBlurRadius;

        private boolean isKeyguardShowingAndNotOccluded() {
            return mKeyguardShowing && !mKeyguardOccluded;
+11 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -27,6 +28,7 @@ import static org.mockito.Mockito.when;
import android.app.IActivityManager;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.View;
import android.view.WindowManager;

import androidx.test.filters.SmallTest;
@@ -110,4 +112,13 @@ public class NotificationShadeWindowControllerTest extends SysuiTestCase {
    public void testSetForcePluginOpen_beforeStatusBarInitialization() {
        mNotificationShadeWindowController.setForcePluginOpen(true);
    }

    @Test
    public void setBackgroundBlurRadius_expandedWithBlurs() {
        mNotificationShadeWindowController.setBackgroundBlurRadius(10);
        verify(mNotificationShadeWindowView).setVisibility(eq(View.VISIBLE));

        mNotificationShadeWindowController.setBackgroundBlurRadius(0);
        verify(mNotificationShadeWindowView).setVisibility(eq(View.INVISIBLE));
    }
}