Stop injection KeyguardBypassController into NSSL

Most importantly, this change moves the call to initView
out of NotificationStackScrollLayout's constructor. It is now called
by NotificationStackScrollLayoutController once it is attached.

The controller now supplies a KeyguardBypassEnabledProvider instead of
supplying the KeyguardBypassController directly.

Bug: 147245740
Test: atest SystemUITests
Change-Id: I167b23a51167f89bef1817f59264257586bc31c5
This commit is contained in:
Dave Mankoff
2020-04-06 14:02:58 -04:00
committed by Steve Elliott
parent 787367b0b8
commit a5041a2047
4 changed files with 130 additions and 91 deletions

View File

@@ -96,14 +96,12 @@ import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.SwipeHelper;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.media.KeyguardMediaController;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEventListener;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.DragDownHelper.DragDownCallback;
import com.android.systemui.statusbar.EmptyShadeView;
@@ -145,7 +143,6 @@ import com.android.systemui.statusbar.notification.row.StackScrollerDecorView;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.LockscreenGestureLogger.LockscreenUiEvent;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
@@ -192,10 +189,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
* gap is drawn between them). In this case we don't want to round their corners.
*/
private static final int DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX = 1;
private final KeyguardBypassController mKeyguardBypassController;
private KeyguardBypassEnabledProvider mKeyguardBypassEnabledProvider;
private final DynamicPrivacyController mDynamicPrivacyController;
private final SysuiStatusBarStateController mStatusbarStateController;
private final KeyguardMediaController mKeyguardMediaController;
private ExpandHelper mExpandHelper;
private final NotificationSwipeHelper mSwipeHelper;
@@ -507,7 +503,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
protected final UiEventLogger mUiEventLogger;
private final NotificationRemoteInputManager mRemoteInputManager =
Dependency.get(NotificationRemoteInputManager.class);
private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class);
private final DisplayMetrics mDisplayMetrics = Dependency.get(DisplayMetrics.class);
private final LockscreenGestureLogger mLockscreenGestureLogger =
@@ -532,11 +527,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private int mWaterfallTopInset;
private NotificationStackScrollLayoutController mController;
private SysuiColorExtractor.OnColorsChangedListener mOnColorsChangedListener =
(colorExtractor, which) -> {
final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
updateDecorViews(useDarkText);
};
private boolean mKeyguardMediaControllorVisible;
private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener =
new ExpandableView.OnHeightChangedListener() {
@@ -587,8 +578,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
DynamicPrivacyController dynamicPrivacyController,
SysuiStatusBarStateController statusbarStateController,
HeadsUpManagerPhone headsUpManager,
KeyguardBypassController keyguardBypassController,
KeyguardMediaController keyguardMediaController,
FalsingManager falsingManager,
NotificationLockscreenUserManager notificationLockscreenUserManager,
NotificationGutsManager notificationGutsManager,
@@ -610,7 +599,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mNotificationGutsManager = notificationGutsManager;
mHeadsUpManager = headsUpManager;
mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed);
mKeyguardBypassController = keyguardBypassController;
mFalsingManager = falsingManager;
mFgsSectionController = fgsSectionController;
@@ -634,7 +622,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mSwipeHelper = new NotificationSwipeHelper(SwipeHelper.X, mNotificationCallback,
getContext(), mMenuEventListener, mFalsingManager);
mStackScrollAlgorithm = createStackScrollAlgorithm(context);
initView(context);
mShouldDrawNotificationBackground =
res.getBoolean(R.bool.config_drawNotificationBackground);
mFadeNotificationsOnDismiss =
@@ -692,17 +679,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mStatusbarStateController = statusbarStateController;
initializeForegroundServiceSection(fgsFeatureController);
mUiEventLogger = uiEventLogger;
mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener);
mKeyguardMediaController = keyguardMediaController;
keyguardMediaController.setVisibilityChangedListener((visible) -> {
if (visible) {
generateAddAnimation(keyguardMediaController.getView(), false /*fromMoreCard */);
} else {
generateRemoveAnimation(keyguardMediaController.getView());
}
requestChildrenUpdate();
return null;
});
}
private void initializeForegroundServiceSection(
@@ -741,7 +717,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
public float getWakeUpHeight() {
ExpandableView firstChild = getFirstChildWithBackground();
if (firstChild != null) {
if (mKeyguardBypassController.getBypassEnabled()) {
if (mKeyguardBypassEnabledProvider.getBypassEnabled()) {
return firstChild.getHeadsUpHeightWithoutHeader();
} else {
return firstChild.getCollapsedHeight();
@@ -816,21 +792,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
};
}
@Override
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void onAttachedToWindow() {
super.onAttachedToWindow();
((SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class))
.addCallback(mStateListener, SysuiStatusBarStateController.RANK_STACK_SCROLLER);
}
@Override
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Dependency.get(StatusBarStateController.class).removeCallback(mStateListener);
}
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public NotificationSwipeActionHelper getSwipeActionHelper() {
return mSwipeHelper;
@@ -920,7 +881,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
}
boolean shouldDrawBackground;
if (mKeyguardBypassController.getBypassEnabled() && onKeyguard()) {
if (mKeyguardBypassEnabledProvider.getBypassEnabled() && onKeyguard()) {
shouldDrawBackground = isPulseExpanding();
} else {
shouldDrawBackground = !mAmbientState.isDozing() || anySectionHasVisibleChild;
@@ -1035,9 +996,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
}
private void reinitView() {
initView(getContext(), mKeyguardBypassEnabledProvider);
}
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void initView(Context context) {
void initView(Context context,
KeyguardBypassEnabledProvider keyguardBypassEnabledProvider) {
mScroller = new OverScroller(getContext());
mKeyguardBypassEnabledProvider = keyguardBypassEnabledProvider;
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setClipChildren(false);
final ViewConfiguration configuration = ViewConfiguration.get(context);
@@ -1309,7 +1277,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void requestChildrenUpdate() {
void requestChildrenUpdate() {
if (!mChildrenUpdateRequested) {
getViewTreeObserver().addOnPreDrawListener(mChildrenUpdater);
mChildrenUpdateRequested = true;
@@ -1439,7 +1407,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private void notifyAppearChangedListeners() {
float appear;
float expandAmount;
if (mKeyguardBypassController.getBypassEnabled() && onKeyguard()) {
if (mKeyguardBypassEnabledProvider.getBypassEnabled() && onKeyguard()) {
appear = calculateAppearFractionBypass();
expandAmount = getPulseHeight();
} else {
@@ -1841,7 +1809,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mSwipeHelper.setDensityScale(densityScale);
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
initView(getContext());
reinitView();
}
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
@@ -2689,7 +2657,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
boolean shiftPulsingWithFirst = mHeadsUpManager.getAllEntries().count() <= 1
&& (mAmbientState.isDozing()
|| (mKeyguardBypassController.getBypassEnabled() && onKeyguard));
|| (mKeyguardBypassEnabledProvider.getBypassEnabled() && onKeyguard));
for (NotificationSection section : mSections) {
int minBottomPosition = minTopPosition;
if (section == lastSection) {
@@ -2960,7 +2928,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
} else {
mTopPaddingOverflow = 0;
}
setTopPadding(topPadding, animate && !mKeyguardBypassController.getBypassEnabled());
setTopPadding(topPadding, animate && !mKeyguardBypassEnabledProvider.getBypassEnabled());
setExpandedHeight(mExpandedHeight);
}
@@ -3118,7 +3086,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
* @return Whether an animation was generated.
*/
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private boolean generateRemoveAnimation(ExpandableView child) {
boolean generateRemoveAnimation(ExpandableView child) {
if (removeRemovedChildFromHeadsUpChangeAnimations(child)) {
mAddedHeadsUpChildren.remove(child);
return false;
@@ -3355,7 +3323,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
@ShadeViewRefactor(RefactorComponent.COORDINATOR)
void onViewAddedInternal(ExpandableView child) {
private void onViewAddedInternal(ExpandableView child) {
updateHideSensitiveForChild(child);
child.setOnHeightChangedListener(mOnChildHeightChangedListener);
generateAddAnimation(child, false /* fromMoreCard */);
@@ -3385,6 +3353,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
onViewRemovedInternal(row, childrenContainer);
}
public void notifyGroupChildAdded(ExpandableView row) {
onViewAddedInternal(row);
}
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setAnimationsEnabled(boolean animationsEnabled) {
mAnimationsEnabled = animationsEnabled;
@@ -3557,7 +3529,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
boolean performDisappearAnimation = !mIsExpanded
// Only animate if we still have pinned heads up, otherwise we just have the
// regular collapse animation of the lock screen
|| (mKeyguardBypassController.getBypassEnabled() && onKeyguard()
|| (mKeyguardBypassEnabledProvider.getBypassEnabled() && onKeyguard()
&& mHeadsUpManager.hasPinnedHeadsUp());
if (performDisappearAnimation && !isHeadsUp) {
type = row.wasJustClicked()
@@ -4927,7 +4899,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
// Since we are clipping to the outline we need to make sure that the shadows aren't
// clipped when pulsing
float ownTranslationZ = 0;
if (mKeyguardBypassController.getBypassEnabled() && mAmbientState.isHiddenAtAll()) {
if (mKeyguardBypassEnabledProvider.getBypassEnabled() && mAmbientState.isHiddenAtAll()) {
ExpandableView firstChildNotGone = getFirstChildNotGone();
if (firstChildNotGone != null && firstChildNotGone.showingPulsing()) {
ownTranslationZ = firstChildNotGone.getTranslationZ();
@@ -5093,7 +5065,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void requestAnimateEverything() {
void requestAnimateEverything() {
if (mIsExpanded && mAnimationsEnabled) {
mEverythingNeedsAnimation = true;
mNeedsAnimation = true;
@@ -5431,9 +5403,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mAmbientState.setStatusBarState(statusBarState);
}
private void onStatePostChange() {
void onStatePostChange() {
boolean onKeyguard = onKeyguard();
mAmbientState.setActivatedChild(null);
mAmbientState.setDimmed(onKeyguard);
if (mHeadsUpAppearanceController != null) {
mHeadsUpAppearanceController.onStateChanged();
}
@@ -5771,7 +5747,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
*/
public float setPulseHeight(float height) {
mAmbientState.setPulseHeight(height);
if (mKeyguardBypassController.getBypassEnabled()) {
if (mKeyguardBypassEnabledProvider.getBypassEnabled()) {
notifyAppearChangedListeners();
}
requestChildrenUpdate();
@@ -6204,26 +6180,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
}
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private final StateListener mStateListener = new StateListener() {
@Override
public void onStatePreChange(int oldState, int newState) {
if (oldState == StatusBarState.SHADE_LOCKED && newState == StatusBarState.KEYGUARD) {
requestAnimateEverything();
}
}
@Override
public void onStateChanged(int newState) {
setStatusBarState(newState);
}
@Override
public void onStatePostChange() {
NotificationStackScrollLayout.this.onStatePostChange();
}
};
@VisibleForTesting
@ShadeViewRefactor(RefactorComponent.INPUT)
protected final OnMenuEventListener mMenuEventListener = new OnMenuEventListener() {
@@ -6568,6 +6524,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
NotificationLogger.getNotificationLocation(entry)));
}
public void setKeyguardMediaControllorVisible(boolean keyguardMediaControllorVisible) {
mKeyguardMediaControllorVisible = keyguardMediaControllorVisible;
}
// ---------------------- DragDownHelper.OnDragDownListener ------------------------------------
@ShadeViewRefactor(RefactorComponent.INPUT)
@@ -6576,8 +6536,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
/* Only ever called as a consequence of a lockscreen expansion gesture. */
@Override
public boolean onDraggedDown(View startingChild, int dragLengthY) {
boolean canDragDown = hasActiveNotifications()
|| mKeyguardMediaController.getView().getVisibility() == VISIBLE;
boolean canDragDown = hasActiveNotifications() || mKeyguardMediaControllorVisible;
if (mStatusBarState == StatusBarState.KEYGUARD && canDragDown) {
mLockscreenGestureLogger.write(
MetricsEvent.ACTION_LS_SHADE,
@@ -6655,7 +6614,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
@Override
public boolean isDragDownAnywhereEnabled() {
return mStatusbarStateController.getState() == StatusBarState.KEYGUARD
&& !mKeyguardBypassController.getBypassEnabled();
&& !mKeyguardBypassEnabledProvider.getBypassEnabled();
}
};
@@ -6838,4 +6797,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
return INVALID;
}
}
interface KeyguardBypassEnabledProvider {
boolean getBypassEnabled();
}
}

View File

@@ -27,9 +27,14 @@ import android.view.WindowInsets;
import android.widget.FrameLayout;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.media.KeyguardMediaController;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.ActivityLaunchAnimator;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
@@ -42,6 +47,7 @@ import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -57,6 +63,8 @@ import java.util.function.BiConsumer;
import javax.inject.Inject;
import javax.inject.Named;
import kotlin.Unit;
/**
* Controller for {@link NotificationStackScrollLayout}.
*/
@@ -70,9 +78,15 @@ public class NotificationStackScrollLayoutController {
private final DynamicPrivacyController mDynamicPrivacyController;
private final ConfigurationController mConfigurationController;
private final ZenModeController mZenModeController;
private final KeyguardMediaController mKeyguardMediaController;
private final SysuiStatusBarStateController mStatusBarStateController;
private final KeyguardBypassController mKeyguardBypassController;
private final SysuiColorExtractor mColorExtractor;
private NotificationStackScrollLayout mView;
private final NotificationListContainerImpl mNotificationListContainer =
new NotificationListContainerImpl();
private NotificationStackScrollLayout mView;
@VisibleForTesting
final View.OnAttachStateChangeListener mOnAttachStateChangeListener =
@@ -80,11 +94,14 @@ public class NotificationStackScrollLayoutController {
@Override
public void onViewAttachedToWindow(View v) {
mConfigurationController.addCallback(mConfigurationListener);
mStatusBarStateController.addCallback(
mStateListener, SysuiStatusBarStateController.RANK_STACK_SCROLLER);
}
@Override
public void onViewDetachedFromWindow(View v) {
mConfigurationController.removeCallback(mConfigurationListener);
mStatusBarStateController.removeCallback(mStateListener);
}
};
@@ -124,6 +141,27 @@ public class NotificationStackScrollLayoutController {
}
};
private final StatusBarStateController.StateListener mStateListener =
new StatusBarStateController.StateListener() {
@Override
public void onStatePreChange(int oldState, int newState) {
if (oldState == StatusBarState.SHADE_LOCKED
&& newState == StatusBarState.KEYGUARD) {
mView.requestAnimateEverything();
}
}
@Override
public void onStateChanged(int newState) {
mView.setStatusBarState(newState);
}
@Override
public void onStatePostChange() {
mView.onStatePostChange();
}
};
@Inject
public NotificationStackScrollLayoutController(
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
@@ -133,7 +171,11 @@ public class NotificationStackScrollLayoutController {
TunerService tunerService,
DynamicPrivacyController dynamicPrivacyController,
ConfigurationController configurationController,
ZenModeController zenModeController) {
SysuiStatusBarStateController statusBarStateController,
KeyguardMediaController keyguardMediaController,
KeyguardBypassController keyguardBypassController,
ZenModeController zenModeController,
SysuiColorExtractor colorExtractor) {
mAllowLongPress = allowLongPress;
mNotificationGutsManager = notificationGutsManager;
mHeadsUpManager = headsUpManager;
@@ -141,12 +183,17 @@ public class NotificationStackScrollLayoutController {
mTunerService = tunerService;
mDynamicPrivacyController = dynamicPrivacyController;
mConfigurationController = configurationController;
mStatusBarStateController = statusBarStateController;
mKeyguardMediaController = keyguardMediaController;
mKeyguardBypassController = keyguardBypassController;
mZenModeController = zenModeController;
mColorExtractor = colorExtractor;
}
public void attach(NotificationStackScrollLayout view) {
mView = view;
mView.setController(this);
mView.initView(mView.getContext(), mKeyguardBypassController::getBypassEnabled);
if (mAllowLongPress) {
mView.setLongPressListener(mNotificationGutsManager::openGuts);
@@ -169,6 +216,23 @@ public class NotificationStackScrollLayoutController {
Settings.Secure.NOTIFICATION_DISMISS_RTL,
Settings.Secure.NOTIFICATION_HISTORY_ENABLED);
mColorExtractor.addOnColorsChangedListener((colorExtractor, which) -> {
final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
mView.updateDecorViews(useDarkText);
});
mKeyguardMediaController.setVisibilityChangedListener(visible -> {
mView.setKeyguardMediaControllorVisible(visible);
if (visible) {
mView.generateAddAnimation(
mKeyguardMediaController.getView(), false /*fromMoreCard */);
} else {
mView.generateRemoveAnimation(mKeyguardMediaController.getView());
}
mView.requestChildrenUpdate();
return Unit.INSTANCE;
});
if (mView.isAttachedToWindow()) {
mOnAttachStateChangeListener.onViewAttachedToWindow(mView);
}
@@ -650,7 +714,7 @@ public class NotificationStackScrollLayoutController {
@Override
public void notifyGroupChildAdded(ExpandableView row) {
mView.onViewAddedInternal(row);
mView.notifyGroupChildAdded(row);
}
@Override

View File

@@ -87,15 +87,13 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.FooterView;
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
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.HeadsUpManager;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.leak.LeakDetector;
import org.junit.After;
@@ -136,7 +134,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
@Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private MetricsLogger mMetricsLogger;
@Mock private NotificationRoundnessManager mNotificationRoundnessManager;
@Mock private KeyguardBypassController mKeyguardBypassController;
@Mock private KeyguardBypassEnabledProvider mKeyguardBypassEnabledProvider;
@Mock private NotificationSectionsManager mNotificationSectionsManager;
@Mock private NotificationSection mNotificationSection;
@Mock private NotificationLockscreenUserManager mLockscreenUserManager;
@@ -219,8 +217,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
mock(DynamicPrivacyController.class),
mStatusBarStateController,
mHeadsUpManager,
mKeyguardBypassController,
mKeyguardMediaController,
new FalsingManagerFake(),
mLockscreenUserManager,
mock(NotificationGutsManager.class),
@@ -233,6 +229,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
mock(NotifCollection.class),
mUiEventLoggerFake
);
mStackScrollerInternal.initView(getContext(), mKeyguardBypassEnabledProvider);
verify(mLockscreenUserManager).addUserChangedListener(userChangedCaptor.capture());
mUserChangedListener = userChangedCaptor.getValue();
mStackScroller = spy(mStackScrollerInternal);

View File

@@ -16,10 +16,9 @@
package com.android.systemui.statusbar.notification.stack;
import static com.android.systemui.statusbar.notification.ViewGroupFadeHelper.reset;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -28,9 +27,13 @@ import android.testing.AndroidTestingRunner;
import androidx.test.filters.SmallTest;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.media.KeyguardMediaController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
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.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.tuner.TunerService;
@@ -64,6 +67,14 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
private NotificationStackScrollLayout mNotificationStackScrollLayout;
@Mock
private ZenModeController mZenModeController;
@Mock
private KeyguardMediaController mKeyguardMediaController;
@Mock
private SysuiStatusBarStateController mSysuiStatusBarStateController;
@Mock
private KeyguardBypassController mKeyguardBypassController;
@Mock
private SysuiColorExtractor mColorExtractor;
NotificationStackScrollLayoutController mController;
@@ -79,7 +90,11 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
mTunerService,
mDynamicPrivacyController,
mConfigurationController,
mZenModeController
mSysuiStatusBarStateController,
mKeyguardMediaController,
mKeyguardBypassController,
mZenModeController,
mColorExtractor
);
when(mNotificationStackScrollLayout.isAttachedToWindow()).thenReturn(true);