Remove subclasses of NotificationEntryManager
First, moves most of the notification initialization logic out of
StatusBar and into NotificationController.
There is only one subclass of NotificationEntryManager in this project:
- CarNotificationEntryManager: stub implementation that disables most
functionality.
Removes CarNotificationEntryManager. Adds a config boolean to disable
notification rendering instead. Skips most notif initialization logic if
this flag is false.
Change-Id: I23ed86efa209f43314c162dcf32fe97112de7bc7
Test: atest, manual
diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml
index e2297e4..d2f514c 100644
--- a/packages/CarSystemUI/res/values/config.xml
+++ b/packages/CarSystemUI/res/values/config.xml
@@ -29,6 +29,9 @@
<bool name="config_enableRightNavigationBar">false</bool>
<bool name="config_enableBottomNavigationBar">true</bool>
+ <!-- Disable normal notification rendering; we handle that ourselves -->
+ <bool name="config_renderNotifications">false</bool>
+
<!-- Whether heads-up notifications should be shown when shade is open. -->
<bool name="config_enableHeadsUpNotificationWhenNotificationShadeOpen">true</bool>
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index cf4ee7d..585acfe 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -22,7 +22,6 @@
import android.content.Context;
import com.android.systemui.car.CarDeviceProvisionedControllerImpl;
-import com.android.systemui.car.CarNotificationEntryManager;
import com.android.systemui.car.CarNotificationInterruptionStateProvider;
import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.dock.DockManager;
@@ -73,13 +72,6 @@
return false;
}
- /**
- * Use {@link CarNotificationEntryManager}, which does nothing when adding a notification.
- */
- @Binds
- abstract NotificationEntryManager bindNotificationEntryManager(
- CarNotificationEntryManager notificationEntryManager);
-
@Singleton
@Provides
static HeadsUpManagerPhone provideHeadsUpManagerPhone(Context context,
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java b/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java
deleted file mode 100644
index cfe1c70..0000000
--- a/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * 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
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.systemui.car;
-
-import android.service.notification.NotificationListenerService;
-import android.service.notification.StatusBarNotification;
-
-import com.android.systemui.statusbar.FeatureFlags;
-import com.android.systemui.statusbar.NotificationRemoteInputManager;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
-import com.android.systemui.statusbar.notification.collection.NotificationRankingManager;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
-import com.android.systemui.statusbar.notification.logging.NotifLog;
-import com.android.systemui.statusbar.phone.NotificationGroupManager;
-import com.android.systemui.util.leak.LeakDetector;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import dagger.Lazy;
-
-/**
- * Car specific notification entry manager that does nothing when adding a notification.
- *
- * <p> This is because system UI notifications are disabled and we have a different implementation.
- * Please see {@link com.android.car.notification}.
- */
-@Singleton
-public class CarNotificationEntryManager extends NotificationEntryManager {
-
- @Inject
- public CarNotificationEntryManager(
- NotifLog notifLog,
- NotificationGroupManager groupManager,
- NotificationRankingManager rankingManager,
- KeyguardEnvironment keyguardEnvironment,
- FeatureFlags featureFlags,
- Lazy<NotificationRowBinder> notificationRowBinderLazy,
- Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy,
- LeakDetector leakDetector) {
- super(notifLog, groupManager, rankingManager, keyguardEnvironment, featureFlags,
- notificationRowBinderLazy, notificationRemoteInputManagerLazy, leakDetector);
- }
-
- @Override
- public void addNotification(
- StatusBarNotification notification, NotificationListenerService.RankingMap ranking) {
- }
-}
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 76e9ec6..210dd32 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -87,10 +87,8 @@
import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.NavigationBarController;
-import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -103,12 +101,10 @@
import com.android.systemui.statusbar.notification.BypassHeadsUpNotifier;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
-import com.android.systemui.statusbar.notification.collection.init.NotifPipelineInitializer;
+import com.android.systemui.statusbar.notification.init.NotificationsController;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -124,7 +120,6 @@
import com.android.systemui.statusbar.phone.LightsOutNotifController;
import com.android.systemui.statusbar.phone.LockscreenLockIconController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
-import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -141,7 +136,6 @@
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
-import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.volume.VolumeComponent;
@@ -257,7 +251,7 @@
public CarStatusBar(
Context context,
- FeatureFlags featureFlags,
+ NotificationsController notificationsController,
LightBarController lightBarController,
AutoHideController autoHideController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -269,13 +263,11 @@
HeadsUpManagerPhone headsUpManagerPhone,
DynamicPrivacyController dynamicPrivacyController,
BypassHeadsUpNotifier bypassHeadsUpNotifier,
- Lazy<NotifPipelineInitializer> notifPipelineInitializer,
FalsingManager falsingManager,
BroadcastDispatcher broadcastDispatcher,
RemoteInputQuickSettingsDisabler remoteInputQuickSettingsDisabler,
NotificationGutsManager notificationGutsManager,
NotificationLogger notificationLogger,
- NotificationEntryManager notificationEntryManager,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
NotificationViewHierarchyManager notificationViewHierarchyManager,
KeyguardViewMediator keyguardViewMediator,
@@ -296,12 +288,10 @@
VibratorHelper vibratorHelper,
BubbleController bubbleController,
NotificationGroupManager groupManager,
- NotificationGroupAlertTransferHelper groupAlertTransferHelper,
VisualStabilityManager visualStabilityManager,
DeviceProvisionedController deviceProvisionedController,
NavigationBarController navigationBarController,
Lazy<AssistManager> assistManagerLazy,
- NotificationListener notificationListener,
ConfigurationController configurationController,
NotificationShadeWindowController notificationShadeWindowController,
LockscreenLockIconController lockscreenLockIconController,
@@ -318,7 +308,6 @@
Optional<Recents> recents,
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
PluginManager pluginManager,
- RemoteInputUriController remoteInputUriController,
Optional<Divider> dividerOptional,
SuperStatusBarViewFactory superStatusBarViewFactory,
LightsOutNotifController lightsOutNotifController,
@@ -334,7 +323,6 @@
KeyguardDismissUtil keyguardDismissUtil,
ExtensionController extensionController,
UserInfoControllerImpl userInfoControllerImpl,
- NotificationRowBinderImpl notificationRowBinder,
DismissCallbackRegistry dismissCallbackRegistry,
/* Car Settings injected components. */
CarServiceProvider carServiceProvider,
@@ -345,7 +333,7 @@
FlingAnimationUtils.Builder flingAnimationUtilsBuilder) {
super(
context,
- featureFlags,
+ notificationsController,
lightBarController,
autoHideController,
keyguardUpdateMonitor,
@@ -357,13 +345,11 @@
headsUpManagerPhone,
dynamicPrivacyController,
bypassHeadsUpNotifier,
- notifPipelineInitializer,
falsingManager,
broadcastDispatcher,
remoteInputQuickSettingsDisabler,
notificationGutsManager,
notificationLogger,
- notificationEntryManager,
notificationInterruptionStateProvider,
notificationViewHierarchyManager,
keyguardViewMediator,
@@ -384,12 +370,10 @@
vibratorHelper,
bubbleController,
groupManager,
- groupAlertTransferHelper,
visualStabilityManager,
deviceProvisionedController,
navigationBarController,
assistManagerLazy,
- notificationListener,
configurationController,
notificationShadeWindowController,
lockscreenLockIconController,
@@ -407,7 +391,6 @@
recents,
statusBarComponentBuilder,
pluginManager,
- remoteInputUriController,
dividerOptional,
lightsOutNotifController,
statusBarNotificationActivityStarterBuilder,
@@ -422,7 +405,6 @@
keyguardDismissUtil,
extensionController,
userInfoControllerImpl,
- notificationRowBinder,
dismissCallbackRegistry);
mUserSwitcherController = userSwitcherController;
mScrimController = scrimController;
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java
index 45da822..498bd87 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java
@@ -47,10 +47,8 @@
import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.NavigationBarController;
-import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -63,12 +61,10 @@
import com.android.systemui.statusbar.notification.BypassHeadsUpNotifier;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
-import com.android.systemui.statusbar.notification.collection.init.NotifPipelineInitializer;
+import com.android.systemui.statusbar.notification.init.NotificationsController;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -83,7 +79,6 @@
import com.android.systemui.statusbar.phone.LightsOutNotifController;
import com.android.systemui.statusbar.phone.LockscreenLockIconController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
-import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -99,7 +94,6 @@
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
-import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.volume.VolumeComponent;
@@ -127,7 +121,7 @@
@Singleton
static CarStatusBar provideStatusBar(
Context context,
- FeatureFlags featureFlags,
+ NotificationsController notificationsController,
LightBarController lightBarController,
AutoHideController autoHideController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -139,13 +133,11 @@
HeadsUpManagerPhone headsUpManagerPhone,
DynamicPrivacyController dynamicPrivacyController,
BypassHeadsUpNotifier bypassHeadsUpNotifier,
- Lazy<NotifPipelineInitializer> notifPipelineInitializer,
FalsingManager falsingManager,
BroadcastDispatcher broadcastDispatcher,
RemoteInputQuickSettingsDisabler remoteInputQuickSettingsDisabler,
NotificationGutsManager notificationGutsManager,
NotificationLogger notificationLogger,
- NotificationEntryManager notificationEntryManager,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
NotificationViewHierarchyManager notificationViewHierarchyManager,
KeyguardViewMediator keyguardViewMediator,
@@ -166,12 +158,10 @@
VibratorHelper vibratorHelper,
BubbleController bubbleController,
NotificationGroupManager groupManager,
- NotificationGroupAlertTransferHelper groupAlertTransferHelper,
VisualStabilityManager visualStabilityManager,
DeviceProvisionedController deviceProvisionedController,
NavigationBarController navigationBarController,
Lazy<AssistManager> assistManagerLazy,
- NotificationListener notificationListener,
ConfigurationController configurationController,
NotificationShadeWindowController notificationShadeWindowController,
LockscreenLockIconController lockscreenLockIconController,
@@ -188,7 +178,6 @@
Optional<Recents> recentsOptional,
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
PluginManager pluginManager,
- RemoteInputUriController remoteInputUriController,
Optional<Divider> dividerOptional,
SuperStatusBarViewFactory superStatusBarViewFactory,
LightsOutNotifController lightsOutNotifController,
@@ -204,7 +193,6 @@
KeyguardDismissUtil keyguardDismissUtil,
ExtensionController extensionController,
UserInfoControllerImpl userInfoControllerImpl,
- NotificationRowBinderImpl notificationRowBinder,
DismissCallbackRegistry dismissCallbackRegistry,
CarServiceProvider carServiceProvider,
Lazy<PowerManagerHelper> powerManagerHelperLazy,
@@ -214,7 +202,7 @@
FlingAnimationUtils.Builder flingAnimationUtilsBuilder) {
return new CarStatusBar(
context,
- featureFlags,
+ notificationsController,
lightBarController,
autoHideController,
keyguardUpdateMonitor,
@@ -226,13 +214,11 @@
headsUpManagerPhone,
dynamicPrivacyController,
bypassHeadsUpNotifier,
- notifPipelineInitializer,
falsingManager,
broadcastDispatcher,
remoteInputQuickSettingsDisabler,
notificationGutsManager,
notificationLogger,
- notificationEntryManager,
notificationInterruptionStateProvider,
notificationViewHierarchyManager,
keyguardViewMediator,
@@ -253,12 +239,10 @@
vibratorHelper,
bubbleController,
groupManager,
- groupAlertTransferHelper,
visualStabilityManager,
deviceProvisionedController,
navigationBarController,
assistManagerLazy,
- notificationListener,
configurationController,
notificationShadeWindowController,
lockscreenLockIconController,
@@ -275,7 +259,6 @@
recentsOptional,
statusBarComponentBuilder,
pluginManager,
- remoteInputUriController,
dividerOptional,
superStatusBarViewFactory,
lightsOutNotifController,
@@ -290,7 +273,6 @@
keyguardDismissUtil,
extensionController,
userInfoControllerImpl,
- notificationRowBinder,
dismissCallbackRegistry,
carServiceProvider,
powerManagerHelperLazy,
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 2aa6d95..d72ce5e 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -328,6 +328,10 @@
<item type="id" name="action_toggle_overview"/>
+ <!-- Whether or not to show notifications to the user. If disabled, SystemUI will still be
+ registered as a notification listener, but will ignore all notification events. -->
+ <bool name="config_renderNotifications">true</bool>
+
<!-- Whether or not the gear icon on notifications should be shown. The gear is shown when the
the notification is not swiped enough to dismiss it. -->
<bool name="config_showNotificationGear">true</bool>
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index f793b3d..7b54199 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -38,6 +38,7 @@
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.people.PeopleHubModule;
import com.android.systemui.statusbar.notification.row.dagger.NotificationRowComponent;
import com.android.systemui.statusbar.phone.KeyguardLiftController;
@@ -64,6 +65,7 @@
AssistModule.class,
ConcurrencyModule.class,
LogModule.class,
+ NotificationsModule.class,
PeopleHubModule.class,
},
subcomponents = {StatusBarComponent.class, NotificationRowComponent.class})
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt
index 015c323..269a7a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/BypassHeadsUpNotifier.kt
@@ -43,10 +43,10 @@
private val headsUpManager: HeadsUpManagerPhone,
private val notificationLockscreenUserManager: NotificationLockscreenUserManager,
private val mediaManager: NotificationMediaManager,
+ private val entryManager: NotificationEntryManager,
tunerService: TunerService
) : StatusBarStateController.StateListener, NotificationMediaManager.MediaListener {
- private lateinit var entryManager: NotificationEntryManager
private var currentMediaEntry: NotificationEntry? = null
private var enabled = true
@@ -70,8 +70,7 @@
}, Settings.Secure.SHOW_MEDIA_WHEN_BYPASSING)
}
- fun setUp(entryManager: NotificationEntryManager) {
- this.entryManager = entryManager
+ fun setUp() {
mediaManager.addCallback(this)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
new file mode 100644
index 0000000..c7666e4
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.notification.dagger;
+
+import android.content.Context;
+
+import com.android.systemui.R;
+import com.android.systemui.statusbar.notification.init.NotificationsController;
+import com.android.systemui.statusbar.notification.init.NotificationsControllerImpl;
+import com.android.systemui.statusbar.notification.init.NotificationsControllerStub;
+
+import javax.inject.Singleton;
+
+import dagger.Lazy;
+import dagger.Module;
+import dagger.Provides;
+
+/** Module for classes related to the notifications data pipeline */
+@Module
+public class NotificationsModule {
+ /** Initializes the notification data pipeline (can be disabled via config). */
+ @Singleton
+ @Provides
+ static NotificationsController provideNotificationsController(
+ Context context,
+ Lazy<NotificationsControllerImpl> realController,
+ Lazy<NotificationsControllerStub> stubController) {
+ if (context.getResources().getBoolean(R.bool.config_renderNotifications)) {
+ return realController.get();
+ } else {
+ return stubController.get();
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt
new file mode 100644
index 0000000..9da8b8a3
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.notification.init
+
+import android.service.notification.StatusBarNotification
+import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption
+import com.android.systemui.statusbar.NotificationPresenter
+import com.android.systemui.statusbar.notification.NotificationActivityStarter
+import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl
+import com.android.systemui.statusbar.notification.stack.NotificationListContainer
+import com.android.systemui.statusbar.phone.StatusBar
+import java.io.FileDescriptor
+import java.io.PrintWriter
+
+/**
+ * The master controller for all notifications-related work
+ *
+ * Split into two implementations: [NotificationsControllerImpl] (most cases) and
+ * [NotificationsControllerStub] (for builds that disable notification rendering).
+ */
+interface NotificationsController {
+ fun initialize(
+ statusBar: StatusBar,
+ presenter: NotificationPresenter,
+ listContainer: NotificationListContainer,
+ notificationActivityStarter: NotificationActivityStarter,
+ bindRowCallback: NotificationRowBinderImpl.BindRowCallback
+ )
+
+ fun requestNotificationUpdate(reason: String)
+ fun resetUserExpandedStates()
+ fun setNotificationSnoozed(sbn: StatusBarNotification, snoozeOption: SnoozeOption)
+ fun getActiveNotificationsCount(): Int
+ fun setNotificationSnoozed(sbn: StatusBarNotification, hoursToSnooze: Int)
+ fun dump(fd: FileDescriptor, pw: PrintWriter, args: Array<String>, dumpTruck: Boolean)
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt
new file mode 100644
index 0000000..61e3192
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.notification.init
+
+import android.service.notification.StatusBarNotification
+import com.android.systemui.bubbles.BubbleController
+import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption
+import com.android.systemui.statusbar.FeatureFlags
+import com.android.systemui.statusbar.NotificationListener
+import com.android.systemui.statusbar.NotificationPresenter
+import com.android.systemui.statusbar.notification.NotificationActivityStarter
+import com.android.systemui.statusbar.notification.NotificationClicker
+import com.android.systemui.statusbar.notification.NotificationEntryManager
+import com.android.systemui.statusbar.notification.NotificationListController
+import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl
+import com.android.systemui.statusbar.notification.collection.init.NotifPipelineInitializer
+import com.android.systemui.statusbar.notification.stack.NotificationListContainer
+import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper
+import com.android.systemui.statusbar.phone.NotificationGroupManager
+import com.android.systemui.statusbar.phone.StatusBar
+import com.android.systemui.statusbar.policy.DeviceProvisionedController
+import com.android.systemui.statusbar.policy.HeadsUpManager
+import com.android.systemui.statusbar.policy.RemoteInputUriController
+import dagger.Lazy
+import java.io.FileDescriptor
+import java.io.PrintWriter
+import java.util.Optional
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/**
+ * Master controller for all notifications-related work
+ *
+ * At the moment exposes a number of event-handler-esque methods; these are for historical reasons.
+ * Once we migrate away from the need for such things, this class becomes primarily a place to do
+ * any initialization work that notifications require.
+ */
+@Singleton
+class NotificationsControllerImpl @Inject constructor(
+ private val featureFlags: FeatureFlags,
+ private val notificationListener: NotificationListener,
+ private val entryManager: NotificationEntryManager,
+ private val newNotifPipeline: Lazy<NotifPipelineInitializer>,
+ private val deviceProvisionedController: DeviceProvisionedController,
+ private val notificationRowBinder: NotificationRowBinderImpl,
+ private val remoteInputUriController: RemoteInputUriController,
+ private val bubbleController: BubbleController,
+ private val groupManager: NotificationGroupManager,
+ private val groupAlertTransferHelper: NotificationGroupAlertTransferHelper,
+ private val headsUpManager: HeadsUpManager
+) : NotificationsController {
+
+ override fun initialize(
+ statusBar: StatusBar,
+ presenter: NotificationPresenter,
+ listContainer: NotificationListContainer,
+ notificationActivityStarter: NotificationActivityStarter,
+ bindRowCallback: NotificationRowBinderImpl.BindRowCallback
+ ) {
+ notificationListener.registerAsSystemService()
+
+ val listController =
+ NotificationListController(
+ entryManager,
+ listContainer,
+ deviceProvisionedController)
+ listController.bind()
+
+ notificationRowBinder.setNotificationClicker(
+ NotificationClicker(
+ Optional.of(statusBar),
+ bubbleController,
+ notificationActivityStarter))
+ notificationRowBinder.setUpWithPresenter(
+ presenter,
+ listContainer,
+ headsUpManager,
+ bindRowCallback)
+
+ if (featureFlags.isNewNotifPipelineEnabled) {
+ newNotifPipeline.get().initialize(notificationListener, notificationRowBinder)
+ }
+
+ if (featureFlags.isNewNotifPipelineRenderingEnabled) {
+ // TODO
+ } else {
+ notificationRowBinder.setInflationCallback(entryManager)
+
+ remoteInputUriController.attach(entryManager)
+ groupAlertTransferHelper.bind(entryManager, groupManager)
+ headsUpManager.addListener(groupManager)
+ headsUpManager.addListener(groupAlertTransferHelper)
+ groupManager.setHeadsUpManager(headsUpManager)
+ groupAlertTransferHelper.setHeadsUpManager(headsUpManager)
+
+ entryManager.attach(notificationListener)
+ }
+ }
+
+ override fun dump(
+ fd: FileDescriptor,
+ pw: PrintWriter,
+ args: Array<String>,
+ dumpTruck: Boolean
+ ) {
+ if (dumpTruck) {
+ entryManager.dump(pw, " ")
+ }
+ groupManager.dump(fd, pw, args)
+ }
+
+ // TODO: Convert all functions below this line into listeners instead of public methods
+
+ override fun requestNotificationUpdate(reason: String) {
+ entryManager.updateNotifications(reason)
+ }
+
+ override fun resetUserExpandedStates() {
+ for (entry in entryManager.visibleNotifications) {
+ entry.resetUserExpansion()
+ }
+ }
+
+ override fun setNotificationSnoozed(sbn: StatusBarNotification, snoozeOption: SnoozeOption) {
+ if (snoozeOption.snoozeCriterion != null) {
+ notificationListener.snoozeNotification(sbn.key, snoozeOption.snoozeCriterion.id)
+ } else {
+ notificationListener.snoozeNotification(
+ sbn.key,
+ snoozeOption.minutesToSnoozeFor * 60 * 1000.toLong())
+ }
+ }
+
+ override fun getActiveNotificationsCount(): Int {
+ return entryManager.activeNotificationsCount
+ }
+
+ override fun setNotificationSnoozed(sbn: StatusBarNotification, hoursToSnooze: Int) {
+ notificationListener.snoozeNotification(
+ sbn.key,
+ hoursToSnooze * 60 * 60 * 1000.toLong())
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt
new file mode 100644
index 0000000..ded855d
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * 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
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.notification.init
+
+import android.service.notification.StatusBarNotification
+import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption
+import com.android.systemui.statusbar.NotificationListener
+import com.android.systemui.statusbar.NotificationPresenter
+import com.android.systemui.statusbar.notification.NotificationActivityStarter
+import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl
+import com.android.systemui.statusbar.notification.stack.NotificationListContainer
+import com.android.systemui.statusbar.phone.StatusBar
+import java.io.FileDescriptor
+import java.io.PrintWriter
+import javax.inject.Inject
+
+/**
+ * Implementation of [NotificationsController] that's used when notifications rendering is disabled.
+ */
+class NotificationsControllerStub @Inject constructor(
+ private val notificationListener: NotificationListener
+) : NotificationsController {
+
+ override fun initialize(
+ statusBar: StatusBar,
+ presenter: NotificationPresenter,
+ listContainer: NotificationListContainer,
+ notificationActivityStarter: NotificationActivityStarter,
+ bindRowCallback: NotificationRowBinderImpl.BindRowCallback
+ ) {
+ // Always connect the listener even if notification-handling is disabled. Being a listener
+ // grants special permissions and it's not clear if other things will break if we lose those
+ notificationListener.registerAsSystemService()
+ }
+
+ override fun requestNotificationUpdate(reason: String) {
+ }
+
+ override fun resetUserExpandedStates() {
+ }
+
+ override fun setNotificationSnoozed(sbn: StatusBarNotification, snoozeOption: SnoozeOption) {
+ }
+
+ override fun setNotificationSnoozed(sbn: StatusBarNotification, hoursToSnooze: Int) {
+ }
+
+ override fun getActiveNotificationsCount(): Int {
+ return 0
+ }
+
+ override fun dump(
+ fd: FileDescriptor,
+ pw: PrintWriter,
+ args: Array<String>,
+ dumpTruck: Boolean
+ ) {
+ pw.println()
+ pw.println("Notification handling disabled")
+ pw.println()
+ }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 1726b488..11f7079 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -168,12 +168,10 @@
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.EmptyShadeView;
-import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.KeyboardShortcuts;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.NavigationBarController;
-import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationPresenter;
@@ -191,15 +189,11 @@
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
-import com.android.systemui.statusbar.notification.NotificationClicker;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
-import com.android.systemui.statusbar.notification.NotificationListController;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
-import com.android.systemui.statusbar.notification.collection.init.NotifPipelineInitializer;
+import com.android.systemui.statusbar.notification.init.NotificationsController;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
@@ -218,7 +212,6 @@
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
-import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.volume.VolumeComponent;
@@ -356,7 +349,6 @@
private final Object mQueueLock = new Object();
- private final FeatureFlags mFeatureFlags;
private final StatusBarIconController mIconController;
private final PulseExpansionHandler mPulseExpansionHandler;
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
@@ -365,7 +357,6 @@
private final HeadsUpManagerPhone mHeadsUpManager;
private final DynamicPrivacyController mDynamicPrivacyController;
private final BypassHeadsUpNotifier mBypassHeadsUpNotifier;
- private final Lazy<NotifPipelineInitializer> mNewNotifPipeline;
private final FalsingManager mFalsingManager;
private final BroadcastDispatcher mBroadcastDispatcher;
private final ConfigurationController mConfigurationController;
@@ -374,7 +365,6 @@
private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
private final Provider<StatusBarComponent.Builder> mStatusBarComponentBuilder;
private final PluginManager mPluginManager;
- private final RemoteInputUriController mRemoteInputUriController;
private final Optional<Divider> mDividerOptional;
private final StatusBarNotificationActivityStarter.Builder
mStatusBarNotificationActivityStarterBuilder;
@@ -387,8 +377,8 @@
private final KeyguardDismissUtil mKeyguardDismissUtil;
private final ExtensionController mExtensionController;
private final UserInfoControllerImpl mUserInfoControllerImpl;
- private final NotificationRowBinderImpl mNotificationRowBinder;
private final DismissCallbackRegistry mDismissCallbackRegistry;
+ private NotificationsController mNotificationsController;
// expanded notifications
// the sliding/resizing panel within the notification window
@@ -412,8 +402,6 @@
private final NotificationGutsManager mGutsManager;
private final NotificationLogger mNotificationLogger;
- private final NotificationEntryManager mEntryManager;
- private NotificationListController mNotificationListController;
private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider;
private final NotificationViewHierarchyManager mViewHierarchyManager;
private final KeyguardViewMediator mKeyguardViewMediator;
@@ -589,7 +577,7 @@
@Override
public void onStrongAuthStateChanged(int userId) {
super.onStrongAuthStateChanged(userId);
- mEntryManager.updateNotifications("onStrongAuthStateChanged");
+ mNotificationsController.requestNotificationUpdate("onStrongAuthStateChanged");
}
};
private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper());
@@ -614,7 +602,7 @@
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public StatusBar(
Context context,
- FeatureFlags featureFlags,
+ NotificationsController notificationsController,
LightBarController lightBarController,
AutoHideController autoHideController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -626,13 +614,11 @@
HeadsUpManagerPhone headsUpManagerPhone,
DynamicPrivacyController dynamicPrivacyController,
BypassHeadsUpNotifier bypassHeadsUpNotifier,
- Lazy<NotifPipelineInitializer> newNotifPipeline,
FalsingManager falsingManager,
BroadcastDispatcher broadcastDispatcher,
RemoteInputQuickSettingsDisabler remoteInputQuickSettingsDisabler,
NotificationGutsManager notificationGutsManager,
NotificationLogger notificationLogger,
- NotificationEntryManager notificationEntryManager,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
NotificationViewHierarchyManager notificationViewHierarchyManager,
KeyguardViewMediator keyguardViewMediator,
@@ -653,12 +639,10 @@
VibratorHelper vibratorHelper,
BubbleController bubbleController,
NotificationGroupManager groupManager,
- NotificationGroupAlertTransferHelper groupAlertTransferHelper,
VisualStabilityManager visualStabilityManager,
DeviceProvisionedController deviceProvisionedController,
NavigationBarController navigationBarController,
Lazy<AssistManager> assistManagerLazy,
- NotificationListener notificationListener,
ConfigurationController configurationController,
NotificationShadeWindowController notificationShadeWindowController,
LockscreenLockIconController lockscreenLockIconController,
@@ -676,7 +660,6 @@
Optional<Recents> recentsOptional,
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
PluginManager pluginManager,
- RemoteInputUriController remoteInputUriController,
Optional<Divider> dividerOptional,
LightsOutNotifController lightsOutNotifController,
StatusBarNotificationActivityStarter.Builder
@@ -692,10 +675,9 @@
KeyguardDismissUtil keyguardDismissUtil,
ExtensionController extensionController,
UserInfoControllerImpl userInfoControllerImpl,
- NotificationRowBinderImpl notificationRowBinder,
DismissCallbackRegistry dismissCallbackRegistry) {
super(context);
- mFeatureFlags = featureFlags;
+ mNotificationsController = notificationsController;
mLightBarController = lightBarController;
mAutoHideController = autoHideController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
@@ -707,13 +689,11 @@
mHeadsUpManager = headsUpManagerPhone;
mDynamicPrivacyController = dynamicPrivacyController;
mBypassHeadsUpNotifier = bypassHeadsUpNotifier;
- mNewNotifPipeline = newNotifPipeline;
mFalsingManager = falsingManager;
mBroadcastDispatcher = broadcastDispatcher;
mRemoteInputQuickSettingsDisabler = remoteInputQuickSettingsDisabler;
mGutsManager = notificationGutsManager;
mNotificationLogger = notificationLogger;
- mEntryManager = notificationEntryManager;
mNotificationInterruptionStateProvider = notificationInterruptionStateProvider;
mViewHierarchyManager = notificationViewHierarchyManager;
mKeyguardViewMediator = keyguardViewMediator;
@@ -734,12 +714,10 @@
mVibratorHelper = vibratorHelper;
mBubbleController = bubbleController;
mGroupManager = groupManager;
- mGroupAlertTransferHelper = groupAlertTransferHelper;
mVisualStabilityManager = visualStabilityManager;
mDeviceProvisionedController = deviceProvisionedController;
mNavigationBarController = navigationBarController;
mAssistManagerLazy = assistManagerLazy;
- mNotificationListener = notificationListener;
mConfigurationController = configurationController;
mNotificationShadeWindowController = notificationShadeWindowController;
mLockscreenLockIconController = lockscreenLockIconController;
@@ -757,7 +735,6 @@
mRecentsOptional = recentsOptional;
mStatusBarComponentBuilder = statusBarComponentBuilder;
mPluginManager = pluginManager;
- mRemoteInputUriController = remoteInputUriController;
mDividerOptional = dividerOptional;
mStatusBarNotificationActivityStarterBuilder = statusBarNotificationActivityStarterBuilder;
mShadeController = shadeController;
@@ -771,12 +748,11 @@
mKeyguardDismissUtil = keyguardDismissUtil;
mExtensionController = extensionController;
mUserInfoControllerImpl = userInfoControllerImpl;
- mNotificationRowBinder = notificationRowBinder;
mDismissCallbackRegistry = dismissCallbackRegistry;
mBubbleExpandListener =
(isExpanding, key) -> {
- mEntryManager.updateNotifications("onBubbleExpandChanged");
+ mNotificationsController.requestNotificationUpdate("onBubbleExpandChanged");
updateScrimController();
};
@@ -786,11 +762,10 @@
@Override
public void start() {
- mNotificationListener.registerAsSystemService();
mScreenLifecycle.addObserver(mScreenObserver);
mWakefulnessLifecycle.addObserver(mWakefulnessObserver);
mUiModeManager = mContext.getSystemService(UiModeManager.class);
- mBypassHeadsUpNotifier.setUp(mEntryManager);
+ mBypassHeadsUpNotifier.setUp();
mBubbleController.setExpandListener(mBubbleExpandListener);
mActivityIntentHelper = new ActivityIntentHelper(mContext);
@@ -1060,12 +1035,8 @@
mConfigurationController.addCallback(mHeadsUpManager);
mHeadsUpManager.addListener(this);
mHeadsUpManager.addListener(mNotificationPanelViewController.getOnHeadsUpChangedListener());
- mHeadsUpManager.addListener(mGroupManager);
- mHeadsUpManager.addListener(mGroupAlertTransferHelper);
mHeadsUpManager.addListener(mVisualStabilityManager);
mNotificationPanelViewController.setHeadsUpManager(mHeadsUpManager);
- mGroupManager.setHeadsUpManager(mHeadsUpManager);
- mGroupAlertTransferHelper.setHeadsUpManager(mHeadsUpManager);
mNotificationLogger.setHeadsUpManager(mHeadsUpManager);
createNavigationBar(result);
@@ -1243,16 +1214,10 @@
mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanelViewController,
mHeadsUpManager, mNotificationShadeWindowView, mStackScroller, mDozeScrimController,
mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
- mNotificationAlertingManager, mNotificationRowBinder, mKeyguardStateController,
+ mNotificationAlertingManager, mKeyguardStateController,
mKeyguardIndicationController,
this /* statusBar */, mShadeController, mCommandQueue, mInitController);
- mNotificationListController =
- new NotificationListController(
- mEntryManager,
- (NotificationListContainer) mStackScroller,
- mDeviceProvisionedController);
-
mNotificationShelf.setOnActivatedListener(mPresenter);
mRemoteInputManager.getController().addCallback(mNotificationShadeWindowController);
@@ -1266,22 +1231,12 @@
mGutsManager.setNotificationActivityStarter(mNotificationActivityStarter);
- if (!mFeatureFlags.isNewNotifPipelineRenderingEnabled()) {
- mNotificationRowBinder.setInflationCallback(mEntryManager);
- }
-
- mRemoteInputUriController.attach(mEntryManager);
-
- mNotificationRowBinder.setNotificationClicker(new NotificationClicker(
- Optional.of(this), mBubbleController, mNotificationActivityStarter));
-
- mGroupAlertTransferHelper.bind(mEntryManager, mGroupManager);
- mNotificationListController.bind();
-
- if (mFeatureFlags.isNewNotifPipelineEnabled()) {
- mNewNotifPipeline.get().initialize(mNotificationListener, mNotificationRowBinder);
- }
- mEntryManager.attach(mNotificationListener);
+ mNotificationsController.initialize(
+ this,
+ mPresenter,
+ (NotificationListContainer) mStackScroller,
+ mNotificationActivityStarter,
+ mPresenter);
}
/**
@@ -1518,7 +1473,7 @@
* @param reason why we're requesting a notification update
*/
public void requestNotificationUpdate(String reason) {
- mEntryManager.updateNotifications(reason);
+ mNotificationsController.requestNotificationUpdate(reason);
}
/**
@@ -1726,7 +1681,7 @@
@Override
public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
- mEntryManager.updateNotifications("onHeadsUpStateChanged");
+ mNotificationsController.requestNotificationUpdate("onHeadsUpStateChanged");
if (mStatusBarStateController.isDozing() && isHeadsUp) {
entry.setPulseSuppressed(false);
mDozeServiceHost.fireNotificationPulse(entry);
@@ -2485,11 +2440,9 @@
mStatusBarKeyguardViewManager.dump(pw);
}
- if (DUMPTRUCK) {
- synchronized (mEntryManager) {
- mEntryManager.dump(pw, " ");
- }
+ mNotificationsController.dump(fd, pw, args, DUMPTRUCK);
+ if (DUMPTRUCK) {
if (false) {
pw.println("see the logcat for a dump of the views we have created.");
// must happen on ui thread
@@ -2512,11 +2465,6 @@
} else {
pw.println(" mHeadsUpManager: null");
}
- if (mGroupManager != null) {
- mGroupManager.dump(fd, pw, args);
- } else {
- pw.println(" mGroupManager: null");
- }
if (mBubbleController != null) {
mBubbleController.dump(fd, pw, args);
@@ -2747,9 +2695,7 @@
};
public void resetUserExpandedStates() {
- for (NotificationEntry entry : mEntryManager.getVisibleNotifications()) {
- entry.resetUserExpansion();
- }
+ mNotificationsController.resetUserExpandedStates();
}
private void executeWhenUnlocked(OnDismissAction action, boolean requiresShadeOpen) {
@@ -2855,7 +2801,7 @@
try {
// consider the transition from peek to expanded to be a panel open,
// but not one that clears notification effects.
- int notificationLoad = mEntryManager.getActiveNotificationsCount();
+ int notificationLoad = mNotificationsController.getActiveNotificationsCount();
mBarService.onPanelRevealed(false, notificationLoad);
} catch (RemoteException ex) {
// Won't fail unless the world has ended.
@@ -2873,7 +2819,7 @@
!mPresenter.isPresenterFullyCollapsed() &&
(mState == StatusBarState.SHADE
|| mState == StatusBarState.SHADE_LOCKED);
- int notificationLoad = mEntryManager.getActiveNotificationsCount();
+ int notificationLoad = mNotificationsController.getActiveNotificationsCount();
if (pinnedHeadsUp && mPresenter.isPresenterFullyCollapsed()) {
notificationLoad = 1;
}
@@ -3514,7 +3460,7 @@
updateQsExpansionEnabled();
mKeyguardViewMediator.setDozing(mDozing);
- mEntryManager.updateNotifications("onDozingChanged");
+ mNotificationsController.requestNotificationUpdate("onDozingChanged");
updateDozingState();
mDozeServiceHost.updateDozing();
updateScrimController();
@@ -3965,7 +3911,6 @@
protected ViewGroup mStackScroller;
private final NotificationGroupManager mGroupManager;
- private final NotificationGroupAlertTransferHelper mGroupAlertTransferHelper;
// handling reordering
private final VisualStabilityManager mVisualStabilityManager;
@@ -4032,21 +3977,12 @@
}
};
- private final NotificationListener mNotificationListener;
-
public void setNotificationSnoozed(StatusBarNotification sbn, SnoozeOption snoozeOption) {
- if (snoozeOption.getSnoozeCriterion() != null) {
- mNotificationListener.snoozeNotification(sbn.getKey(),
- snoozeOption.getSnoozeCriterion().getId());
- } else {
- mNotificationListener.snoozeNotification(sbn.getKey(),
- snoozeOption.getMinutesToSnoozeFor() * 60 * 1000);
- }
+ mNotificationsController.setNotificationSnoozed(sbn, snoozeOption);
}
public void setNotificationSnoozed(StatusBarNotification sbn, int hoursToSnooze) {
- mNotificationListener.snoozeNotification(sbn.getKey(),
- hoursToSnooze * 60 * 60 * 1000);
+ mNotificationsController.setNotificationSnoozed(sbn, hoursToSnooze);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
index 7615bf8..15a0e08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
@@ -46,9 +46,7 @@
import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NavigationBarController;
-import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -61,12 +59,10 @@
import com.android.systemui.statusbar.notification.BypassHeadsUpNotifier;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
-import com.android.systemui.statusbar.notification.collection.init.NotifPipelineInitializer;
+import com.android.systemui.statusbar.notification.init.NotificationsController;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.dagger.StatusBarComponent;
@@ -77,7 +73,6 @@
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
-import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.volume.VolumeComponent;
@@ -105,7 +100,7 @@
@Singleton
static StatusBar provideStatusBar(
Context context,
- FeatureFlags featureFlags,
+ NotificationsController notificationsController,
LightBarController lightBarController,
AutoHideController autoHideController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -117,13 +112,11 @@
HeadsUpManagerPhone headsUpManagerPhone,
DynamicPrivacyController dynamicPrivacyController,
BypassHeadsUpNotifier bypassHeadsUpNotifier,
- Lazy<NotifPipelineInitializer> newNotifPipeline,
FalsingManager falsingManager,
BroadcastDispatcher broadcastDispatcher,
RemoteInputQuickSettingsDisabler remoteInputQuickSettingsDisabler,
NotificationGutsManager notificationGutsManager,
NotificationLogger notificationLogger,
- NotificationEntryManager notificationEntryManager,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
NotificationViewHierarchyManager notificationViewHierarchyManager,
KeyguardViewMediator keyguardViewMediator,
@@ -144,12 +137,10 @@
VibratorHelper vibratorHelper,
BubbleController bubbleController,
NotificationGroupManager groupManager,
- NotificationGroupAlertTransferHelper groupAlertTransferHelper,
VisualStabilityManager visualStabilityManager,
DeviceProvisionedController deviceProvisionedController,
NavigationBarController navigationBarController,
Lazy<AssistManager> assistManagerLazy,
- NotificationListener notificationListener,
ConfigurationController configurationController,
NotificationShadeWindowController notificationShadeWindowController,
LockscreenLockIconController lockscreenLockIconController,
@@ -167,7 +158,6 @@
Optional<Recents> recentsOptional,
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
PluginManager pluginManager,
- RemoteInputUriController remoteInputUriController,
Optional<Divider> dividerOptional,
LightsOutNotifController lightsOutNotifController,
StatusBarNotificationActivityStarter.Builder
@@ -183,11 +173,10 @@
KeyguardDismissUtil keyguardDismissUtil,
ExtensionController extensionController,
UserInfoControllerImpl userInfoControllerImpl,
- NotificationRowBinderImpl notificationRowBinder,
DismissCallbackRegistry dismissCallbackRegistry) {
return new StatusBar(
context,
- featureFlags,
+ notificationsController,
lightBarController,
autoHideController,
keyguardUpdateMonitor,
@@ -199,13 +188,11 @@
headsUpManagerPhone,
dynamicPrivacyController,
bypassHeadsUpNotifier,
- newNotifPipeline,
falsingManager,
broadcastDispatcher,
remoteInputQuickSettingsDisabler,
notificationGutsManager,
notificationLogger,
- notificationEntryManager,
notificationInterruptionStateProvider,
notificationViewHierarchyManager,
keyguardViewMediator,
@@ -226,12 +213,10 @@
vibratorHelper,
bubbleController,
groupManager,
- groupAlertTransferHelper,
visualStabilityManager,
deviceProvisionedController,
navigationBarController,
assistManagerLazy,
- notificationListener,
configurationController,
notificationShadeWindowController,
lockscreenLockIconController,
@@ -249,7 +234,6 @@
recentsOptional,
statusBarComponentBuilder,
pluginManager,
- remoteInputUriController,
dividerOptional,
lightsOutNotifController,
statusBarNotificationActivityStarterBuilder,
@@ -264,7 +248,6 @@
keyguardDismissUtil,
extensionController,
userInfoControllerImpl,
- notificationRowBinder,
dismissCallbackRegistry);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 1336b2d..2485513 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -141,7 +141,6 @@
ActivityLaunchAnimator activityLaunchAnimator,
DynamicPrivacyController dynamicPrivacyController,
NotificationAlertingManager notificationAlertingManager,
- NotificationRowBinderImpl notificationRowBinder,
KeyguardStateController keyguardStateController,
KeyguardIndicationController keyguardIndicationController,
StatusBar statusBar,
@@ -216,8 +215,6 @@
mEntryManager.addNotificationLifetimeExtender(mGutsManager);
mEntryManager.addNotificationLifetimeExtenders(
remoteInputManager.getLifetimeExtenders());
- notificationRowBinder.setUpWithPresenter(this, notifListContainer, mHeadsUpManager,
- this);
mNotificationInterruptionStateProvider.setUpWithPresenter(
this, mHeadsUpManager, this::canHeadsUp);
mLockscreenUserManager.setUpWithPresenter(this);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
index dd896be..b9d2d22 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
@@ -54,7 +54,6 @@
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
@@ -113,10 +112,9 @@
notificationShadeWindowView, mock(NotificationListContainerViewGroup.class),
mock(DozeScrimController.class), mock(ScrimController.class),
mock(ActivityLaunchAnimator.class), mock(DynamicPrivacyController.class),
- mock(NotificationAlertingManager.class),
- mock(NotificationRowBinderImpl.class), mock(KeyguardStateController.class),
- mock(KeyguardIndicationController.class),
- mStatusBar, mock(ShadeControllerImpl.class), mCommandQueue, mInitController);
+ mock(NotificationAlertingManager.class), mock(KeyguardStateController.class),
+ mock(KeyguardIndicationController.class), mStatusBar,
+ mock(ShadeControllerImpl.class), mCommandQueue, mInitController);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index e90e398..db17a6e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -95,7 +95,6 @@
import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.NotificationListener;
@@ -120,8 +119,7 @@
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
-import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
-import com.android.systemui.statusbar.notification.collection.init.NotifPipelineInitializer;
+import com.android.systemui.statusbar.notification.init.NotificationsController;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
@@ -133,10 +131,8 @@
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
-import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
-import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.volume.VolumeComponent;
@@ -149,7 +145,6 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
-import java.util.ArrayList;
import java.util.Optional;
import javax.inject.Provider;
@@ -166,7 +161,7 @@
private PowerManager mPowerManager;
private TestableNotificationInterruptionStateProvider mNotificationInterruptionStateProvider;
- @Mock private FeatureFlags mFeatureFlags;
+ @Mock private NotificationsController mNotificationsController;
@Mock private LightBarController mLightBarController;
@Mock private StatusBarIconController mStatusBarIconController;
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@@ -180,7 +175,6 @@
@Mock private IDreamManager mDreamManager;
@Mock private ScrimController mScrimController;
@Mock private DozeScrimController mDozeScrimController;
- @Mock private ArrayList<NotificationEntry> mNotificationList;
@Mock private Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
@Mock private BiometricUnlockController mBiometricUnlockController;
@Mock private NotificationInterruptionStateProvider.HeadsUpSuppressor mHeadsUpSuppressor;
@@ -190,7 +184,6 @@
@Mock private NotificationLockscreenUserManager mLockscreenUserManager;
@Mock private NotificationRemoteInputManager mRemoteInputManager;
@Mock private RemoteInputController mRemoteInputController;
- @Mock private RemoteInputUriController mRemoteInputUriController;
@Mock private StatusBarStateControllerImpl mStatusBarStateController;
@Mock private BatteryController mBatteryController;
@Mock private DeviceProvisionedController mDeviceProvisionedController;
@@ -214,8 +207,6 @@
@Mock private NotificationWakeUpCoordinator mNotificationWakeUpCoordinator;
@Mock private KeyguardBypassController mKeyguardBypassController;
@Mock private DynamicPrivacyController mDynamicPrivacyController;
- @Mock private NotifPipelineInitializer mNewNotifPipeline;
- @Mock private ZenModeController mZenModeController;
@Mock private AutoHideController mAutoHideController;
@Mock private NotificationViewHierarchyManager mNotificationViewHierarchyManager;
@Mock private UserSwitcherController mUserSwitcherController;
@@ -223,7 +214,6 @@
@Mock private VibratorHelper mVibratorHelper;
@Mock private BubbleController mBubbleController;
@Mock private NotificationGroupManager mGroupManager;
- @Mock private NotificationGroupAlertTransferHelper mGroupAlertTransferHelper;
@Mock private NotificationShadeWindowController mNotificationShadeWindowController;
@Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
@@ -247,7 +237,6 @@
@Mock private ViewMediatorCallback mViewMediatorCallback;
@Mock private DismissCallbackRegistry mDismissCallbackRegistry;
@Mock private ScreenPinningRequest mScreenPinningRequest;
- @Mock private NotificationEntryManager mEntryManager;
@Mock private LockscreenLockIconController mLockscreenLockIconController;
@Mock private StatusBarNotificationActivityStarter.Builder
mStatusBarNotificationActivityStarterBuilder;
@@ -256,7 +245,6 @@
@Mock private KeyguardDismissUtil mKeyguardDismissUtil;
@Mock private ExtensionController mExtensionController;
@Mock private UserInfoControllerImpl mUserInfoControllerImpl;
- @Mock private NotificationRowBinderImpl mNotificationRowBinder;
private ShadeController mShadeController;
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
private InitController mInitController = new InitController();
@@ -280,7 +268,7 @@
mMetricsLogger = new FakeMetricsLogger();
NotificationLogger notificationLogger = new NotificationLogger(mNotificationListener,
- mUiBgExecutor, mEntryManager, mStatusBarStateController,
+ mUiBgExecutor, mock(NotificationEntryManager.class), mStatusBarStateController,
mExpansionStateLogger);
notificationLogger.setVisibilityReporter(mock(Runnable.class));
@@ -334,7 +322,7 @@
mStatusBar = new StatusBar(
mContext,
- mFeatureFlags,
+ mNotificationsController,
mLightBarController,
mAutoHideController,
mKeyguardUpdateMonitor,
@@ -346,7 +334,6 @@
mHeadsUpManager,
mDynamicPrivacyController,
mBypassHeadsUpNotifier,
- () -> mNewNotifPipeline,
new FalsingManagerFake(),
mBroadcastDispatcher,
new RemoteInputQuickSettingsDisabler(
@@ -356,7 +343,6 @@
),
mNotificationGutsManager,
notificationLogger,
- mEntryManager,
mNotificationInterruptionStateProvider,
mNotificationViewHierarchyManager,
mKeyguardViewMediator,
@@ -377,12 +363,10 @@
mVibratorHelper,
mBubbleController,
mGroupManager,
- mGroupAlertTransferHelper,
mVisualStabilityManager,
mDeviceProvisionedController,
mNavigationBarController,
() -> mAssistManager,
- mNotificationListener,
configurationController,
mNotificationShadeWindowController,
mLockscreenLockIconController,
@@ -399,7 +383,6 @@
Optional.of(mRecents),
mStatusBarComponentBuilderProvider,
mPluginManager,
- mRemoteInputUriController,
Optional.of(mDivider),
mLightsOutNotifController,
mStatusBarNotificationActivityStarterBuilder,
@@ -414,7 +397,6 @@
mKeyguardDismissUtil,
mExtensionController,
mUserInfoControllerImpl,
- mNotificationRowBinder,
mDismissCallbackRegistry);
when(mNotificationShadeWindowView.findViewById(R.id.lock_icon_container)).thenReturn(
@@ -675,7 +657,7 @@
public void testPanelOpenForHeadsUp() {
when(mDeviceProvisionedController.isDeviceProvisioned()).thenReturn(true);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(true);
- when(mEntryManager.getActiveNotificationsCount()).thenReturn(5);
+ when(mNotificationsController.getActiveNotificationsCount()).thenReturn(5);
when(mNotificationPresenter.isPresenterFullyCollapsed()).thenReturn(true);
mStatusBar.setBarStateForTest(StatusBarState.SHADE);
@@ -693,7 +675,7 @@
@Test
public void testPanelOpenAndClear() {
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false);
- when(mEntryManager.getActiveNotificationsCount()).thenReturn(5);
+ when(mNotificationsController.getActiveNotificationsCount()).thenReturn(5);
when(mNotificationPresenter.isPresenterFullyCollapsed()).thenReturn(false);
mStatusBar.setBarStateForTest(StatusBarState.SHADE);
@@ -712,7 +694,7 @@
@Test
public void testPanelOpenAndNoClear() {
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false);
- when(mEntryManager.getActiveNotificationsCount()).thenReturn(5);
+ when(mNotificationsController.getActiveNotificationsCount()).thenReturn(5);
when(mNotificationPresenter.isPresenterFullyCollapsed()).thenReturn(false);
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);