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

Commit b2ba7e28 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Delete legacy code"

parents f8f0c8df 3503c5f8
Loading
Loading
Loading
Loading
+7 −47
Original line number Diff line number Diff line
@@ -71,10 +71,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    public static final long ANIMATION_DURATION = 220;
    public static final Interpolator KEYGUARD_FADE_OUT_INTERPOLATOR
            = new PathInterpolator(0f, 0, 0.7f, 1f);
    public static final Interpolator KEYGUARD_FADE_OUT_INTERPOLATOR_LOCKED
            = new PathInterpolator(0.3f, 0f, 0.8f, 1f);

    /**
     * When both scrims have 0 alpha.
@@ -143,7 +139,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    protected boolean mAnimateChange;
    private boolean mUpdatePending;
    private boolean mTracking;
    private boolean mAnimateKeyguardFadingOut;
    protected long mAnimationDuration = -1;
    private long mAnimationDelay;
    private Runnable mOnAnimationFinished;
@@ -157,8 +152,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    private int mPinnedHeadsUpCount;
    private float mTopHeadsUpDragAmount;
    private View mDraggedHeadsUpView;
    private boolean mKeyguardFadingOutInProgress;
    private ValueAnimator mKeyguardFadeoutAnimation;
    private int mScrimsVisibility;
    private final Consumer<Integer> mScrimVisibleListener;
    private boolean mBlankScreen;
@@ -268,10 +261,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        // to do the same when you're just showing the brightness mirror.
        mNeedsDrawableColorUpdate = state != ScrimState.BRIGHTNESS_MIRROR;

        if (mKeyguardFadeoutAnimation != null) {
            mKeyguardFadeoutAnimation.cancel();
        }

        // The device might sleep if it's entering AOD, we need to make sure that
        // the animation plays properly until the last frame.
        // It's important to avoid holding the wakelock unless necessary because
@@ -585,16 +574,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            updateScrimColor(scrim, alpha, tint);
            dispatchScrimsVisible();
        });
        anim.setInterpolator(getInterpolator());
        anim.setInterpolator(mInterpolator);
        anim.setStartDelay(mAnimationDelay);
        anim.setDuration(mAnimationDuration);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (mKeyguardFadingOutInProgress) {
                    mKeyguardFadeoutAnimation = null;
                    mKeyguardFadingOutInProgress = false;
                }
                onFinished();

                scrim.setTag(TAG_KEY_ANIM, null);
@@ -606,10 +591,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
                }
            }
        });
        if (mAnimateKeyguardFadingOut) {
            mKeyguardFadingOutInProgress = true;
            mKeyguardFadeoutAnimation = anim;
        }

        // Cache alpha values because we might want to update this animator in the future if
        // the user expands the panel while the animation is still running.
@@ -644,16 +625,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        }
    }

    protected Interpolator getInterpolator() {
        if (mAnimateKeyguardFadingOut && mKeyguardUpdateMonitor.needsSlowUnlockTransition()) {
            return KEYGUARD_FADE_OUT_INTERPOLATOR_LOCKED;
        } else if (mAnimateKeyguardFadingOut) {
            return KEYGUARD_FADE_OUT_INTERPOLATOR;
        } else {
            return mInterpolator;
        }
    }

    @Override
    public boolean onPreDraw() {
        mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
@@ -662,9 +633,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            mCallback.onStart();
        }
        updateScrims();

        // Make sure that we always call the listener even if we didn't start an animation.
        endAnimateKeyguardFadingOut(false /* force */);
        if (mOnAnimationFinished != null && !isAnimating(mScrimInFront)
                && !isAnimating(mScrimBehind)) {
            mOnAnimationFinished.run();
            mOnAnimationFinished = null;
        }
        return true;
    }

@@ -685,17 +658,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        }
    }

    private void endAnimateKeyguardFadingOut(boolean force) {
        mAnimateKeyguardFadingOut = false;
        if (force || (!isAnimating(mScrimInFront) && !isAnimating(mScrimBehind))) {
            if (mOnAnimationFinished != null) {
                mOnAnimationFinished.run();
                mOnAnimationFinished = null;
            }
            mKeyguardFadingOutInProgress = false;
        }
    }

    private boolean isAnimating(View scrim) {
        return scrim.getTag(TAG_KEY_ANIM) != null;
    }
@@ -781,10 +743,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            mLightBarController.setScrimAlpha(alpha);
        }

        final ScrimView scrimView = scrim instanceof  ScrimView ? (ScrimView) scrim : null;
        final boolean wantsAlphaUpdate = alpha != currentAlpha;
        final boolean wantsTintUpdate = scrimView != null
                && scrimView.getTint() != getCurrentScrimTint(scrimView);
        final boolean wantsTintUpdate = scrim.getTint() != getCurrentScrimTint(scrim);

        if (wantsAlphaUpdate || wantsTintUpdate) {
            if (mAnimateChange) {
+1 −1
Original line number Diff line number Diff line
@@ -3540,7 +3540,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                .alpha(0f)
                .setStartDelay(0)
                .setDuration(FADE_KEYGUARD_DURATION_PULSING)
                .setInterpolator(ScrimController.KEYGUARD_FADE_OUT_INTERPOLATOR)
                .setInterpolator(Interpolators.ALPHA_OUT)
                .withEndAction(()-> {
                    hideKeyguard();
                    mStatusBarKeyguardViewManager.onKeyguardFadedAway();
+3 −3
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ public class ScrimControllerTest extends SysuiTestCase {
        private FakeHandler mHandler;
        private boolean mAnimationCancelled;

        public SynchronousScrimController(LightBarController lightBarController,
        SynchronousScrimController(LightBarController lightBarController,
                ScrimView scrimBehind, ScrimView scrimInFront, View headsUpScrim,
                Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
                AlarmManager alarmManager) {
@@ -496,7 +496,7 @@ public class ScrimControllerTest extends SysuiTestCase {
            mHandler = new FakeHandler(Looper.myLooper());
        }

        public void finishAnimationsImmediately() {
        void finishAnimationsImmediately() {
            boolean[] animationFinished = {false};
            setOnAnimationFinished(()-> animationFinished[0] = true);

@@ -515,7 +515,7 @@ public class ScrimControllerTest extends SysuiTestCase {
            }
        }

        public boolean wasAnimationJustCancelled() {
        boolean wasAnimationJustCancelled() {
            final boolean wasCancelled = mAnimationCancelled;
            mAnimationCancelled = false;
            return wasCancelled;