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

Commit c3b9a48e authored by Aaron Liu's avatar Aaron Liu
Browse files

[Bouncer] Fix translation speed for notifications.

Read bouncer state in order to determine when to use bouncer
interpolation for alpha.

Also rename boolean to be prefixed with is.

Bug: 228831465
Test: Manual and unit tests
Change-Id: I6f872db0655d04efae926fdd04e82a4aa460a408
Merged-In: I6f872db0655d04efae926fdd04e82a4aa460a408
parent fe40d739
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -507,7 +507,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        public void onPanelExpansionChanged(PanelExpansionChangeEvent event) {
            float fraction = event.getFraction();
            mPanelExpansionFraction =
                    mKeyguardViewManager.bouncerIsInTransit() ? BouncerPanelExpansionCalculator
                    mKeyguardViewManager.isBouncerInTransit() ? BouncerPanelExpansionCalculator
                            .aboutToShowBouncerProgress(fraction) : fraction;
            updateAlpha();
        }
+1 −1
Original line number Diff line number Diff line
@@ -612,7 +612,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
        } else if (progress > 0 && view.getVisibility() != View.VISIBLE) {
            view.setVisibility((View.VISIBLE));
        }
        float alpha = mQSPanelController.bouncerInTransit()
        float alpha = mQSPanelController.isBouncerInTransit()
                ? BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(progress)
                : ShadeInterpolation.getContentAlpha(progress);
        view.setAlpha(alpha);
+2 −2
Original line number Diff line number Diff line
@@ -254,8 +254,8 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
     *
     * @return if bouncer is in transit
     */
    public boolean bouncerInTransit() {
        return mStatusBarKeyguardViewManager.bouncerIsInTransit();
    public boolean isBouncerInTransit() {
        return mStatusBarKeyguardViewManager.isBouncerInTransit();
    }
}
+18 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.BypassController;
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.SectionProvider;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;

import javax.inject.Inject;

@@ -45,6 +46,10 @@ public class AmbientState {

    private final SectionProvider mSectionProvider;
    private final BypassController mBypassController;
    /**
     *  Used to read bouncer states.
     */
    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private int mScrollY;
    private boolean mDimmed;
    private ActivatableNotificationView mActivatedChild;
@@ -221,9 +226,11 @@ public class AmbientState {
    public AmbientState(
            Context context,
            @NonNull SectionProvider sectionProvider,
            @NonNull BypassController bypassController) {
            @NonNull BypassController bypassController,
            @Nullable StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
        mSectionProvider = sectionProvider;
        mBypassController = bypassController;
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
        reload(context);
    }

@@ -678,4 +685,14 @@ public class AmbientState {
    public int getStackTopMargin() {
        return mStackTopMargin;
    }

    /**
     * Check to see if we are about to show bouncer.
     *
     * @return if bouncer expansion is between 0 and 1.
     */
    public boolean isBouncerInTransit() {
        return mStatusBarKeyguardViewManager != null
                && mStatusBarKeyguardViewManager.isBouncerInTransit();
    }
}
+4 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.view.ViewGroup;
import androidx.annotation.VisibleForTesting;

import com.android.internal.policy.SystemBarUtils;
import com.android.keyguard.BouncerPanelExpansionCalculator;
import com.android.systemui.R;
import com.android.systemui.animation.ShadeInterpolation;
import com.android.systemui.statusbar.EmptyShadeView;
@@ -436,7 +437,9 @@ public class StackScrollAlgorithm {
        } else if (ambientState.isExpansionChanging()) {
            // Adjust alpha for shade open & close.
            float expansion = ambientState.getExpansionFraction();
            viewState.alpha = ShadeInterpolation.getContentAlpha(expansion);
            viewState.alpha = ambientState.isBouncerInTransit()
                    ? BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansion)
                    : ShadeInterpolation.getContentAlpha(expansion);
        }

        if (ambientState.isShadeExpanded() && view.mustStayOnScreen()
Loading