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

Commit 35fd336a authored by Justin Weir's avatar Justin Weir
Browse files

Remove CentralSurfaces.isPanelExpanded

CSI.mPanelExpanded was redundant, because the only code path that
updated its value also updated NPVC.mPanelExpanded to that same value.
Additionally, whenever CS updated its value, it would then tell NPVC
to update the sysui state flags using its copy of the data. This change
eliminates CSI's copy and getter, and it moves the flag update request
into NPVC to eliminate some spaghetti code. There was a tiny chance
that there was another listener for NPVC.mPanelExpanded changes that
received the event before CSI and needed the sysui state flags to not
have been updated yet, so I verified that that was not the case.

Bug: 249277686
Test: manual
Change-Id: I05a038d2be66cfb4d84662d0f18465e161564653
parent 4ee4adbb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -329,7 +329,9 @@ public class SystemActions implements CoreStartable {
        // binder calls
        final Optional<CentralSurfaces> centralSurfacesOptional =
                mCentralSurfacesOptionalLazy.get();
        if (centralSurfacesOptional.map(CentralSurfaces::isPanelExpanded).orElse(false)
        if (centralSurfacesOptional.isPresent()
                && centralSurfacesOptional.get().getShadeViewController() != null
                && centralSurfacesOptional.get().getShadeViewController().isPanelExpanded()
                && !centralSurfacesOptional.get().isKeyguardShowing()) {
            if (!mDismissNotificationShadeActionRegistered) {
                mA11yManager.registerSystemAction(
+3 −2
Original line number Diff line number Diff line
@@ -2440,6 +2440,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        boolean isExpanded = !isFullyCollapsed() || mExpectingSynthesizedDown;
        if (mPanelExpanded != isExpanded) {
            mPanelExpanded = isExpanded;
            updateSystemUiStateFlags();
            mShadeExpansionStateManager.onShadeExpansionFullyChanged(isExpanded);
            if (!isExpanded) {
                mQsController.closeQsCustomizer();
@@ -2447,6 +2448,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        }
    }

    @Override
    public boolean isPanelExpanded() {
        return mPanelExpanded;
    }
@@ -3440,9 +3442,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            Log.d(TAG, "Updating panel sysui state flags: fullyExpanded="
                    + isFullyExpanded() + " inQs=" + mQsController.getExpanded());
        }
        boolean isPanelVisible = mCentralSurfaces != null && mCentralSurfaces.isPanelExpanded();
        mSysUiState
                .setFlag(SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE, isPanelVisible)
                .setFlag(SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE, mPanelExpanded)
                .setFlag(SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED,
                        isFullyExpanded() && !mQsController.getExpanded())
                .setFlag(SYSUI_STATE_QUICK_SETTINGS_EXPANDED,
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ interface ShadeViewController {
     * Returns whether the shade height is greater than zero or the shade is expecting a synthesized
     * down event.
     */
    @get:Deprecated("use {@link #isExpanded()} instead") val isPanelExpanded: Boolean
    val isPanelExpanded: Boolean

    /** Returns whether the shade is fully expanded in either QS or QQS. */
    val isShadeFullyExpanded: Boolean
+0 −2
Original line number Diff line number Diff line
@@ -224,8 +224,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {

    NotificationPresenter getPresenter();

    boolean isPanelExpanded();

    /**
     * Used to dispatch initial touch events before crossing the threshold to pull down the
     * notification shade. After that, since the launcher window is set to slippery, input
+1 −1
Original line number Diff line number Diff line
@@ -545,7 +545,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba

    @Override
    public void togglePanel() {
        if (mCentralSurfaces.isPanelExpanded()) {
        if (mShadeViewController.isPanelExpanded()) {
            mShadeController.animateCollapseShade();
        } else {
            mShadeController.animateExpandShade();
Loading