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

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

Remove VisualStabilityManager from rom NSSL

Remove VisualStabilityManager from NotificationStackScrollLayout
and put it in the NotificationStackScrollLayoutController.

Bug: 147245740
Test: atest SystemUITests
Change-Id: I29f068ad275d6aeedc1d2093ce6b322125bcefc2
parent 692d2f91
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -453,8 +453,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private final DisplayMetrics mDisplayMetrics = Dependency.get(DisplayMetrics.class);
    private final LockscreenGestureLogger mLockscreenGestureLogger =
            Dependency.get(LockscreenGestureLogger.class);
    private final VisualStabilityManager mVisualStabilityManager =
            Dependency.get(VisualStabilityManager.class);
    protected boolean mClearAllEnabled;

    private Interpolator mHideXInterpolator = Interpolators.FAST_OUT_SLOW_IN;
@@ -580,9 +578,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        if (mFgsSectionView != null) {
            return;
        }

        mFgsSectionView = fgsSectionView;

        addView(mFgsSectionView, -1);
    }

@@ -603,7 +599,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

        inflateEmptyShadeView();
        inflateFooterView();
        mVisualStabilityManager.setVisibilityLocationProvider(this::isInVisibleLocation);
    }

    /**
@@ -1020,23 +1015,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mScrollAnchorView = scrollAnchorView;
    }

    @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
    public boolean isInVisibleLocation(NotificationEntry entry) {
        ExpandableNotificationRow row = entry.getRow();
        ExpandableViewState childViewState = row.getViewState();

        if (childViewState == null) {
            return false;
        }
        if ((childViewState.location & ExpandableViewState.VISIBLE_LOCATIONS) == 0) {
            return false;
        }
        if (row.getVisibility() != View.VISIBLE) {
            return false;
        }
        return true;
    }

    @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
    private void setMaxLayoutHeight(int maxLayoutHeight) {
        mMaxLayoutHeight = maxLayoutHeight;
+26 −8
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy;
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy.NotificationGroup;
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy.OnGroupChangeListener;
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.notifcollection.DismissedByUserStats;
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener;
import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager;
@@ -139,7 +140,6 @@ public class NotificationStackScrollLayoutController {
    private final ZenModeController mZenModeController;
    private final MetricsLogger mMetricsLogger;
    private final FalsingManager mFalsingManager;
    private final NotificationSectionsManager mNotificationSectionsManager;
    private final Resources mResources;
    private final NotificationSwipeHelper.Builder mNotificationSwipeHelperBuilder;
    private final ScrimController mScrimController;
@@ -153,6 +153,7 @@ public class NotificationStackScrollLayoutController {
    private final ForegroundServiceSectionController mFgServicesSectionController;
    private final LayoutInflater mLayoutInflater;
    private final NotificationRemoteInputManager mRemoteInputManager;
    private final VisualStabilityManager mVisualStabilityManager;
    private final KeyguardMediaController mKeyguardMediaController;
    private final SysuiStatusBarStateController mStatusBarStateController;
    private final KeyguardBypassController mKeyguardBypassController;
@@ -559,7 +560,6 @@ public class NotificationStackScrollLayoutController {
            NotificationLockscreenUserManager lockscreenUserManager,
            MetricsLogger metricsLogger,
            FalsingManager falsingManager,
            NotificationSectionsManager notificationSectionsManager,
            @Main Resources resources,
            NotificationSwipeHelper.Builder notificationSwipeHelperBuilder,
            StatusBar statusBar,
@@ -576,7 +576,8 @@ public class NotificationStackScrollLayoutController {
            ForegroundServiceDismissalFeatureController fgFeatureController,
            ForegroundServiceSectionController fgServicesSectionController,
            LayoutInflater layoutInflater,
            NotificationRemoteInputManager remoteInputManager) {
            NotificationRemoteInputManager remoteInputManager,
            VisualStabilityManager visualStabilityManager) {
        mAllowLongPress = allowLongPress;
        mNotificationGutsManager = notificationGutsManager;
        mHeadsUpManager = headsUpManager;
@@ -592,14 +593,12 @@ public class NotificationStackScrollLayoutController {
        mLockscreenUserManager = lockscreenUserManager;
        mMetricsLogger = metricsLogger;
        mFalsingManager = falsingManager;
        mNotificationSectionsManager = notificationSectionsManager;
        mResources = resources;
        mNotificationSwipeHelperBuilder = notificationSwipeHelperBuilder;
        mStatusBar = statusBar;
        mScrimController = scrimController;
        groupManager.registerGroupExpansionChangeListener((changedRow, expanded) -> {
            mView.onGroupExpandChanged(changedRow, expanded);
        });
        groupManager.registerGroupExpansionChangeListener(
                (changedRow, expanded) -> mView.onGroupExpandChanged(changedRow, expanded));
        legacyGroupManager.registerGroupChangeListener(new OnGroupChangeListener() {
            @Override
            public void onGroupCreatedFromChildren(NotificationGroup group) {
@@ -622,6 +621,7 @@ public class NotificationStackScrollLayoutController {
        mFgServicesSectionController = fgServicesSectionController;
        mLayoutInflater = layoutInflater;
        mRemoteInputManager = remoteInputManager;
        mVisualStabilityManager = visualStabilityManager;
    }

    public void attach(NotificationStackScrollLayout view) {
@@ -681,6 +681,8 @@ public class NotificationStackScrollLayoutController {
        mNotificationRoundnessManager.setOnRoundingChangedCallback(mView::invalidate);
        mView.addOnExpandedHeightChangedListener(mNotificationRoundnessManager::setExpanded);

        mVisualStabilityManager.setVisibilityLocationProvider(this::isInVisibleLocation);

        mTunerService.addTunable(
                (key, newValue) -> {
                    switch (key) {
@@ -723,6 +725,22 @@ public class NotificationStackScrollLayoutController {
        mSilentHeaderController.setOnClearAllClickListener(v -> clearSilentNotifications());
    }

    private boolean isInVisibleLocation(NotificationEntry entry) {
        ExpandableNotificationRow row = entry.getRow();
        ExpandableViewState childViewState = row.getViewState();

        if (childViewState == null) {
            return false;
        }
        if ((childViewState.location & ExpandableViewState.VISIBLE_LOCATIONS) == 0) {
            return false;
        }
        if (row.getVisibility() != View.VISIBLE) {
            return false;
        }
        return true;
    }

    public void addOnExpandedHeightChangedListener(BiConsumer<Float, Float> listener) {
        mView.addOnExpandedHeightChangedListener(listener);
    }
@@ -1459,7 +1477,7 @@ public class NotificationStackScrollLayoutController {

        @Override
        public boolean isInVisibleLocation(NotificationEntry entry) {
            return mView.isInVisibleLocation(entry);
            return NotificationStackScrollLayoutController.this.isInVisibleLocation(entry);
        }

        @Override
+0 −1
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
                1, UserHandle.USER_CURRENT);

        // Inject dependencies before initializing the layout
        mDependency.injectMockDependency(VisualStabilityManager.class);
        mDependency.injectTestDependency(
                NotificationBlockingHelperManager.class,
                mBlockingHelperManager);
+4 −3
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotifCollection;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy;
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.render.SectionHeaderController;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ForegroundServiceDungeonView;
@@ -105,7 +106,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
    @Mock private NotificationLockscreenUserManager mNotificationLockscreenUserManager;
    @Mock private MetricsLogger mMetricsLogger;
    @Mock private FalsingManager mFalsingManager;
    @Mock private NotificationSectionsManager mNotificationSectionsManager;
    @Mock private Resources mResources;
    @Mock(answer = Answers.RETURNS_SELF)
    private NotificationSwipeHelper.Builder mNotificationSwipeHelperBuilder;
@@ -126,6 +126,7 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
    @Mock private LayoutInflater mLayoutInflater;
    @Mock private NotificationRemoteInputManager mRemoteInputManager;
    @Mock private RemoteInputController mRemoteInputController;
    @Mock private VisualStabilityManager mVisualStabilityManager;

    @Captor
    private ArgumentCaptor<StatusBarStateController.StateListener> mStateListenerArgumentCaptor;
@@ -158,7 +159,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
                mNotificationLockscreenUserManager,
                mMetricsLogger,
                mFalsingManager,
                mNotificationSectionsManager,
                mResources,
                mNotificationSwipeHelperBuilder,
                mStatusBar,
@@ -175,7 +175,8 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
                mFgFeatureController,
                mFgServicesSectionController,
                mLayoutInflater,
                mRemoteInputManager
                mRemoteInputManager,
                mVisualStabilityManager
        );

        when(mNotificationStackScrollLayout.isAttachedToWindow()).thenReturn(true);