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

Commit 4cbf1b63 authored by Caitlin Cassidy's avatar Caitlin Cassidy
Browse files

[Status Bar Refactor] Remove some indirection about minFraction between

NotificationPanelViewController and PanelBar.

The current code flow is NPVC#setPanelScrimMinFraction =>
PanelBar#onPanelMinFractionChanged =>
NPVC#setMinFraction.

The minFraction doesn't need to flow through PanelBar if it's going to
go right back to NPVC.

Test: Test steps from ag/15759151
Bug: 200063118
Change-Id: If31a0d78cf4ac4a4d4bc6fcc7423a8006ab309fa
parent 23fc3d6b
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -1801,15 +1801,6 @@ public class NotificationPanelViewController extends PanelViewController {
        return !mQsTouchAboveFalsingThreshold;
    }

    /**
     * Percentage of panel expansion offset, caused by pulling down on a heads-up.
     */
    @Override
    public void setMinFraction(float minFraction) {
        mMinFraction = minFraction;
        mDepthController.setPanelPullDownMinFraction(mMinFraction);
    }

    private float computeQsExpansionFraction() {
        if (mQSAnimatingHiddenFromCollapsed) {
            // When hiding QS from collapsed state, the expansion can sometimes temporarily
@@ -3337,8 +3328,14 @@ public class NotificationPanelViewController extends PanelViewController {
        return mBarState == KEYGUARD;
    }

    /**
     * Sets the minimum fraction for the panel expansion offset. This may be non-zero in certain
     * cases, such as if there's a heads-up notification.
     */
    public void setPanelScrimMinFraction(float minFraction) {
        mBar.onPanelMinFractionChanged(minFraction);
        mMinFraction = minFraction;
        mDepthController.setPanelPullDownMinFraction(mMinFraction);
    }

    public void clearNotificationEffects() {
+1 −5
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone;
import static java.lang.Float.isNaN;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.content.Context;
import android.os.Bundle;
@@ -149,10 +148,7 @@ public abstract class PanelBar extends FrameLayout {
    /**
     * Percentage of panel expansion offset, caused by pulling down on a heads-up.
     */
    @CallSuper
    public void onPanelMinFractionChanged(float minFraction) {
        mPanel.setMinFraction(minFraction);
    }
    abstract void onPanelMinFractionChanged(float minFraction);

    /**
     * @param frac the fraction from the expansion in [0, 1]
+0 −7
Original line number Diff line number Diff line
@@ -342,13 +342,6 @@ public abstract class PanelViewController {

    protected abstract float getOpeningHeight();

    /**
     * Minimum fraction from where expansion should start. This is set when pulling down on a
     * heads-up notification.
     * @param minFraction Fraction from 0 to 1.
     */
    public abstract void setMinFraction(float minFraction);

    /**
     * @return whether the swiping direction is upwards and above a 45 degree angle compared to the
     * horizontal direction
+0 −1
Original line number Diff line number Diff line
@@ -272,7 +272,6 @@ public class PhoneStatusBarView extends PanelBar {
        if (isNaN(minFraction)) {
            throw new IllegalArgumentException("minFraction cannot be NaN");
        }
        super.onPanelMinFractionChanged(minFraction);
        if (mMinFraction != minFraction) {
            mMinFraction = minFraction;
            updateScrimFraction();
+2 −2
Original line number Diff line number Diff line
@@ -469,8 +469,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
    }

    @Test
    public void testSetMinFraction() {
        mNotificationPanelViewController.setMinFraction(0.5f);
    public void testSetPanelScrimMinFraction() {
        mNotificationPanelViewController.setPanelScrimMinFraction(0.5f);
        verify(mNotificationShadeDepthController).setPanelPullDownMinFraction(eq(0.5f));
    }