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

Commit 6c3ff269 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update NSSL footer views within NSSL"

parents bbbccc3c 138fa1de
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -4990,17 +4990,29 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    public void removeContainerView(View v) {
        Assert.isMainThread();
        removeView(v);
        if (v instanceof ExpandableNotificationRow && !mController.isShowingEmptyShadeView()) {
            mController.updateShowEmptyShadeView();
            updateFooter();
        }
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public void addContainerView(View v) {
        Assert.isMainThread();
        addView(v);
        if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) {
            mController.updateShowEmptyShadeView();
            updateFooter();
        }
    }

    public void addContainerViewAt(View v, int index) {
        Assert.isMainThread();
        addView(v, index);
        if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) {
            mController.updateShowEmptyShadeView();
            updateFooter();
        }
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@@ -5101,6 +5113,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        updateScrollability();
    }

    boolean isQsExpanded() {
        return mQsExpanded;
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public void setQsExpansionFraction(float qsExpansionFraction) {
        mQsExpansionFraction = qsExpansionFraction;
+35 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.notification.stack;

import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;

import android.content.res.Resources;
import android.graphics.Point;
@@ -117,6 +118,8 @@ public class NotificationStackScrollLayoutController {
    private NotificationStackScrollLayout mView;
    private boolean mFadeNotificationsOnDismiss;
    private NotificationSwipeHelper mSwipeHelper;
    private boolean mShowEmptyShadeView;
    private int mBarState;

    private final NotificationListContainerImpl mNotificationListContainer =
            new NotificationListContainerImpl();
@@ -127,6 +130,8 @@ public class NotificationStackScrollLayoutController {
                @Override
                public void onViewAttachedToWindow(View v) {
                    mConfigurationController.addCallback(mConfigurationListener);
                    mZenModeController.addCallback(mZenModeControllerCallback);
                    mBarState = mStatusBarStateController.getState();
                    mStatusBarStateController.addCallback(
                            mStateListener, SysuiStatusBarStateController.RANK_STACK_SCROLLER);
                }
@@ -134,6 +139,7 @@ public class NotificationStackScrollLayoutController {
                @Override
                public void onViewDetachedFromWindow(View v) {
                    mConfigurationController.removeCallback(mConfigurationListener);
                    mZenModeController.removeCallback(mZenModeControllerCallback);
                    mStatusBarStateController.removeCallback(mStateListener);
                }
            };
@@ -154,11 +160,13 @@ public class NotificationStackScrollLayoutController {
    final ConfigurationListener mConfigurationListener = new ConfigurationListener() {
        @Override
        public void onDensityOrFontScaleChanged() {
            updateShowEmptyShadeView();
            mView.reinflateViews();
        }

        @Override
        public void onOverlayChanged() {
            updateShowEmptyShadeView();
            mView.updateCornerRadius();
            mView.reinflateViews();
        }
@@ -179,14 +187,15 @@ public class NotificationStackScrollLayoutController {
                @Override
                public void onStatePreChange(int oldState, int newState) {
                    if (oldState == StatusBarState.SHADE_LOCKED
                            && newState == StatusBarState.KEYGUARD) {
                            && newState == KEYGUARD) {
                        mView.requestAnimateEverything();
                    }
                }

                @Override
                public void onStateChanged(int newState) {
                    mView.setStatusBarState(newState);
                    mBarState = newState;
                    mView.setStatusBarState(mBarState);
                }

                @Override
@@ -480,6 +489,14 @@ public class NotificationStackScrollLayoutController {
        }
    };

    private final ZenModeController.Callback mZenModeControllerCallback =
            new ZenModeController.Callback() {
                @Override
                public void onZenChanged(int zen) {
                    updateShowEmptyShadeView();
                }
            };

    @Inject
    public NotificationStackScrollLayoutController(
            @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
@@ -795,6 +812,7 @@ public class NotificationStackScrollLayoutController {

    public void setQsExpanded(boolean expanded) {
        mView.setQsExpanded(expanded);
        updateShowEmptyShadeView();
    }

    public void setScrollingEnabled(boolean enabled) {
@@ -903,8 +921,21 @@ public class NotificationStackScrollLayoutController {
        return mView.getFooterViewHeightWithPadding();
    }

    public void updateEmptyShadeView(boolean visible) {
        mView.updateEmptyShadeView(visible, mZenModeController.areNotificationsHiddenInShade());
    /**
     * Update whether we should show the empty shade view (no notifications in the shade).
     * If so, send the update to our view.
     */
    public void updateShowEmptyShadeView() {
        mShowEmptyShadeView = mBarState != KEYGUARD
                && !mView.isQsExpanded()
                && mView.getVisibleNotificationCount() == 0;
        mView.updateEmptyShadeView(
                mShowEmptyShadeView,
                mZenModeController.areNotificationsHiddenInShade());
    }

    public boolean isShowingEmptyShadeView() {
        return mShowEmptyShadeView;
    }

    public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
+11 −48
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.notification.ViewGroupFadeHelper;
import com.android.systemui.statusbar.notification.collection.ListEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.render.ShadeViewManager;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
@@ -120,7 +121,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.InjectionInflationController;

import java.io.FileDescriptor;
@@ -168,9 +168,6 @@ public class NotificationPanelViewController extends PanelViewController {
            mOnHeadsUpChangedListener =
            new MyOnHeadsUpChangedListener();
    private final HeightListener mHeightListener = new HeightListener();
    private final ZenModeControllerCallback
            mZenModeControllerCallback =
            new ZenModeControllerCallback();
    private final ConfigurationListener mConfigurationListener = new ConfigurationListener();
    private final StatusBarStateListener mStatusBarStateListener = new StatusBarStateListener();
    private final ExpansionCallback mExpansionCallback = new ExpansionCallback();
@@ -178,7 +175,6 @@ public class NotificationPanelViewController extends PanelViewController {
    private final NotificationPanelView mView;
    private final MetricsLogger mMetricsLogger;
    private final ActivityManager mActivityManager;
    private final ZenModeController mZenModeController;
    private final ConfigurationController mConfigurationController;
    private final FlingAnimationUtils.Builder mFlingAnimationUtilsBuilder;
    private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController;
@@ -342,8 +338,6 @@ public class NotificationPanelViewController extends PanelViewController {
    private boolean mKeyguardStatusViewAnimating;
    private ValueAnimator mQsSizeChangeAnimator;

    private boolean mShowEmptyShadeView;

    private boolean mQsScrimEnabled = true;
    private boolean mQsTouchAboveFalsingThreshold;
    private int mQsFalsingThreshold;
@@ -505,7 +499,7 @@ public class NotificationPanelViewController extends PanelViewController {
            LatencyTracker latencyTracker, PowerManager powerManager,
            AccessibilityManager accessibilityManager, @DisplayId int displayId,
            KeyguardUpdateMonitor keyguardUpdateMonitor, MetricsLogger metricsLogger,
            ActivityManager activityManager, ZenModeController zenModeController,
            ActivityManager activityManager,
            ConfigurationController configurationController,
            FlingAnimationUtils.Builder flingAnimationUtilsBuilder,
            StatusBarTouchableRegionManager statusBarTouchableRegionManager,
@@ -522,7 +516,6 @@ public class NotificationPanelViewController extends PanelViewController {
        mView = view;
        mMetricsLogger = metricsLogger;
        mActivityManager = activityManager;
        mZenModeController = zenModeController;
        mConfigurationController = configurationController;
        mFlingAnimationUtilsBuilder = flingAnimationUtilsBuilder;
        mMediaHierarchyManager = mediaHierarchyManager;
@@ -724,8 +717,6 @@ public class NotificationPanelViewController extends PanelViewController {
    }

    private void reInflateViews() {
        updateShowEmptyShadeView();

        // Re-inflate the status view group.
        int index = mView.indexOfChild(mKeyguardStatusView);
        mView.removeView(mKeyguardStatusView);
@@ -1727,7 +1718,6 @@ public class NotificationPanelViewController extends PanelViewController {
        mNotificationStackScrollLayoutController.setScrollingEnabled(
                mBarState != KEYGUARD && (!mQsExpanded
                        || mQsExpansionFromOverscroll));
        updateEmptyShadeView();

        mQsNavbarScrim.setVisibility(
                mBarState == StatusBarState.SHADE && mQsExpanded && !mStackScrollerOverscrolling
@@ -2145,7 +2135,7 @@ public class NotificationPanelViewController extends PanelViewController {
        // it in expanded QS state as well so we don't run into troubles when fading the view in/out
        // and expanding/collapsing the whole panel from/to quick settings.
        if (mNotificationStackScrollLayoutController.getNotGoneChildCount() == 0
                && mShowEmptyShadeView) {
                && mNotificationStackScrollLayoutController.isShowingEmptyShadeView()) {
            notificationHeight = mNotificationStackScrollLayoutController.getEmptyShadeViewHeight();
        }
        int maxQsHeight = mQsMaxExpansionHeight;
@@ -2561,17 +2551,6 @@ public class NotificationPanelViewController extends PanelViewController {
        return mDozing;
    }

    public void showEmptyShadeView(boolean emptyShadeViewVisible) {
        mShowEmptyShadeView = emptyShadeViewVisible;
        updateEmptyShadeView();
    }

    private void updateEmptyShadeView() {
        // Hide "No notifications" in QS.
        mNotificationStackScrollLayoutController.updateEmptyShadeView(
                mShowEmptyShadeView && !mQsExpanded);
    }

    public void setQsScrimEnabled(boolean qsScrimEnabled) {
        boolean changed = mQsScrimEnabled != qsScrimEnabled;
        mQsScrimEnabled = qsScrimEnabled;
@@ -3078,22 +3057,21 @@ public class NotificationPanelViewController extends PanelViewController {
        return mNotificationStackScrollLayoutController.hasActiveClearableNotifications(ROWS_ALL);
    }

    private void updateShowEmptyShadeView() {
        boolean
                showEmptyShadeView =
                mBarState != KEYGUARD && !mEntryManager.hasActiveNotifications();
        showEmptyShadeView(showEmptyShadeView);
    }

    public RemoteInputController.Delegate createRemoteInputDelegate() {
        return mNotificationStackScrollLayoutController.createDelegate();
    }

    void updateNotificationViews(String reason) {
    /**
     * Updates the notification views' sections and status bar icons. This is
     * triggered by the NotificationPresenter whenever there are changes to the underlying
     * notification data being displayed. In the new notification pipeline, this is handled in
     * {@link ShadeViewManager}.
     */
    public void updateNotificationViews(String reason) {
        mNotificationStackScrollLayoutController.updateSectionBoundaries(reason);
        mNotificationStackScrollLayoutController.updateSpeedBumpIndex();
        mNotificationStackScrollLayoutController.updateFooter();
        updateShowEmptyShadeView();

        mNotificationIconAreaController.updateNotificationIcons(createVisibleEntriesList());
    }

@@ -3147,7 +3125,6 @@ public class NotificationPanelViewController extends PanelViewController {
        mNotificationStackScrollLayoutController.setStatusBar(statusBar);
        mNotificationStackScrollLayoutController.setGroupManager(groupManager);
        mNotificationStackScrollLayoutController.setShelfController(notificationShelfController);
        updateShowEmptyShadeView();
        mNotificationShelfController = notificationShelfController;
        updateMaxDisplayedNotifications(true);
    }
@@ -3602,19 +3579,7 @@ public class NotificationPanelViewController extends PanelViewController {
        }
    }

    private class ZenModeControllerCallback implements ZenModeController.Callback {
        @Override
        public void onZenChanged(int zen) {
            updateShowEmptyShadeView();
        }
    }

    private class ConfigurationListener implements ConfigurationController.ConfigurationListener {
        @Override
        public void onDensityOrFontScaleChanged() {
            updateShowEmptyShadeView();
        }

        @Override
        public void onThemeChanged() {
            final int themeResId = mView.getContext().getThemeResId();
@@ -3712,7 +3677,6 @@ public class NotificationPanelViewController extends PanelViewController {
        public void onViewAttachedToWindow(View v) {
            FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener);
            mStatusBarStateController.addCallback(mStatusBarStateListener);
            mZenModeController.addCallback(mZenModeControllerCallback);
            mConfigurationController.addCallback(mConfigurationListener);
            mUpdateMonitor.registerCallback(mKeyguardUpdateCallback);
            // Theme might have changed between inflating this view and attaching it to the
@@ -3725,7 +3689,6 @@ public class NotificationPanelViewController extends PanelViewController {
        public void onViewDetachedFromWindow(View v) {
            FragmentHostManager.get(mView).removeTagListener(QS.TAG, mFragmentListener);
            mStatusBarStateController.removeCallback(mStatusBarStateListener);
            mZenModeController.removeCallback(mZenModeControllerCallback);
            mConfigurationController.removeCallback(mConfigurationListener);
            mUpdateMonitor.removeCallback(mKeyguardUpdateCallback);
        }
+4 −4
Original line number Diff line number Diff line
@@ -47,9 +47,6 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationMediaManager;
@@ -81,7 +78,6 @@ import com.android.systemui.statusbar.notification.row.NotificationBlockingHelpe
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.util.leak.LeakDetector;
@@ -128,6 +124,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    @Mock private FeatureFlags mFeatureFlags;
    @Mock private SysuiStatusBarStateController mStatusBarStateController;
    @Mock private NotificationSwipeHelper mNotificationSwipeHelper;
    @Mock NotificationStackScrollLayoutController mStackScrollLayoutController;
    private NotificationEntryManager mEntryManager;
    private int mOriginalInterruptionModelSetting;
    private UiEventLoggerFake mUiEventLoggerFake = new UiEventLoggerFake();
@@ -216,6 +213,9 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        mStackScroller.setStatusBar(mBar);
        mStackScroller.setGroupManager(mGroupManager);
        mStackScroller.setEmptyShadeView(mEmptyShadeView);
        when(mStackScrollLayoutController.getNoticationRoundessManager())
                .thenReturn(mock(NotificationRoundnessManager.class));
        mStackScroller.setController(mStackScrollLayoutController);

        // Stub out functionality that isn't necessary to test.
        doNothing().when(mBar)
+46 −12
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.systemui.statusbar.notification.stack;

import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.SHADE;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.argThat;
@@ -49,7 +52,6 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -62,6 +64,7 @@ import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

@@ -115,6 +118,9 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
    @Mock
    private ScrimController mScrimController;

    @Captor
    ArgumentCaptor<StatusBarStateController.StateListener> mStateListenerArgumentCaptor;

    private NotificationStackScrollLayoutController mController;

    @Before
@@ -181,32 +187,49 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
    }

    @Test
    public void testUpdateEmptyShadeView_notificationsVisible() {
    public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true);
        mController.attach(mNotificationStackScrollLayout);
        verify(mSysuiStatusBarStateController).addCallback(
                mStateListenerArgumentCaptor.capture(), anyInt());
        StatusBarStateController.StateListener stateListener =
                mStateListenerArgumentCaptor.getValue();

        mController.updateEmptyShadeView(true /* visible */);
        setupShowEmptyShadeViewState(stateListener, true);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                true /* visible */,

                true /* notifVisibleInShade */);

        setupShowEmptyShadeViewState(stateListener, false);
        reset(mNotificationStackScrollLayout);
        mController.updateEmptyShadeView(false /* visible */);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                false /* visible */,
                true /* notifVisibleInShade */);
    }

    @Test
    public void testUpdateEmptyShadeView_notificationsHidden() {
    public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
        mController.attach(mNotificationStackScrollLayout);
        verify(mSysuiStatusBarStateController).addCallback(
                mStateListenerArgumentCaptor.capture(), anyInt());
        StatusBarStateController.StateListener stateListener =
                mStateListenerArgumentCaptor.getValue();

        mController.updateEmptyShadeView(true /* visible */);
        setupShowEmptyShadeViewState(stateListener, true);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                true /* visible */,
                false /* notifVisibleInShade */);

        setupShowEmptyShadeViewState(stateListener, false);
        reset(mNotificationStackScrollLayout);
        mController.updateEmptyShadeView(false /* visible */);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                false /* visible */,
                false /* notifVisibleInShade */);
@@ -234,15 +257,12 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
    public void testOnStatePostChange_verifyIfProfileIsPublic() {
        when(mNotificationLockscreenUserManager.isAnyProfilePublicMode()).thenReturn(true);

        ArgumentCaptor<StatusBarStateController.StateListener> stateListenerArgumentCaptor =
                ArgumentCaptor.forClass(StatusBarStateController.StateListener.class);

        mController.attach(mNotificationStackScrollLayout);
        verify(mSysuiStatusBarStateController).addCallback(
                stateListenerArgumentCaptor.capture(), anyInt());
                mStateListenerArgumentCaptor.capture(), anyInt());

        StatusBarStateController.StateListener stateListener =
                stateListenerArgumentCaptor.getValue();
                mStateListenerArgumentCaptor.getValue();

        stateListener.onStatePostChange();
        verify(mNotificationStackScrollLayout).updateSensitiveness(false, true);
@@ -299,6 +319,20 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
        return argThat(new LogMatcher(category, type));
    }

    private void setupShowEmptyShadeViewState(
            StatusBarStateController.StateListener statusBarStateListener,
            boolean toShow) {
        if (toShow) {
            statusBarStateListener.onStateChanged(SHADE);
            mController.setQsExpanded(false);
            mController.getView().removeAllViews();
        } else {
            statusBarStateListener.onStateChanged(KEYGUARD);
            mController.setQsExpanded(true);
            mController.getView().addContainerView(mock(ExpandableNotificationRow.class));
        }
    }

    static class LogMatcher implements ArgumentMatcher<LogMaker> {
        private int mCategory, mType;

Loading