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

Commit 3f23fb09 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Micro-optimizations for qsFullScreen

Note that setScrollingEnabled needs to be called when the state is
updated regardless of whether qsFullScreen changes or not, so I moved
it back to where it was prior to ag/26643429.

Bug: 331878115
Test: https://dashboards.corp.google.com/view/_253ba238_3acf_45bf_981e_4fcbab46ca26?p=INVOCATIONS:I06000010266669753,I51500010266100726,I90700010267636750,I52500010268172561,I89000010268113396,I82500010276381802&p=INVOCATION_NAMES:good,bad,flag_off,qsFullScreen,shadeExpansion,optimized&f=class_name:in:OpenScrollNotificationShadeMicrobenchmark&av=sskz5j:kwkjon
Flag: EXEMPT trivial change

Change-Id: I6112ca062cda2239a04481ebcd1442b713453cae
parent c7942f24
Loading
Loading
Loading
Loading
+20 −7
Original line number Original line Diff line number Diff line
@@ -207,6 +207,11 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum


    /** Indicates QS is at its max height */
    /** Indicates QS is at its max height */
    private boolean mFullyExpanded;
    private boolean mFullyExpanded;
    /**
     * Indicates QS is at its maximum height, AND takes up the whole screen (i.e. not in split
     * shade).
     */
    private boolean mFullScreen;
    private boolean mExpandedWhenExpandingStarted;
    private boolean mExpandedWhenExpandingStarted;
    private boolean mAnimatingHiddenFromCollapsed;
    private boolean mAnimatingHiddenFromCollapsed;
    private boolean mVisible;
    private boolean mVisible;
@@ -967,27 +972,35 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum
    }
    }


    private void setQsFullScreen(boolean qsFullScreen) {
    private void setQsFullScreen(boolean qsFullScreen) {
        if (mFullScreen == qsFullScreen) {
            return; // no change
        }
        mFullScreen = qsFullScreen;

        mShadeRepository.setLegacyQsFullscreen(qsFullScreen);
        mShadeRepository.setLegacyQsFullscreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
        if (!SceneContainerFlag.isEnabled()) {
            mNotificationStackScrollLayoutController.setScrollingEnabled(
                    mBarState != KEYGUARD && (!qsFullScreen || mExpansionFromOverscroll));
        }
    }
    }


    void updateQsState() {
    void updateQsState() {
        boolean qsExpanded = getExpanded();

        if (!FooterViewRefactor.isEnabled()) {
        if (!FooterViewRefactor.isEnabled()) {
            // Update full screen state; note that this will be true if the QS panel is only
            // Update full screen state; note that this will be true if the QS panel is only
            // partially expanded, and that is fixed with the footer view refactor.
            // partially expanded, and that is fixed with the footer view refactor.
            setQsFullScreen(/* qsFullScreen = */ getExpanded() && !mSplitShadeEnabled);
            setQsFullScreen(/* qsFullScreen = */ qsExpanded && !mSplitShadeEnabled);
        }

        if (!SceneContainerFlag.isEnabled()) {
            mNotificationStackScrollLayoutController.setScrollingEnabled(
                    mBarState != KEYGUARD && (!mFullScreen || mExpansionFromOverscroll));
        }
        }


        if (mQsStateUpdateListener != null) {
        if (mQsStateUpdateListener != null) {
            mQsStateUpdateListener.onQsStateUpdated(getExpanded(), mStackScrollerOverscrolling);
            mQsStateUpdateListener.onQsStateUpdated(qsExpanded, mStackScrollerOverscrolling);
        }
        }


        if (mQs == null) return;
        if (mQs == null) return;
        mQs.setExpanded(getExpanded());
        mQs.setExpanded(qsExpanded);
    }
    }


    /** update expanded state of QS */
    /** update expanded state of QS */