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

Commit 193677c2 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Do not animate scrims when launching camera

There's already a black overlay with a camera icon, it's not necessary
to animate the scrims.

Change-Id: I52472372420eb8ba052a17cdde147d24dafadce0
Fixes: 109767309
Test: double tap power button from lock screen and aod
parent 80167ec0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ public class NotificationPanelView extends PanelView implements
    private boolean mClosingWithAlphaFadeOut;
    private boolean mHeadsUpAnimatingAway;
    private boolean mLaunchingAffordance;
    private boolean mAffordanceHasPreview;
    private FalsingManager mFalsingManager;
    private String mLastCameraLaunchSource = KeyguardBottomAreaView.CAMERA_LAUNCH_SOURCE_AFFORDANCE;

@@ -2569,6 +2570,7 @@ public class NotificationPanelView extends PanelView implements
        } else {
            animate = false;
        }
        mAffordanceHasPreview = mKeyguardBottomArea.getRightPreview() != null;
        mAffordanceHelper.launchAffordance(animate, getLayoutDirection() == LAYOUT_DIRECTION_RTL);
    }

@@ -2613,6 +2615,13 @@ public class NotificationPanelView extends PanelView implements
        getCenterIcon().setLaunchingAffordance(launchingAffordance);
    }

    /**
     * Return true when a bottom affordance is launching an occluded activity with a splash screen.
     */
    public boolean isLaunchingAffordanceWithPreview() {
        return mLaunchingAffordance && mAffordanceHasPreview;
    }

    /**
     * Whether the camera application can be launched for the camera launch gesture.
     *
+8 −3
Original line number Diff line number Diff line
@@ -889,9 +889,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
    }

    public void setHasBackdrop(boolean hasBackdrop) {
        ScrimState[] states = ScrimState.values();
        for (int i = 0; i < states.length; i++) {
            states[i].setHasBackdrop(hasBackdrop);
        for (ScrimState state : ScrimState.values()) {
            state.setHasBackdrop(hasBackdrop);
        }
    }

    public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) {
        for (ScrimState state : ScrimState.values()) {
            state.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
        }
    }

+6 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ public enum ScrimState {
            mCurrentBehindAlpha = 0;
            mCurrentInFrontAlpha = 0;
            mAnimationDuration = StatusBar.FADE_KEYGUARD_DURATION;
            mAnimateChange = !mLaunchingAffordanceWithPreview;

            if (previousState == ScrimState.AOD || previousState == ScrimState.PULSING) {
                // Fade from black to transparent when coming directly from AOD
@@ -177,6 +178,7 @@ public enum ScrimState {
    boolean mWallpaperSupportsAmbientMode;
    int mIndex;
    boolean mHasBackdrop;
    boolean mLaunchingAffordanceWithPreview;

    ScrimState(int index) {
        mIndex = index;
@@ -249,6 +251,10 @@ public enum ScrimState {
        mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode;
    }

    public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) {
        mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview;
    }

    public boolean isLowPowerState() {
        return false;
    }
+6 −1
Original line number Diff line number Diff line
@@ -4729,6 +4729,10 @@ public class StatusBar extends SystemUI implements DemoMode,
        mScrimController.setExpansionAffectsAlpha(
                !mFingerprintUnlockController.isFingerprintUnlock());

        boolean launchingAffordanceWithPreview =
                mNotificationPanel.isLaunchingAffordanceWithPreview();
        mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);

        if (mBouncerShowing) {
            // Bouncer needs the front scrim when it's on top of an activity,
            // tapping on a notification, editing QS or being dismissed by
@@ -4738,7 +4742,8 @@ public class StatusBar extends SystemUI implements DemoMode,
                    || mStatusBarKeyguardViewManager.isFullscreenBouncer() ?
                    ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER;
            mScrimController.transitionTo(state);
        } else if (mLaunchCameraOnScreenTurningOn || isInLaunchTransition()) {
        } else if (isInLaunchTransition() || mLaunchCameraOnScreenTurningOn
                || launchingAffordanceWithPreview) {
            mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
        } else if (mBrightnessMirrorVisible) {
            mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR);