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

Commit 46a06bb6 authored by Dave Mankoff's avatar Dave Mankoff Committed by Steve Elliott
Browse files

Remove NotificationRoundessManager from NSSL

Remove NotificationRoundessManager from
NotificationStackScrollLayout and put it in the
NotificationStackScrollLayoutController.

This removes the last dependency injection from the NSSL.

Bug: 147245740
Test: atest SystemUITests
Change-Id: I88648ec10536f488fc67f287448c700b8759e9d2
parent 9ba64847
Loading
Loading
Loading
Loading
+3 −22
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;

import java.util.HashSet;
@@ -34,7 +35,7 @@ import javax.inject.Inject;
 * A class that manages the roundness for notification views
 */
@SysUISingleton
public class NotificationRoundnessManager implements OnHeadsUpChangedListener {
public class NotificationRoundnessManager {

    private final ExpandableView[] mFirstInSectionViews;
    private final ExpandableView[] mLastInSectionViews;
@@ -59,27 +60,7 @@ public class NotificationRoundnessManager implements OnHeadsUpChangedListener {
        mBypassController = keyguardBypassController;
    }

    @Override
    public void onHeadsUpPinned(NotificationEntry headsUp) {
        updateView(headsUp.getRow(), false /* animate */);
    }

    @Override
    public void onHeadsUpUnPinned(NotificationEntry headsUp) {
        updateView(headsUp.getRow(), true /* animate */);
    }

    public void onHeadsupAnimatingAwayChanged(ExpandableNotificationRow row,
            boolean isAnimatingAway) {
        updateView(row, false /* animate */);
    }

    @Override
    public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
        updateView(entry.getRow(), false /* animate */);
    }

    private void updateView(ExpandableView view, boolean animate) {
    public void updateView(ExpandableView view, boolean animate) {
        boolean changed = updateViewWithoutCallback(view, animate);
        if (changed) {
            mRoundingChangedCallback.run();
+3 −14
Original line number Diff line number Diff line
@@ -315,7 +315,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private HashSet<ExpandableView> mClearTransientViewsWhenFinished = new HashSet<>();
    private HashSet<Pair<ExpandableNotificationRow, Boolean>> mHeadsUpChangeAnimations
            = new HashSet<>();
    private final NotificationRoundnessManager mRoundnessManager;
    private boolean mTrackingHeadsUp;
    private boolean mForceNoOverlappingRendering;
    private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>();
@@ -525,7 +524,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    public NotificationStackScrollLayout(
            @Named(VIEW_CONTEXT) Context context,
            AttributeSet attrs,
            NotificationRoundnessManager notificationRoundnessManager,
            NotificationSectionsManager notificationSectionsManager,
            GroupMembershipManager groupMembershipManager,
            GroupExpansionManager groupExpansionManager,
@@ -533,7 +531,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    ) {
        super(context, attrs, 0, 0);
        Resources res = getResources();
        mRoundnessManager = notificationRoundnessManager;
        mSectionsManager = notificationSectionsManager;

        mSectionsManager.initialize(this, LayoutInflater.from(context));
@@ -3211,7 +3208,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            mAnimateNextSectionBoundsChange = false;
        }
        mAmbientState.setLastVisibleBackgroundChild(lastChild);
        mRoundnessManager.updateRoundedChildren(mSections);
        // TODO: Refactor SectionManager and put the RoundnessManager there.
        mController.getNoticationRoundessManager().updateRoundedChildren(mSections);
        mAnimateBottomOnLayout = false;
        invalidate();
    }
@@ -3286,14 +3284,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        requestChildrenUpdate();
    }

    @ShadeViewRefactor(RefactorComponent.ADAPTER)
    void bindRow(ExpandableNotificationRow row) {
        row.setHeadsUpAnimatingAwayListener(animatingAway -> {
            mRoundnessManager.onHeadsupAnimatingAwayChanged(row, animatingAway);
            mHeadsUpAppearanceController.updateHeader(row.getEntry());
        });
    }

    public boolean containsView(View v) {
        return v.getParent() == this;
    }
@@ -5011,7 +5001,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    public void setTrackingHeadsUp(ExpandableNotificationRow row) {
        mAmbientState.setTrackedHeadsUpRow(row);
        mTrackingHeadsUp = row != null;
        mRoundnessManager.setTrackingHeadsUp(row);
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@@ -5332,7 +5321,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public void setHeadsUpAppearanceController(
    void setHeadsUpAppearanceController(
            HeadsUpAppearanceController headsUpAppearanceController) {
        mHeadsUpAppearanceController = headsUpAppearanceController;
    }
+28 −22
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ public class NotificationStackScrollLayoutController {
    private NotificationSwipeHelper mSwipeHelper;
    private boolean mShowEmptyShadeView;
    private int mBarState;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;

    private final NotificationListContainerImpl mNotificationListContainer =
            new NotificationListContainerImpl();
@@ -513,12 +514,12 @@ public class NotificationStackScrollLayoutController {

                @Override
                public void onHeadsUpPinned(NotificationEntry entry) {

                    mNotificationRoundnessManager.updateView(entry.getRow(), false /* animate */);
                }

                @Override
                public void onHeadsUpUnPinned(NotificationEntry entry) {

                    mNotificationRoundnessManager.updateView(entry.getRow(), true /* animate */);
                }

                @Override
@@ -527,6 +528,7 @@ public class NotificationStackScrollLayoutController {
                    NotificationEntry topEntry = mHeadsUpManager.getTopEntry();
                    mView.setNumHeadsUp(numEntries);
                    mView.setTopHeadsUpEntry(topEntry);
                    mNotificationRoundnessManager.updateView(entry.getRow(), false /* animate */);
                }
            };

@@ -658,7 +660,6 @@ public class NotificationStackScrollLayoutController {
        mView.initView(mView.getContext(), mKeyguardBypassController::getBypassEnabled,
                mSwipeHelper);

        mHeadsUpManager.addListener(mNotificationRoundnessManager); // TODO: why is this here?
        mHeadsUpManager.addListener(mOnHeadsUpChangedListener);
        mHeadsUpManager.setAnimationStateHandler(mView::setHeadsUpGoingAwayAnimationsAllowed);
        mDynamicPrivacyController.addListener(mDynamicPrivacyControllerListener);
@@ -732,6 +733,7 @@ public class NotificationStackScrollLayoutController {
    }

    public void setHeadsUpAppearanceController(HeadsUpAppearanceController controller) {
        mHeadsUpAppearanceController = controller;
        mView.setHeadsUpAppearanceController(controller);
    }

@@ -780,6 +782,7 @@ public class NotificationStackScrollLayoutController {

    public void setTrackingHeadsUp(ExpandableNotificationRow expandableNotificationRow) {
        mView.setTrackingHeadsUp(expandableNotificationRow);
        mNotificationRoundnessManager.setTrackingHeadsUp(expandableNotificationRow);
    }

    public void wakeUpFromPulse() {
@@ -1464,7 +1467,10 @@ public class NotificationStackScrollLayoutController {

        @Override
        public void bindRow(ExpandableNotificationRow row) {
            mView.bindRow(row);
            row.setHeadsUpAnimatingAwayListener(animatingAway -> {
                mNotificationRoundnessManager.updateView(row, false);
                mHeadsUpAppearanceController.updateHeader(row.getEntry());
            });
        }

        @Override
+4 −4
Original line number Diff line number Diff line
@@ -73,10 +73,10 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
                TestableLooper.get(this));
        mFirst = testHelper.createRow();
        mFirst.setHeadsUpAnimatingAwayListener(animatingAway
                -> mRoundnessManager.onHeadsupAnimatingAwayChanged(mFirst, animatingAway));
                -> mRoundnessManager.updateView(mFirst, false));
        mSecond = testHelper.createRow();
        mSecond.setHeadsUpAnimatingAwayListener(animatingAway
                -> mRoundnessManager.onHeadsupAnimatingAwayChanged(mSecond, animatingAway));
                -> mRoundnessManager.updateView(mSecond, false));
        mRoundnessManager.setOnRoundingChangedCallback(mRoundnessCallback);
        mRoundnessManager.setAnimatedChildren(mAnimatedChildren);
        mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
@@ -160,12 +160,12 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {

        when(testHelper.getStatusBarStateController().isDozing()).thenReturn(true);
        row.setHeadsUp(true);
        mRoundnessManager.onHeadsUpStateChanged(entry, true);
        mRoundnessManager.updateView(entry.getRow(), false);
        Assert.assertEquals(1f, row.getCurrentBottomRoundness(), 0.0f);
        Assert.assertEquals(1f, row.getCurrentTopRoundness(), 0.0f);

        row.setHeadsUp(false);
        mRoundnessManager.onHeadsUpStateChanged(entry, false);
        mRoundnessManager.updateView(entry.getRow(), false);
        Assert.assertEquals(0f, row.getCurrentBottomRoundness(), 0.0f);
        Assert.assertEquals(0f, row.getCurrentTopRoundness(), 0.0f);
    }
+0 −1
Original line number Diff line number Diff line
@@ -146,7 +146,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        mStackScrollerInternal = new NotificationStackScrollLayout(
                getContext(),
                null,
                mNotificationRoundnessManager,
                mNotificationSectionsManager,
                mGroupMembershipManger,
                mGroupExpansionManager,