Merge "[Dagger] Remove the simple Dependency.get calls from StatusBarNotificationPresenter." into sc-v2-dev am: 77ad908581
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15549408 Change-Id: If885ed737e3abf3a0e971c034d2dbc9e42b5165a
This commit is contained in:
@@ -1512,14 +1512,32 @@ public class StatusBar extends SystemUI implements
|
||||
);
|
||||
|
||||
// TODO: inject this.
|
||||
mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanelViewController,
|
||||
mHeadsUpManager, mNotificationShadeWindowView, mStackScrollerController,
|
||||
mDozeScrimController, mScrimController, mNotificationShadeWindowController,
|
||||
mDynamicPrivacyController, mKeyguardStateController,
|
||||
mPresenter = new StatusBarNotificationPresenter(
|
||||
mContext,
|
||||
mNotificationPanelViewController,
|
||||
mHeadsUpManager,
|
||||
mNotificationShadeWindowView,
|
||||
mStackScrollerController,
|
||||
mDozeScrimController,
|
||||
mScrimController,
|
||||
mNotificationShadeWindowController,
|
||||
mDynamicPrivacyController,
|
||||
mKeyguardStateController,
|
||||
mKeyguardIndicationController,
|
||||
this /* statusBar */, mShadeController,
|
||||
mLockscreenShadeTransitionController, mCommandQueue, mInitController,
|
||||
mNotificationInterruptStateProvider);
|
||||
this /* statusBar */,
|
||||
mShadeController,
|
||||
mLockscreenShadeTransitionController,
|
||||
mCommandQueue,
|
||||
mViewHierarchyManager,
|
||||
mLockscreenUserManager,
|
||||
mStatusBarStateController,
|
||||
mMediaManager,
|
||||
mGutsManager,
|
||||
mKeyguardUpdateMonitor,
|
||||
mInitController,
|
||||
mNotificationInterruptStateProvider,
|
||||
mRemoteInputManager,
|
||||
mConfigurationController);
|
||||
|
||||
mNotificationShelfController.setOnActivatedListener(mPresenter);
|
||||
mRemoteInputManager.addControllerCallback(mNotificationShadeWindowController);
|
||||
|
||||
@@ -47,7 +47,6 @@ import com.android.systemui.InitController;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.KeyguardIndicationController;
|
||||
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
|
||||
@@ -65,7 +64,6 @@ import com.android.systemui.statusbar.notification.NotificationEntryListener;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
|
||||
import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider;
|
||||
import com.android.systemui.statusbar.notification.interruption.NotificationInterruptSuppressor;
|
||||
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
||||
@@ -92,20 +90,14 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
|
||||
private final ActivityStarter mActivityStarter = Dependency.get(ActivityStarter.class);
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
private final NotificationViewHierarchyManager mViewHierarchyManager =
|
||||
Dependency.get(NotificationViewHierarchyManager.class);
|
||||
private final NotificationLockscreenUserManager mLockscreenUserManager =
|
||||
Dependency.get(NotificationLockscreenUserManager.class);
|
||||
private final SysuiStatusBarStateController mStatusBarStateController =
|
||||
(SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class);
|
||||
private final NotificationViewHierarchyManager mViewHierarchyManager;
|
||||
private final NotificationLockscreenUserManager mLockscreenUserManager;
|
||||
private final SysuiStatusBarStateController mStatusBarStateController;
|
||||
private final NotificationEntryManager mEntryManager =
|
||||
Dependency.get(NotificationEntryManager.class);
|
||||
private final NotificationMediaManager mMediaManager =
|
||||
Dependency.get(NotificationMediaManager.class);
|
||||
private final VisualStabilityManager mVisualStabilityManager =
|
||||
Dependency.get(VisualStabilityManager.class);
|
||||
private final NotificationGutsManager mGutsManager =
|
||||
Dependency.get(NotificationGutsManager.class);
|
||||
private final NotificationMediaManager mMediaManager;
|
||||
private final NotificationGutsManager mGutsManager;
|
||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||
|
||||
private final NotificationPanelViewController mNotificationPanel;
|
||||
private final HeadsUpManagerPhone mHeadsUpManager;
|
||||
@@ -144,8 +136,16 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
ShadeController shadeController,
|
||||
LockscreenShadeTransitionController shadeTransitionController,
|
||||
CommandQueue commandQueue,
|
||||
NotificationViewHierarchyManager notificationViewHierarchyManager,
|
||||
NotificationLockscreenUserManager lockscreenUserManager,
|
||||
SysuiStatusBarStateController sysuiStatusBarStateController,
|
||||
NotificationMediaManager notificationMediaManager,
|
||||
NotificationGutsManager notificationGutsManager,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
InitController initController,
|
||||
NotificationInterruptStateProvider notificationInterruptStateProvider) {
|
||||
NotificationInterruptStateProvider notificationInterruptStateProvider,
|
||||
NotificationRemoteInputManager remoteInputManager,
|
||||
ConfigurationController configurationController) {
|
||||
mKeyguardStateController = keyguardStateController;
|
||||
mNotificationPanel = panel;
|
||||
mHeadsUpManager = headsUp;
|
||||
@@ -156,6 +156,12 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
mShadeController = shadeController;
|
||||
mShadeTransitionController = shadeTransitionController;
|
||||
mCommandQueue = commandQueue;
|
||||
mViewHierarchyManager = notificationViewHierarchyManager;
|
||||
mLockscreenUserManager = lockscreenUserManager;
|
||||
mStatusBarStateController = sysuiStatusBarStateController;
|
||||
mMediaManager = notificationMediaManager;
|
||||
mGutsManager = notificationGutsManager;
|
||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||
mAboveShelfObserver = new AboveShelfObserver(stackScrollerController.getView());
|
||||
mNotificationShadeWindowController = notificationShadeWindowController;
|
||||
mAboveShelfObserver.setListener(statusBarWindow.findViewById(
|
||||
@@ -176,8 +182,6 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
Slog.e(TAG, "Failed to register VR mode state listener: " + e);
|
||||
}
|
||||
}
|
||||
NotificationRemoteInputManager remoteInputManager =
|
||||
Dependency.get(NotificationRemoteInputManager.class);
|
||||
remoteInputManager.setUpWithCallback(
|
||||
Dependency.get(NotificationRemoteInputManager.Callback.class),
|
||||
mNotificationPanel.createRemoteInputDelegate());
|
||||
@@ -220,14 +224,14 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
|
||||
onUserSwitched(mLockscreenUserManager.getCurrentUserId());
|
||||
});
|
||||
Dependency.get(ConfigurationController.class).addCallback(this);
|
||||
configurationController.addCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
MessagingMessage.dropCache();
|
||||
MessagingGroup.dropCache();
|
||||
if (!Dependency.get(KeyguardUpdateMonitor.class).isSwitchingUser()) {
|
||||
if (!mKeyguardUpdateMonitor.isSwitchingUser()) {
|
||||
updateNotificationsOnDensityOrFontScaleChanged();
|
||||
} else {
|
||||
mReinflateNotificationsOnUserSwitched = true;
|
||||
@@ -236,7 +240,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
|
||||
@Override
|
||||
public void onUiModeChanged() {
|
||||
if (!Dependency.get(KeyguardUpdateMonitor.class).isSwitchingUser()) {
|
||||
if (!mKeyguardUpdateMonitor.isSwitchingUser()) {
|
||||
updateNotificationOnUiModeChanged();
|
||||
} else {
|
||||
mDispatchUiModeChangeOnUserSwitched = true;
|
||||
|
||||
@@ -34,6 +34,7 @@ import androidx.test.filters.SmallTest;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.logging.testing.FakeMetricsLogger;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.ForegroundServiceNotificationListener;
|
||||
import com.android.systemui.InitController;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
@@ -51,7 +52,6 @@ import com.android.systemui.statusbar.notification.DynamicPrivacyController;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
|
||||
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
|
||||
import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider;
|
||||
import com.android.systemui.statusbar.notification.interruption.NotificationInterruptSuppressor;
|
||||
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
||||
@@ -59,6 +59,7 @@ import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -86,22 +87,13 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
NotificationRemoteInputManager notificationRemoteInputManager =
|
||||
mock(NotificationRemoteInputManager.class);
|
||||
mMetricsLogger = new FakeMetricsLogger();
|
||||
mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger);
|
||||
mCommandQueue = new CommandQueue(mContext);
|
||||
mDependency.injectTestDependency(StatusBarStateController.class,
|
||||
mock(SysuiStatusBarStateController.class));
|
||||
mDependency.injectTestDependency(ShadeController.class, mShadeController);
|
||||
mDependency.injectTestDependency(NotificationRemoteInputManager.class,
|
||||
notificationRemoteInputManager);
|
||||
mDependency.injectMockDependency(NotificationViewHierarchyManager.class);
|
||||
mDependency.injectMockDependency(NotificationRemoteInputManager.Callback.class);
|
||||
mDependency.injectMockDependency(NotificationLockscreenUserManager.class);
|
||||
mDependency.injectMockDependency(NotificationMediaManager.class);
|
||||
mDependency.injectMockDependency(VisualStabilityManager.class);
|
||||
mDependency.injectMockDependency(NotificationGutsManager.class);
|
||||
mDependency.injectMockDependency(NotificationShadeWindowController.class);
|
||||
mDependency.injectMockDependency(ForegroundServiceNotificationListener.class);
|
||||
NotificationEntryManager entryManager =
|
||||
@@ -126,8 +118,17 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase {
|
||||
mock(KeyguardStateController.class),
|
||||
mock(KeyguardIndicationController.class), mStatusBar,
|
||||
mock(ShadeControllerImpl.class), mock(LockscreenShadeTransitionController.class),
|
||||
mCommandQueue, mInitController,
|
||||
mNotificationInterruptStateProvider);
|
||||
mCommandQueue,
|
||||
mock(NotificationViewHierarchyManager.class),
|
||||
mock(NotificationLockscreenUserManager.class),
|
||||
mock(SysuiStatusBarStateController.class),
|
||||
mock(NotificationMediaManager.class),
|
||||
mock(NotificationGutsManager.class),
|
||||
mock(KeyguardUpdateMonitor.class),
|
||||
mInitController,
|
||||
mNotificationInterruptStateProvider,
|
||||
mock(NotificationRemoteInputManager.class),
|
||||
mock(ConfigurationController.class));
|
||||
mInitController.executePostInitTasks();
|
||||
ArgumentCaptor<NotificationInterruptSuppressor> suppressorCaptor =
|
||||
ArgumentCaptor.forClass(NotificationInterruptSuppressor.class);
|
||||
|
||||
Reference in New Issue
Block a user