Factors out notification listening from ForegroundServiceController.

This change introduces the ForegroundServiceNotificationListener
component, which contains the logic formerly in
ForegroundServiceController for updating its state in response to
notification events.  ForegroundServiceNotificationListener adds a
standard NotificationEntryListener to the NotificationEntryManager,
allowing us to remove the explicit calls from NotificationEntryManager;
splitting this out to its own class prevents us from introducing a
circular dependency since NotificationEntryManager still needs to use
the query methods on ForegroundServiceController.

Test: atest SystemUITests, manual
Change-Id: Iec72aa3a9fd90e3f0079db3b2a3c4f1882e59731
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index a8d3763..9a7a9bf 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -272,6 +272,7 @@
     Lazy<NotificationAlertingManager> mNotificationAlertingManager;
     @Inject Lazy<SensorPrivacyManager> mSensorPrivacyManager;
     @Inject Lazy<AutoHideController> mAutoHideController;
+    @Inject Lazy<ForegroundServiceNotificationListener> mForegroundServiceNotificationListener;
     @Inject @Named(BG_LOOPER_NAME) Lazy<Looper> mBgLooper;
     @Inject @Named(BG_HANDLER_NAME) Lazy<Handler> mBgHandler;
     @Inject @Named(MAIN_HANDLER_NAME) Lazy<Handler> mMainHandler;
@@ -444,6 +445,8 @@
         mProviders.put(BubbleController.class, mBubbleController::get);
         mProviders.put(NotificationEntryManager.class, mNotificationEntryManager::get);
         mProviders.put(NotificationAlertingManager.class, mNotificationAlertingManager::get);
+        mProviders.put(ForegroundServiceNotificationListener.class,
+                mForegroundServiceNotificationListener::get);
 
         // TODO(b/118592525): to support multi-display , we start to add something which is
         //                    per-display, while others may be global. I think it's time to add