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

Commit d405fc44 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Bouncer] Apply interpolation to udfps" into tm-dev

parents 7b23f67a caa6359d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ object BouncerPanelExpansionCalculator {
     *  Scale the alpha/position of the host view.
     */
    @JvmStatic
    fun getHostViewScaledExpansion(fraction: Float): Float {
    fun showBouncerProgress(fraction: Float): Float {
        return when {
                    fraction >= 0.9f -> 1f
                    fraction < 0.6 -> 0f
@@ -35,7 +35,7 @@ object BouncerPanelExpansionCalculator {
     *  Scale the alpha/tint of the back scrim.
     */
    @JvmStatic
    fun getBackScrimScaledExpansion(fraction: Float): Float {
    fun aboutToShowBouncerProgress(fraction: Float): Float {
        return MathUtils.constrain((fraction - 0.9f) / 0.1f, 0f, 1f)
    }

+1 −1
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
     * @param fraction amount of the screen that should show.
     */
    public void setExpansion(float fraction) {
        float scaledFraction = BouncerPanelExpansionCalculator.getHostViewScaledExpansion(fraction);
        float scaledFraction = BouncerPanelExpansionCalculator.showBouncerProgress(fraction);
        mView.setAlpha(MathUtils.constrain(1 - scaledFraction, 0f, 1f));
        mView.setTranslationY(scaledFraction * mTranslationY);
    }
+12 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.Log;
import android.util.MathUtils;
import android.view.MotionEvent;

import com.android.keyguard.BouncerPanelExpansionCalculator;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.R;
import com.android.systemui.animation.ActivityLaunchAnimator;
@@ -71,7 +72,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    private float mTransitionToFullShadeProgress;
    private float mLastDozeAmount;
    private long mLastUdfpsBouncerShowTime = -1;
    private float mStatusBarExpansion;
    private float mPanelExpansionFraction;
    private boolean mLaunchTransitionFadingAway;
    private boolean mIsLaunchingActivity;
    private float mActivityLaunchProgress;
@@ -188,7 +189,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        pw.println("mQsExpanded=" + mQsExpanded);
        pw.println("mIsBouncerVisible=" + mIsBouncerVisible);
        pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount);
        pw.println("mStatusBarExpansion=" + mStatusBarExpansion);
        pw.println("mPanelExpansionFraction=" + mPanelExpansionFraction);
        pw.println("unpausedAlpha=" + mView.getUnpausedAlpha());
        pw.println("mUdfpsRequested=" + mUdfpsRequested);
        pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested);
@@ -324,14 +325,16 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
     */
    @Override
    public void updateAlpha() {
        // fade icon on transitions to showing the status bar, but if mUdfpsRequested, then
        // the keyguard is occluded by some application - so instead use the input bouncer
        // hidden amount to determine the fade
        float expansion = mUdfpsRequested ? mInputBouncerHiddenAmount : mStatusBarExpansion;
        // Fade icon on transitions to showing the status bar or bouncer, but if mUdfpsRequested,
        // then the keyguard is occluded by some application - so instead use the input bouncer
        // hidden amount to determine the fade.
        float expansion = mUdfpsRequested ? mInputBouncerHiddenAmount : mPanelExpansionFraction;

        int alpha = mShowingUdfpsBouncer ? 255
                : (int) MathUtils.constrain(
                    MathUtils.map(.5f, .9f, 0f, 255f, expansion),
                    0f, 255f);

        if (!mShowingUdfpsBouncer) {
            alpha *= (1.0f - mTransitionToFullShadeProgress);

@@ -471,7 +474,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        @Override
        public void onPanelExpansionChanged(
                float fraction, boolean expanded, boolean tracking) {
            mStatusBarExpansion = fraction;
            mPanelExpansionFraction =
                    mKeyguardViewManager.bouncerIsInTransit() ? BouncerPanelExpansionCalculator
                            .aboutToShowBouncerProgress(fraction) : fraction;
            updateAlpha();
        }
    };
+4 −4
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.systemui.dreams;

import static com.android.keyguard.BouncerPanelExpansionCalculator.getBackScrimScaledExpansion;
import static com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress;
import static com.android.keyguard.BouncerPanelExpansionCalculator.getDreamAlphaScaledExpansion;
import static com.android.keyguard.BouncerPanelExpansionCalculator.getDreamYPositionScaledExpansion;
import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;
@@ -217,19 +217,19 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve

        mBlurUtils.applyBlur(mView.getViewRootImpl(),
                (int) mBlurUtils.blurRadiusOfRatio(
                        1 - getBackScrimScaledExpansion(bouncerHideAmount)), false);
                        1 - aboutToShowBouncerProgress(bouncerHideAmount)), false);
    }

    private static float getAlpha(int position, float expansion) {
        return Interpolators.LINEAR_OUT_SLOW_IN.getInterpolation(
                position == POSITION_TOP ? getDreamAlphaScaledExpansion(expansion)
                        : getBackScrimScaledExpansion(expansion + 0.03f));
                        : aboutToShowBouncerProgress(expansion + 0.03f));
    }

    private float getTranslationY(int position, float expansion) {
        final float fraction = Interpolators.LINEAR_OUT_SLOW_IN.getInterpolation(
                position == POSITION_TOP ? getDreamYPositionScaledExpansion(expansion)
                        : getBackScrimScaledExpansion(expansion + 0.03f));
                        : aboutToShowBouncerProgress(expansion + 0.03f));
        return MathUtils.lerp(-mDreamOverlayMaxTranslationY, 0, fraction);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -610,7 +610,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
            view.setVisibility((View.VISIBLE));
        }
        float alpha = mQSPanelController.bouncerInTransit()
                ? BouncerPanelExpansionCalculator.getBackScrimScaledExpansion(progress)
                ? BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(progress)
                : ShadeInterpolation.getContentAlpha(progress);
        view.setAlpha(alpha);
    }
Loading