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

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

Remove ShadeController from NSSL

Remove ShadeController from NotificationStackScrollLayout
and move it into the NotificationStackScrollLayoutController.

This removes the last call to Depedency.get from the
NSSL, (and its controller).

Bug: 147245740
Test: atest SystemUITests && manual
Change-Id: I2eeaee6273a2bec933126051a722ad0659bcec49
parent 8c6a354f
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -448,6 +448,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private DismissListener mDismissListener;
    private DismissAllAnimationListener mDismissAllAnimationListener;
    private NotificationRemoteInputManager mRemoteInputManager;
    private ShadeController mShadeController;

    private final DisplayMetrics mDisplayMetrics = Dependency.get(DisplayMetrics.class);
    private final LockscreenGestureLogger mLockscreenGestureLogger =
@@ -5341,9 +5342,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        }

        if (viewsToRemove.isEmpty()) {
            if (closeShade) {
                Dependency.get(ShadeController.class).animateCollapsePanels(
                        CommandQueue.FLAG_EXCLUDE_NONE);
            if (closeShade && mShadeController != null) {
                mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
            }
            return;
        }
@@ -5379,11 +5379,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

        final Runnable onSlideAwayAnimationComplete = () -> {
            if (closeShade) {
                Dependency.get(ShadeController.class).addPostCollapseAction(() -> {
                mShadeController.addPostCollapseAction(() -> {
                    setDismissAllInProgress(false);
                    onAnimationComplete.run();
                });
                Dependency.get(ShadeController.class).animateCollapsePanels(
                mShadeController.animateCollapsePanels(
                        CommandQueue.FLAG_EXCLUDE_NONE);
            } else {
                setDismissAllInProgress(false);
@@ -5667,6 +5667,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mRemoteInputManager = remoteInputManager;
    }

    void setShadeController(ShadeController shadeController) {
        mShadeController = shadeController;
    }

    /**
     * A listener that is notified when the empty space below the notifications is clicked on
     */
@@ -6066,7 +6070,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

                if (!mAmbientState.isDozing() || startingChild != null) {
                    // We have notifications, go to locked shade.
                    Dependency.get(ShadeController.class).goToLockedShade(startingChild);
                    mShadeController.goToLockedShade(startingChild);
                    if (startingChild instanceof ExpandableNotificationRow) {
                        ExpandableNotificationRow row = (ExpandableNotificationRow) startingChild;
                        row.onExpandedByGesture(true /* drag down is always an open */);
+8 −3
Original line number Diff line number Diff line
@@ -21,11 +21,11 @@ import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_N

import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_GENTLE;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_HIGH_PRIORITY;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.OnEmptySpaceClickListener;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.OnOverscrollTopChangedListener;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_GENTLE;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_HIGH_PRIORITY;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.SelectedRows;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.canChildBeDismissed;
import static com.android.systemui.statusbar.phone.NotificationIconAreaController.HIGH_PRIORITY;
@@ -106,6 +106,7 @@ import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.dagger.StatusBarComponent;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -156,6 +157,7 @@ public class NotificationStackScrollLayoutController {
    private final NotificationRemoteInputManager mRemoteInputManager;
    private final VisualStabilityManager mVisualStabilityManager;
    private final NotificationBlockingHelperManager mNotificationBlockingHelperManager;
    private final ShadeController mShadeController;
    private final KeyguardMediaController mKeyguardMediaController;
    private final SysuiStatusBarStateController mStatusBarStateController;
    private final KeyguardBypassController mKeyguardBypassController;
@@ -580,7 +582,8 @@ public class NotificationStackScrollLayoutController {
            LayoutInflater layoutInflater,
            NotificationRemoteInputManager remoteInputManager,
            VisualStabilityManager visualStabilityManager,
            NotificationBlockingHelperManager notificationBlockingHelperManager) {
            NotificationBlockingHelperManager notificationBlockingHelperManager,
            ShadeController shadeController) {
        mAllowLongPress = allowLongPress;
        mNotificationGutsManager = notificationGutsManager;
        mHeadsUpManager = headsUpManager;
@@ -626,6 +629,7 @@ public class NotificationStackScrollLayoutController {
        mRemoteInputManager = remoteInputManager;
        mVisualStabilityManager = visualStabilityManager;
        mNotificationBlockingHelperManager = notificationBlockingHelperManager;
        mShadeController = shadeController;
    }

    public void attach(NotificationStackScrollLayout view) {
@@ -639,6 +643,7 @@ public class NotificationStackScrollLayoutController {
        mView.setFooterDismissListener(() ->
                mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES));
        mView.setRemoteInputManager(mRemoteInputManager);
        mView.setShadeController(mShadeController);

        if (mFgFeatureController.isForegroundServiceDismissalEnabled()) {
            mView.initializeForegroundServiceSection(
+4 −4
Original line number Diff line number Diff line
@@ -3,7 +3,10 @@
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 *
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +34,6 @@ import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -75,8 +77,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

import java.util.function.BiConsumer;

/**
 * Tests for {@link NotificationStackScrollLayout}.
 */
+4 −1
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController;
@@ -132,6 +133,7 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
    @Mock private RemoteInputController mRemoteInputController;
    @Mock private VisualStabilityManager mVisualStabilityManager;
    @Mock private NotificationBlockingHelperManager mNotificationBlockingHelperManager;
    @Mock private ShadeController mShadeController;

    @Captor
    private ArgumentCaptor<StatusBarStateController.StateListener> mStateListenerArgumentCaptor;
@@ -182,7 +184,8 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
                mLayoutInflater,
                mRemoteInputManager,
                mVisualStabilityManager,
                mNotificationBlockingHelperManager
                mNotificationBlockingHelperManager,
                mShadeController
        );

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