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

Commit 40e786f4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Apply wake up animation to wallpaper window" into rvc-dev am: 0e26234d am: 7f0e6453

Change-Id: I4f857331d33d51efcd92286f461dc8f2e17944e4
parents f37e69d1 7f0e6453
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class ImageWallpaper extends WallpaperService {
        private void init(DozeParameters dozeParameters) {
            mIsHighEndGfx = ActivityManager.isHighEndGfx();
            mDisplayNeedsBlanking = dozeParameters.getDisplayNeedsBlanking();
            mNeedTransition = mIsHighEndGfx && !mDisplayNeedsBlanking;
            mNeedTransition = false;

            // We will preserve EGL context when we are in lock screen or aod
            // to avoid janking in following transition, we need to release when back to home.
@@ -137,7 +137,7 @@ public class ImageWallpaper extends WallpaperService {
            mRenderer = getRendererInstance();
            getDisplayContext().getDisplay().getDisplayInfo(mDisplayInfo);
            setFixedSizeAllowed(true);
            setOffsetNotificationsEnabled(true);
            setOffsetNotificationsEnabled(mNeedTransition);
            updateSurfaceSize();
        }

+28 −2
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ 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.phone.ScrimController
import com.android.systemui.statusbar.policy.KeyguardStateController
import java.io.FileDescriptor
import java.io.PrintWriter
@@ -106,6 +107,16 @@ class NotificationShadeDepthController @Inject constructor(
            shadeSpring.finishIfRunning()
        }

    /**
     * Force stop blur effect when necessary.
     */
    private var scrimsVisible: Boolean = false
        set(value) {
            if (field == value) return
            field = value
            scheduleUpdate()
        }

    /**
     * Blur radius of the wake-up animation on this frame.
     */
@@ -142,7 +153,13 @@ class NotificationShadeDepthController @Inject constructor(
        if (showingHomeControls) {
            globalActionsRadius = 0
        }
        val blur = max(shadeRadius.toInt(), globalActionsRadius)
        var blur = max(shadeRadius.toInt(), globalActionsRadius)

        // Make blur be 0 if it is necessary to stop blur effect.
        if (scrimsVisible) {
            blur = 0
        }

        blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur)
        try {
            wallpaperManager.setWallpaperZoomOut(root.windowToken,
@@ -202,6 +219,10 @@ class NotificationShadeDepthController @Inject constructor(
                brightnessMirrorSpring.finishIfRunning()
            }
        }

        override fun onDozeAmountChanged(linear: Float, eased: Float) {
            wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased)
        }
    }

    init {
@@ -210,6 +231,10 @@ class NotificationShadeDepthController @Inject constructor(
            keyguardStateController.addCallback(keyguardStateCallback)
        }
        statusBarStateController.addCallback(statusBarStateCallback)
        notificationShadeWindowController.setScrimsVisibilityListener {
            // Stop blur effect when scrims is opaque to avoid unnecessary GPU composition.
            visibility -> scrimsVisible = visibility == ScrimController.OPAQUE
        }
    }

    /**
@@ -225,7 +250,8 @@ class NotificationShadeDepthController @Inject constructor(

    private fun updateShadeBlur() {
        var newBlur = 0
        if (statusBarStateController.state == StatusBarState.SHADE) {
        val state = statusBarStateController.state
        if (state == StatusBarState.SHADE || state == StatusBarState.SHADE_LOCKED) {
            val animatedBlur =
                    Interpolators.SHADE_ANIMATION.getInterpolation(
                            MathUtils.constrain(shadeExpansion / 0.15f, 0f, 1f))
+13 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Consumer;

import javax.inject.Inject;
import javax.inject.Singleton;
@@ -92,6 +93,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
    private final State mCurrentState = new State();
    private OtherwisedCollapsedListener mListener;
    private ForcePluginOpenListener mForcePluginOpenListener;
    private Consumer<Integer> mScrimsVisibilityListener;
    private final ArrayList<WeakReference<StatusBarWindowCallback>>
            mCallbacks = Lists.newArrayList();

@@ -150,6 +152,16 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
        mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback));
    }

    /**
     * Register a listener to monitor scrims visibility
     * @param listener A listener to monitor scrims visibility
     */
    public void setScrimsVisibilityListener(Consumer<Integer> listener) {
        if (listener != null && mScrimsVisibilityListener != listener) {
            mScrimsVisibilityListener = listener;
        }
    }

    private boolean shouldEnableKeyguardScreenRotation() {
        Resources res = mContext.getResources();
        return SystemProperties.getBoolean("lockscreen.rot_override", false)
@@ -477,6 +489,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
    public void setScrimsVisibility(int scrimsVisibility) {
        mCurrentState.mScrimsVisibility = scrimsVisibility;
        apply(mCurrentState);
        mScrimsVisibilityListener.accept(scrimsVisibility);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ public class ImageWallpaperTest extends SysuiTestCase {
                LOW_BMP_HEIGHT /* bmpHeight */,
                LOW_BMP_WIDTH /* surfaceWidth */,
                LOW_BMP_HEIGHT /* surfaceHeight */,
                true /* assertion */);
                false /* assertion */);
    }

    @Test
@@ -172,7 +172,7 @@ public class ImageWallpaperTest extends SysuiTestCase {
                INVALID_BMP_HEIGHT /* bmpHeight */,
                ImageWallpaper.GLEngine.MIN_SURFACE_WIDTH /* surfaceWidth */,
                ImageWallpaper.GLEngine.MIN_SURFACE_HEIGHT /* surfaceHeight */,
                true /* assertion */);
                false /* assertion */);
    }

    private void verifySurfaceSizeAndAssertTransition(int bmpWidth, int bmpHeight,