From 2e3425987af308066e8a4a3c6426b3d8d2db7837 Mon Sep 17 00:00:00 2001 From: Steve Elliott Date: Tue, 23 Aug 2022 21:43:36 -0400 Subject: [PATCH] Remove NotifEntryManager Bug: 200269355 Test: atest SystemUITests Change-Id: I3e418dfd7d3512ac811e67733e32818622a0a415 Merged-In: I3e418dfd7d3512ac811e67733e32818622a0a415 --- .../src/com/android/systemui/Dependency.java | 9 - ...ForegroundServiceNotificationListener.java | 40 +--- .../dagger/ReferenceSystemUIModule.java | 6 - .../NotificationPanelViewController.java | 5 - ...NotificationLockscreenUserManagerImpl.java | 21 --- .../NotificationRemoteInputManager.java | 22 --- .../CentralSurfacesDependenciesModule.java | 7 - .../NotificationEntryManager.java | 174 ------------------ .../NotificationEntryManagerLogger.kt | 124 ------------- .../SmartspaceDedupingCoordinator.kt | 8 - .../inflation/NotificationRowBinder.java | 3 +- .../CommonNotifCollection.java | 6 +- .../dagger/NotificationsModule.java | 10 - .../init/NotificationsController.kt | 3 - .../init/NotificationsControllerImpl.kt | 20 +- .../init/NotificationsControllerStub.kt | 14 -- ...tificationStackScrollLayoutController.java | 5 - .../statusbar/phone/CentralSurfaces.java | 2 - .../statusbar/phone/CentralSurfacesImpl.java | 31 +--- .../phone/KeyguardEnvironmentImpl.java | 60 ------ .../phone/StatusBarHeadsUpChangeListener.java | 1 - .../phone/StatusBarNotificationPresenter.java | 6 - .../android/systemui/tv/TvSystemUIModule.java | 6 - .../systemui/wmshell/BubblesManager.java | 7 - .../ForegroundServiceControllerTest.java | 29 ++- .../NotificationPanelViewControllerTest.java | 4 - .../statusbar/NonPhoneDependencyTest.java | 7 - ...NotificationLockscreenUserManagerTest.java | 18 -- .../NotificationRemoteInputManagerTest.java | 11 -- .../SmartspaceDedupingCoordinatorTest.kt | 15 +- .../logging/NotificationLoggerTest.java | 9 - .../notification/row/FeedbackInfoTest.java | 4 - ...cationStackScrollLayoutControllerTest.java | 3 - .../phone/CentralSurfacesImplTest.java | 3 - ...tusBarNotificationActivityStarterTest.java | 3 - .../StatusBarRemoteInputCallbackTest.java | 3 - 36 files changed, 28 insertions(+), 671 deletions(-) delete mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java delete mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt delete mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index 0cb4da429c464..7fc81231c90bf 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -85,8 +85,6 @@ import com.android.systemui.statusbar.SmartReplyController; import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.events.PrivacyDotViewController; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; -import com.android.systemui.statusbar.notification.NotificationEntryManager; -import com.android.systemui.statusbar.notification.NotificationEntryManager.KeyguardEnvironment; import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager; import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager; import com.android.systemui.statusbar.notification.logging.NotificationLogger; @@ -301,7 +299,6 @@ public class Dependency { @Inject Lazy mIStatusBarService; @Inject Lazy mDisplayMetrics; @Inject Lazy mLockscreenGestureLogger; - @Inject Lazy mKeyguardEnvironment; @Inject Lazy mShadeController; @Inject Lazy mNotificationRemoteInputManagerCallback; @Inject Lazy mAppOpsController; @@ -318,10 +315,8 @@ public class Dependency { @Inject Lazy mKeyguardDismissUtil; @Inject Lazy mSmartReplyController; @Inject Lazy mRemoteInputQuickSettingsDisabler; - @Inject Lazy mNotificationEntryManager; @Inject Lazy mSensorPrivacyManager; @Inject Lazy mAutoHideController; - @Inject Lazy mForegroundServiceNotificationListener; @Inject Lazy mPrivacyItemController; @Inject @Background Lazy mBgLooper; @Inject @Background Lazy mBgHandler; @@ -503,7 +498,6 @@ public class Dependency { mProviders.put(LockscreenGestureLogger.class, mLockscreenGestureLogger::get); - mProviders.put(KeyguardEnvironment.class, mKeyguardEnvironment::get); mProviders.put(ShadeController.class, mShadeController::get); mProviders.put(NotificationRemoteInputManager.Callback.class, @@ -530,9 +524,6 @@ public class Dependency { mProviders.put(SmartReplyController.class, mSmartReplyController::get); mProviders.put(RemoteInputQuickSettingsDisabler.class, mRemoteInputQuickSettingsDisabler::get); - mProviders.put(NotificationEntryManager.class, mNotificationEntryManager::get); - mProviders.put(ForegroundServiceNotificationListener.class, - mForegroundServiceNotificationListener::get); mProviders.put(ClockManager.class, mClockManager::get); mProviders.put(PrivacyItemController.class, mPrivacyItemController::get); mProviders.put(ActivityManagerWrapper.class, mActivityManagerWrapper::get); diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java index 04e26d36f0a57..a1a3b7280fa99 100644 --- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java +++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java @@ -23,14 +23,10 @@ import android.os.Bundle; import android.service.notification.StatusBarNotification; import android.util.Log; -import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.dagger.SysUISingleton; -import com.android.systemui.statusbar.notification.NotificationEntryListener; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; -import com.android.systemui.util.time.SystemClock; import javax.inject.Inject; @@ -43,42 +39,20 @@ public class ForegroundServiceNotificationListener { private final Context mContext; private final ForegroundServiceController mForegroundServiceController; - private final NotificationEntryManager mEntryManager; + private final NotifPipeline mNotifPipeline; @Inject public ForegroundServiceNotificationListener(Context context, ForegroundServiceController foregroundServiceController, - NotificationEntryManager notificationEntryManager, - NotifPipeline notifPipeline, - SystemClock systemClock) { + NotifPipeline notifPipeline) { mContext = context; mForegroundServiceController = foregroundServiceController; + mNotifPipeline = notifPipeline; + } - // TODO: (b/145659174) remove mEntryManager when moving to NewNotifPipeline. Replaced by - // ForegroundCoordinator - mEntryManager = notificationEntryManager; - mEntryManager.addNotificationEntryListener(new NotificationEntryListener() { - @Override - public void onPendingEntryAdded(NotificationEntry entry) { - addNotification(entry, entry.getImportance()); - } - - @Override - public void onPreEntryUpdated(NotificationEntry entry) { - updateNotification(entry, entry.getImportance()); - } - - @Override - public void onEntryRemoved( - NotificationEntry entry, - NotificationVisibility visibility, - boolean removedByUser, - int reason) { - removeNotification(entry.getSbn()); - } - }); - - notifPipeline.addCollectionListener(new NotifCollectionListener() { + /** Initializes this listener by connecting it to the notification pipeline. */ + public void init() { + mNotifPipeline.addCollectionListener(new NotifCollectionListener() { @Override public void onEntryAdded(NotificationEntry entry) { addNotification(entry, entry.getImportance()); diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java index 4157728d8360f..fbfc94af683eb 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java @@ -54,13 +54,11 @@ import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.dagger.StartCentralSurfacesModule; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.provider.VisualStabilityProvider; import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager; import com.android.systemui.statusbar.phone.DozeServiceHost; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; -import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.BatteryController; @@ -169,10 +167,6 @@ public abstract class ReferenceSystemUIModule { @Binds abstract DockManager bindDockManager(DockManagerImpl dockManager); - @Binds - abstract NotificationEntryManager.KeyguardEnvironment bindKeyguardEnvironment( - KeyguardEnvironmentImpl keyguardEnvironment); - @Binds abstract ShadeController provideShadeController(ShadeControllerImpl shadeController); diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index efdeba57489f9..0d3bdf642130b 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -174,7 +174,6 @@ import com.android.systemui.statusbar.events.PrivacyDotViewController; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.ConversationNotificationManager; import com.android.systemui.statusbar.notification.DynamicPrivacyController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; @@ -582,7 +581,6 @@ public final class NotificationPanelViewController { } }).setCustomInterpolator( mPanelAlphaAnimator.getProperty(), Interpolators.ALPHA_IN); - private final NotificationEntryManager mEntryManager; private final CommandQueue mCommandQueue; private final UserManager mUserManager; @@ -818,7 +816,6 @@ public final class NotificationPanelViewController { DynamicPrivacyController dynamicPrivacyController, KeyguardBypassController bypassController, FalsingManager falsingManager, FalsingCollector falsingCollector, - NotificationEntryManager notificationEntryManager, KeyguardStateController keyguardStateController, StatusBarStateController statusBarStateController, StatusBarWindowStateController statusBarWindowStateController, @@ -1016,7 +1013,6 @@ public final class NotificationPanelViewController { }); mBottomAreaShadeAlphaAnimator.setDuration(160); mBottomAreaShadeAlphaAnimator.setInterpolator(Interpolators.ALPHA_OUT); - mEntryManager = notificationEntryManager; mConversationNotificationManager = conversationNotificationManager; mAuthController = authController; mLockIconViewController = lockIconViewController; @@ -5870,7 +5866,6 @@ public final class NotificationPanelViewController { public void showAodUi() { setDozing(true /* dozing */, false /* animate */); mStatusBarStateController.setUpcomingState(KEYGUARD); - mEntryManager.updateNotifications("showAodUi"); mStatusBarStateListener.onStateChanged(KEYGUARD); mStatusBarStateListener.onDozeAmountChanged(1f, 1f); setExpandedFraction(1f); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index ae5a2c3fe9e29..8699441da726e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -51,7 +51,6 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.recents.OverviewProxyService; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; @@ -85,9 +84,6 @@ public class NotificationLockscreenUserManagerImpl implements private final SecureSettings mSecureSettings; private final Object mLock = new Object(); - // Lazy - private NotificationEntryManager mEntryManager; - private final Lazy mVisibilityProviderLazy; private final Lazy mCommonNotifCollectionLazy; private final DevicePolicyManager mDevicePolicyManager; @@ -119,7 +115,6 @@ public class NotificationLockscreenUserManagerImpl implements isCurrentProfile(getSendingUserId())) { mUsersAllowingPrivateNotifications.clear(); updateLockscreenNotificationSetting(); - getEntryManager().updateNotifications("ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED"); // TODO(b/231976036): Consolidate pipeline invalidations related to this event // notifyNotificationStateChanged(); } @@ -140,10 +135,6 @@ public class NotificationLockscreenUserManagerImpl implements updateLockscreenNotificationSetting(); updatePublicMode(); - // The filtering needs to happen before the update call below in order to - // make sure - // the presenter has the updated notifications from the new user - getEntryManager().reapplyFilterAndSort("user switched"); mPresenter.onUserSwitched(mCurrentUserId); for (UserChangedListener listener : mListeners) { @@ -200,13 +191,6 @@ public class NotificationLockscreenUserManagerImpl implements protected ContentObserver mSettingsObserver; private boolean mHideSilentNotificationsOnLockscreen; - private NotificationEntryManager getEntryManager() { - if (mEntryManager == null) { - mEntryManager = Dependency.get(NotificationEntryManager.class); - } - return mEntryManager; - } - @Inject public NotificationLockscreenUserManagerImpl(Context context, BroadcastDispatcher broadcastDispatcher, @@ -253,8 +237,6 @@ public class NotificationLockscreenUserManagerImpl implements mUsersAllowingNotifications.clear(); // ... and refresh all the notifications updateLockscreenNotificationSetting(); - getEntryManager().updateNotifications("LOCK_SCREEN_SHOW_NOTIFICATIONS," - + " or LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS change"); notifyNotificationStateChanged(); } }; @@ -264,8 +246,6 @@ public class NotificationLockscreenUserManagerImpl implements public void onChange(boolean selfChange) { updateLockscreenNotificationSetting(); if (mDeviceProvisionedController.isDeviceProvisioned()) { - getEntryManager().updateNotifications("LOCK_SCREEN_ALLOW_REMOTE_INPUT" - + " or ZEN_MODE change"); // TODO(b/231976036): Consolidate pipeline invalidations related to this event // notifyNotificationStateChanged(); } @@ -596,7 +576,6 @@ public class NotificationLockscreenUserManagerImpl implements setLockscreenPublicMode(isProfilePublic, userId); mUsersWithSeparateWorkChallenge.put(userId, needsSeparateChallenge); } - getEntryManager().updateNotifications("NotificationLockscreenUserManager.updatePublicMode"); // TODO(b/234738798): Migrate KeyguardNotificationVisibilityProvider to use this listener if (!mLockscreenPublicMode.equals(oldPublicModes) || !mUsersWithSeparateWorkChallenge.equals(oldWorkChallenges)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index d74d408ae59e0..f668528d8f5fc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -53,8 +53,6 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.dagger.CentralSurfacesDependenciesModule; import com.android.systemui.statusbar.notification.NotifPipelineFlags; -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.NotificationEntry.EditedSuggestionInfo; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; @@ -256,7 +254,6 @@ public class NotificationRemoteInputManager implements Dumpable { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationVisibilityProvider visibilityProvider, - NotificationEntryManager notificationEntryManager, Lazy> centralSurfacesOptionalLazy, StatusBarStateController statusBarStateController, RemoteInputUriController remoteInputUriController, @@ -279,25 +276,6 @@ public class NotificationRemoteInputManager implements Dumpable { mClickNotifier = clickNotifier; dumpManager.registerDumpable(this); - - notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() { - @Override - public void onPreEntryUpdated(NotificationEntry entry) { - // Mark smart replies as sent whenever a notification is updated - otherwise the - // smart replies are never marked as sent. - mSmartReplyController.stopSending(entry); - } - - @Override - public void onEntryRemoved( - @Nullable NotificationEntry entry, - NotificationVisibility visibility, - boolean removedByUser, - int reason) { - // We're removing the notification, the smart controller can forget about it. - mSmartReplyController.stopSending(entry); - } - }); } /** Add a listener for various remote input events. Works with NEW pipeline only. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java index 8752f92145dbe..7cd79cac89283 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java @@ -18,7 +18,6 @@ package com.android.systemui.statusbar.dagger; import android.app.IActivityManager; import android.content.Context; -import android.os.Handler; import android.os.RemoteException; import android.service.dreams.IDreamManager; import android.util.Log; @@ -42,14 +41,12 @@ import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeWindowController; -import com.android.systemui.statusbar.RemoteInputNotificationRebuilder; import com.android.systemui.statusbar.SmartReplyController; import com.android.systemui.statusbar.StatusBarStateControllerImpl; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.commandline.CommandRegistry; import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler; import com.android.systemui.statusbar.notification.NotifPipelineFlags; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifCollection; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; @@ -99,11 +96,8 @@ public interface CentralSurfacesDependenciesModule { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationVisibilityProvider visibilityProvider, - NotificationEntryManager notificationEntryManager, - RemoteInputNotificationRebuilder rebuilder, Lazy> centralSurfacesOptionalLazy, StatusBarStateController statusBarStateController, - Handler mainHandler, RemoteInputUriController remoteInputUriController, NotificationClickNotifier clickNotifier, ActionClickLogger actionClickLogger, @@ -114,7 +108,6 @@ public interface CentralSurfacesDependenciesModule { lockscreenUserManager, smartReplyController, visibilityProvider, - notificationEntryManager, centralSurfacesOptionalLazy, statusBarStateController, remoteInputUriController, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java deleted file mode 100644 index 54be9a6ff39bf..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2017 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; - -import android.service.notification.NotificationListenerService; -import android.service.notification.StatusBarNotification; -import android.util.ArrayMap; - -import androidx.annotation.NonNull; - -import com.android.internal.annotations.VisibleForTesting; -import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; -import com.android.systemui.statusbar.notification.dagger.NotificationsModule; - -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * NotificationEntryManager is responsible for the adding, removing, and updating of - * {@link NotificationEntry}s. It also handles tasks such as their inflation and their interaction - * with other Notification.*Manager objects. - * - * We track notification entries through this lifecycle: - * 1. Pending - * 2. Active - * 3. Sorted / filtered (visible) - * - * Every entry spends some amount of time in the pending state, while it is being inflated. Once - * inflated, an entry moves into the active state, where it _could_ potentially be shown to the - * user. After an entry makes its way into the active state, we sort and filter the entire set to - * repopulate the visible set. - */ -public class NotificationEntryManager { - - private final NotificationEntryManagerLogger mLogger; - - /** Pending notifications are ones awaiting inflation */ - @VisibleForTesting - protected final HashMap mPendingNotifications = new HashMap<>(); - /** - * Active notifications have been inflated / prepared and could become visible, but may get - * filtered out if for instance they are not for the current user - */ - private final ArrayMap mActiveNotifications = new ArrayMap<>(); - /** This is the list of "active notifications for this user in this context" */ - @VisibleForTesting - protected final ArrayList mSortedAndFiltered = new ArrayList<>(); - private final List mNotifCollectionListeners = new ArrayList<>(); - private final List mNotificationEntryListeners = new ArrayList<>(); - - /** - * Injected constructor. See {@link NotificationsModule}. - */ - public NotificationEntryManager(NotificationEntryManagerLogger logger) { - mLogger = logger; - } - - /** Adds a {@link NotificationEntryListener}. */ - public void addNotificationEntryListener(NotificationEntryListener listener) { - mNotificationEntryListeners.add(listener); - } - - /** - * Removes a {@link NotificationEntryListener} previously registered via - * {@link #addNotificationEntryListener(NotificationEntryListener)}. - */ - public void removeNotificationEntryListener(NotificationEntryListener listener) { - mNotificationEntryListeners.remove(listener); - } - - /** - * Update the notifications - * @param reason why the notifications are updating - */ - public void updateNotifications(String reason) { - mLogger.logUseWhileNewPipelineActive("updateNotifications", reason); - } - - /* - * ----- - * Annexed from NotificationData below: - * Some of these methods may be redundant but require some reworking to remove. For now - * we'll try to keep the behavior the same and can simplify these interfaces in another pass - */ - - /** Resorts / filters the current notification set with the current RankingMap */ - public void reapplyFilterAndSort(String reason) { - mLogger.logUseWhileNewPipelineActive("reapplyFilterAndSort", reason); - } - - /** dump the current active notification list. Called from CentralSurfaces */ - public void dump(PrintWriter pw, String indent) { - pw.println("NotificationEntryManager (Legacy)"); - int filteredLen = mSortedAndFiltered.size(); - pw.print(indent); - pw.println("active notifications: " + filteredLen); - int active; - for (active = 0; active < filteredLen; active++) { - NotificationEntry e = mSortedAndFiltered.get(active); - dumpEntry(pw, indent, active, e); - } - synchronized (mActiveNotifications) { - int totalLen = mActiveNotifications.size(); - pw.print(indent); - pw.println("inactive notifications: " + (totalLen - active)); - int inactiveCount = 0; - for (int i = 0; i < totalLen; i++) { - NotificationEntry entry = mActiveNotifications.valueAt(i); - if (!mSortedAndFiltered.contains(entry)) { - dumpEntry(pw, indent, inactiveCount, entry); - inactiveCount++; - } - } - } - } - - private void dumpEntry(PrintWriter pw, String indent, int i, NotificationEntry e) { - pw.print(indent); - pw.println(" [" + i + "] key=" + e.getKey() + " icon=" + e.getIcons().getStatusBarIcon()); - StatusBarNotification n = e.getSbn(); - pw.print(indent); - pw.println(" pkg=" + n.getPackageName() + " id=" + n.getId() + " importance=" - + e.getRanking().getImportance()); - pw.print(indent); - pw.println(" notification=" + n.getNotification()); - } - - public void addCollectionListener(@NonNull NotifCollectionListener listener) { - mNotifCollectionListeners.add(listener); - } - - public void removeCollectionListener(@NonNull NotifCollectionListener listener) { - mNotifCollectionListeners.remove(listener); - } - - /* - * End annexation - * ----- - */ - - - /** - * Provides access to keyguard state and user settings dependent data. - */ - public interface KeyguardEnvironment { - /** true if the device is provisioned (should always be true in practice) */ - boolean isDeviceProvisioned(); - /** true if the notification is for the current profiles */ - boolean isNotificationForCurrentProfiles(StatusBarNotification sbn); - } - - /** - * Used when a notification is removed and it doesn't have a reason that maps to one of the - * reasons defined in NotificationListenerService - * (e.g. {@link NotificationListenerService#REASON_CANCEL}) - */ - public static final int UNDEFINED_DISMISS_REASON = 0; -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt deleted file mode 100644 index 52dcf02e3a198..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 - -import com.android.systemui.log.LogBuffer -import com.android.systemui.log.LogLevel -import com.android.systemui.log.LogLevel.DEBUG -import com.android.systemui.log.LogLevel.INFO -import com.android.systemui.log.LogLevel.WARNING -import com.android.systemui.log.LogMessage -import com.android.systemui.log.dagger.NotificationLog -import com.android.systemui.util.Compile -import javax.inject.Inject - -/** Logger for [NotificationEntryManager]. */ -class NotificationEntryManagerLogger @Inject constructor( - notifPipelineFlags: NotifPipelineFlags, - @NotificationLog private val buffer: LogBuffer -) { - private val devLoggingEnabled by lazy { notifPipelineFlags.isDevLoggingEnabled() } - - private inline fun devLog( - level: LogLevel, - initializer: LogMessage.() -> Unit, - noinline printer: LogMessage.() -> String - ) { - if (Compile.IS_DEBUG && devLoggingEnabled) buffer.log(TAG, level, initializer, printer) - } - - fun logNotifAdded(key: String) { - devLog(INFO, { - str1 = key - }, { - "NOTIF ADDED $str1" - }) - } - - fun logNotifUpdated(key: String) { - devLog(INFO, { - str1 = key - }, { - "NOTIF UPDATED $str1" - }) - } - - fun logInflationAborted(key: String, status: String, reason: String) { - devLog(DEBUG, { - str1 = key - str2 = status - str3 = reason - }, { - "NOTIF INFLATION ABORTED $str1 notifStatus=$str2 reason=$str3" - }) - } - - fun logNotifInflated(key: String, isNew: Boolean) { - devLog(DEBUG, { - str1 = key - bool1 = isNew - }, { - "NOTIF INFLATED $str1 isNew=$bool1}" - }) - } - - fun logRemovalIntercepted(key: String) { - devLog(INFO, { - str1 = key - }, { - "NOTIF REMOVE INTERCEPTED for $str1" - }) - } - - fun logLifetimeExtended(key: String, extenderName: String, status: String) { - devLog(INFO, { - str1 = key - str2 = extenderName - str3 = status - }, { - "NOTIF LIFETIME EXTENDED $str1 extender=$str2 status=$str3" - }) - } - - fun logNotifRemoved(key: String, removedByUser: Boolean) { - devLog(INFO, { - str1 = key - bool1 = removedByUser - }, { - "NOTIF REMOVED $str1 removedByUser=$bool1" - }) - } - - fun logFilterAndSort(reason: String) { - devLog(INFO, { - str1 = reason - }, { - "FILTER AND SORT reason=$str1" - }) - } - - fun logUseWhileNewPipelineActive(method: String, reason: String) { - buffer.log(TAG, WARNING, { - str1 = method - str2 = reason - }, { - "While running New Pipeline: $str1(reason=$str2)" - }) - } -} - -private const val TAG = "NotificationEntryMgr" \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinator.kt index 9d0f974ea68f4..32150fc9bf87c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinator.kt @@ -20,11 +20,9 @@ import android.app.smartspace.SmartspaceTarget import android.os.Parcelable import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.statusbar.StatusBarStateController -import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController -import com.android.systemui.statusbar.notification.NotificationEntryManager import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.coordinator.dagger.CoordinatorScope @@ -44,14 +42,10 @@ import javax.inject.Inject * In addition, notifications that have recently alerted aren't filtered. Tracking this in a way * that involves the fewest pipeline invalidations requires some unfortunately complex logic. */ -// This class is a singleton so that the same instance can be accessed by both the old and new -// pipelines @CoordinatorScope class SmartspaceDedupingCoordinator @Inject constructor( private val statusBarStateController: SysuiStatusBarStateController, private val smartspaceController: LockscreenSmartspaceController, - private val notificationEntryManager: NotificationEntryManager, - private val notificationLockscreenUserManager: NotificationLockscreenUserManager, private val notifPipeline: NotifPipeline, @Main private val executor: DelayableExecutor, private val clock: SystemClock @@ -132,7 +126,6 @@ class SmartspaceDedupingCoordinator @Inject constructor( if (changed) { filter.invalidateList("onNewSmartspaceTargets") - notificationEntryManager.updateNotifications("Smartspace targets changed") } trackedSmartspaceTargets = newMap @@ -169,7 +162,6 @@ class SmartspaceDedupingCoordinator @Inject constructor( target.cancelTimeoutRunnable = null target.shouldFilter = true filter.invalidateList("updateAlertException: ${entry.logKey}") - notificationEntryManager.updateNotifications("deduping timeout expired") }, alertExceptionExpires - now) } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinder.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinder.java index d52f3c692b837..cdfd2f721b976 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinder.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinder.java @@ -19,12 +19,11 @@ package com.android.systemui.statusbar.notification.collection.inflation; import android.annotation.NonNull; import com.android.systemui.statusbar.notification.InflationException; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder; /** - * Used by the {@link NotificationEntryManager}. When notifications are added or updated, the binder + * Used by the {@link NotifInflater}. When notifications are added or updated, the binder * is asked to (re)inflate and prepare their views. This inflation must occur off the main thread. */ public interface NotificationRowBinder { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/CommonNotifCollection.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/CommonNotifCollection.java index 4ff6a64e0df86..fc7d682bcdf5e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/CommonNotifCollection.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/CommonNotifCollection.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.notification.collection.notifcollection; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -29,9 +28,8 @@ import java.util.Collection; * A notification collection that manages the list of {@link NotificationEntry}s that will be * rendered. * - * TODO: (b/145659174) Once we fully switch off {@link NotificationEntryManager} to - * {@link NotifPipeline}, we probably won't need this, but having it for now makes it easy to - * switch between the two. + * TODO: (b/145659174) Once we fully migrate to {@link NotifPipeline}, we probably won't need this, + * but having it for now makes it easy to switch between the two. */ public interface CommonNotifCollection { /** 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 index 9333c2ab3f557..da4cceda531f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java @@ -36,8 +36,6 @@ import com.android.systemui.shade.NotifPanelEventsModule; import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.notification.AssistantFeedbackController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; -import com.android.systemui.statusbar.notification.NotificationEntryManagerLogger; import com.android.systemui.statusbar.notification.collection.NotifInflaterImpl; import com.android.systemui.statusbar.notification.collection.NotifLiveDataStore; import com.android.systemui.statusbar.notification.collection.NotifLiveDataStoreImpl; @@ -106,14 +104,6 @@ public interface NotificationsModule { @Binds StackScrollAlgorithm.BypassController bindBypassController(KeyguardBypassController impl); - /** Provides an instance of {@link NotificationEntryManager} */ - @SysUISingleton - @Provides - static NotificationEntryManager provideNotificationEntryManager( - NotificationEntryManagerLogger logger) { - return new NotificationEntryManager(logger); - } - /** Provides an instance of {@link NotificationGutsManager} */ @SysUISingleton @Provides 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 index 3dcd3cbff0b4d..b2cb23bd11aa8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsController.kt @@ -23,7 +23,6 @@ import com.android.systemui.statusbar.notification.NotificationActivityStarter import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl import com.android.systemui.statusbar.notification.collection.render.NotifStackController import com.android.systemui.statusbar.notification.stack.NotificationListContainer -import java.io.PrintWriter /** * The master controller for all notifications-related work @@ -40,9 +39,7 @@ interface NotificationsController { bindRowCallback: NotificationRowBinderImpl.BindRowCallback ) - fun requestNotificationUpdate(reason: String) fun resetUserExpandedStates() fun setNotificationSnoozed(sbn: StatusBarNotification, snoozeOption: SnoozeOption) fun getActiveNotificationsCount(): Int - fun dump(pw: PrintWriter, args: Array, 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 index d38b6f9787bb3..1aa02951f3f7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.init import android.service.notification.StatusBarNotification +import com.android.systemui.ForegroundServiceNotificationListener import com.android.systemui.dagger.SysUISingleton import com.android.systemui.people.widget.PeopleSpaceWidgetManager import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption @@ -25,7 +26,6 @@ import com.android.systemui.statusbar.NotificationPresenter import com.android.systemui.statusbar.notification.AnimatedImageNotificationManager 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.collection.NotifLiveDataStore import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry @@ -41,7 +41,6 @@ import com.android.systemui.statusbar.notification.stack.NotificationListContain import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.wm.shell.bubbles.Bubbles import dagger.Lazy -import java.io.PrintWriter import java.util.Optional import javax.inject.Inject @@ -56,7 +55,6 @@ import javax.inject.Inject class NotificationsControllerImpl @Inject constructor( private val centralSurfaces: Lazy, private val notificationListener: NotificationListener, - private val entryManager: NotificationEntryManager, private val commonNotifCollection: Lazy, private val notifPipeline: Lazy, private val notifLiveDataStore: NotifLiveDataStore, @@ -69,6 +67,7 @@ class NotificationsControllerImpl @Inject constructor( private val animatedImageNotificationManager: AnimatedImageNotificationManager, private val peopleSpaceWidgetManager: PeopleSpaceWidgetManager, private val bubblesOptional: Optional, + private val fgsNotifListener: ForegroundServiceNotificationListener, ) : NotificationsController { override fun initialize( @@ -107,24 +106,11 @@ class NotificationsControllerImpl @Inject constructor( targetSdkResolver.initialize(notifPipeline.get()) peopleSpaceWidgetManager.attach(notificationListener) - } - - override fun dump( - pw: PrintWriter, - args: Array, - dumpTruck: Boolean - ) { - if (dumpTruck) { - entryManager.dump(pw, " ") - } + fgsNotifListener.init() } // TODO: Convert all functions below this line into listeners instead of public methods - override fun requestNotificationUpdate(reason: String) { - entryManager.updateNotifications(reason) - } - override fun resetUserExpandedStates() { // TODO: this is a view thing that should be done through the views, but that means doing it // both when this event is fired and any time a row is attached. 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 index 10da0d2291184..744166d879070 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerStub.kt @@ -24,7 +24,6 @@ import com.android.systemui.statusbar.notification.NotificationActivityStarter import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl import com.android.systemui.statusbar.notification.collection.render.NotifStackController import com.android.systemui.statusbar.notification.stack.NotificationListContainer -import java.io.PrintWriter import javax.inject.Inject /** @@ -46,9 +45,6 @@ class NotificationsControllerStub @Inject constructor( notificationListener.registerAsSystemService() } - override fun requestNotificationUpdate(reason: String) { - } - override fun resetUserExpandedStates() { } @@ -58,14 +54,4 @@ class NotificationsControllerStub @Inject constructor( override fun getActiveNotificationsCount(): Int { return 0 } - - override fun dump( - pw: PrintWriter, - args: Array, - dumpTruck: Boolean - ) { - pw.println() - pw.println("Notification handling disabled") - pw.println() - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index ec1e6207ef8fe..843a9ff2acb56 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -81,7 +81,6 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.LaunchAnimationParameters; import com.android.systemui.statusbar.notification.NotificationActivityStarter; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifCollection; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -155,7 +154,6 @@ public class NotificationStackScrollLayoutController { private final ScrimController mScrimController; private final NotifPipeline mNotifPipeline; private final NotifCollection mNotifCollection; - private final NotificationEntryManager mNotificationEntryManager; private final UiEventLogger mUiEventLogger; private final NotificationRemoteInputManager mRemoteInputManager; private final ShadeController mShadeController; @@ -307,7 +305,6 @@ public class NotificationStackScrollLayoutController { mView.updateSensitiveness(mStatusBarStateController.goingToFullShade(), mLockscreenUserManager.isAnyProfilePublicMode()); mView.onStatePostChange(mStatusBarStateController.fromShadeLocked()); - mNotificationEntryManager.updateNotifications("CentralSurfaces state changed"); } }; @@ -634,7 +631,6 @@ public class NotificationStackScrollLayoutController { @SilentHeader SectionHeaderController silentHeaderController, NotifPipeline notifPipeline, NotifCollection notifCollection, - NotificationEntryManager notificationEntryManager, LockscreenShadeTransitionController lockscreenShadeTransitionController, ShadeTransitionController shadeTransitionController, UiEventLogger uiEventLogger, @@ -676,7 +672,6 @@ public class NotificationStackScrollLayoutController { mSilentHeaderController = silentHeaderController; mNotifPipeline = notifPipeline; mNotifCollection = notifCollection; - mNotificationEntryManager = notificationEntryManager; mUiEventLogger = uiEventLogger; mRemoteInputManager = remoteInputManager; mShadeController = shadeController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index 5a8050814c8dc..d1b2974f6113b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -225,8 +225,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn boolean isShadeDisabled(); - void requestNotificationUpdate(String reason); - void requestFaceAuth(boolean userInitiatedRequest); @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 2031f36022afa..df6e545b868c6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -203,7 +203,6 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.core.StatusBarInitializer; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationActivityStarter; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.init.NotificationsController; @@ -508,7 +507,6 @@ public class CentralSurfacesImpl extends CoreStartable implements private boolean mExpandedVisible; - protected final NotificationEntryManager mEntryManager; private final NotificationGutsManager mGutsManager; private final NotificationLogger mNotificationLogger; private final PanelExpansionStateManager mPanelExpansionStateManager; @@ -681,7 +679,6 @@ public class CentralSurfacesImpl extends CoreStartable implements FalsingManager falsingManager, FalsingCollector falsingCollector, BroadcastDispatcher broadcastDispatcher, - NotificationEntryManager notificationEntryManager, NotificationGutsManager notificationGutsManager, NotificationLogger notificationLogger, NotificationInterruptStateProvider notificationInterruptStateProvider, @@ -768,7 +765,6 @@ public class CentralSurfacesImpl extends CoreStartable implements mFalsingCollector = falsingCollector; mFalsingManager = falsingManager; mBroadcastDispatcher = broadcastDispatcher; - mEntryManager = notificationEntryManager; mGutsManager = notificationGutsManager; mNotificationLogger = notificationLogger; mNotificationInterruptStateProvider = notificationInterruptStateProvider; @@ -839,11 +835,8 @@ public class CentralSurfacesImpl extends CoreStartable implements mPanelExpansionStateManager.addExpansionListener(this::onPanelExpansionChanged); - mBubbleExpandListener = - (isExpanding, key) -> mContext.getMainExecutor().execute(() -> { - mNotificationsController.requestNotificationUpdate("onBubbleExpandChanged"); - updateScrimController(); - }); + mBubbleExpandListener = (isExpanding, key) -> + mContext.getMainExecutor().execute(this::updateScrimController); mActivityIntentHelper = new ActivityIntentHelper(mContext); mActivityLaunchAnimator = activityLaunchAnimator; @@ -1615,15 +1608,6 @@ public class CentralSurfacesImpl extends CoreStartable implements return (mDisabled2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) != 0; } - /** - * Request a notification update - * @param reason why we're requesting a notification update - */ - @Override - public void requestNotificationUpdate(String reason) { - mNotificationsController.requestNotificationUpdate(reason); - } - /** * Asks {@link KeyguardUpdateMonitor} to run face auth. */ @@ -2328,8 +2312,6 @@ public class CentralSurfacesImpl extends CoreStartable implements mStatusBarKeyguardViewManager.dump(pw); } - mNotificationsController.dump(pw, args, DUMPTRUCK); - if (DEBUG_GESTURES) { pw.print(" status bar gestures: "); mGestureRec.dump(pw, args); @@ -4233,14 +4215,6 @@ public class CentralSurfacesImpl extends CoreStartable implements maybeEscalateHeadsUp(); } } - - // TODO: (b/145659174) remove when moving to NewNotifPipeline. Replaced by - // KeyguardCoordinator - @Override - public void onStrongAuthStateChanged(int userId) { - super.onStrongAuthStateChanged(userId); - mNotificationsController.requestNotificationUpdate("onStrongAuthStateChanged"); - } }; @@ -4429,7 +4403,6 @@ public class CentralSurfacesImpl extends CoreStartable implements updateQsExpansionEnabled(); mKeyguardViewMediator.setDozing(mDozing); - mNotificationsController.requestNotificationUpdate("onDozingChanged"); updateDozingState(); mDozeServiceHost.updateDozing(); updateScrimController(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java deleted file mode 100644 index 2c4fc6c6f7349..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardEnvironmentImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2018 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.phone; - -import static com.android.systemui.statusbar.phone.CentralSurfaces.DEBUG; -import static com.android.systemui.statusbar.phone.CentralSurfaces.MULTIUSER_DEBUG; - -import android.service.notification.StatusBarNotification; -import android.util.Log; - -import com.android.systemui.dagger.SysUISingleton; -import com.android.systemui.statusbar.NotificationLockscreenUserManager; -import com.android.systemui.statusbar.notification.NotificationEntryManager.KeyguardEnvironment; -import com.android.systemui.statusbar.policy.DeviceProvisionedController; - -import javax.inject.Inject; - -@SysUISingleton -public class KeyguardEnvironmentImpl implements KeyguardEnvironment { - - private static final String TAG = "KeyguardEnvironmentImpl"; - - private final NotificationLockscreenUserManager mLockscreenUserManager; - private final DeviceProvisionedController mDeviceProvisionedController; - - @Inject - public KeyguardEnvironmentImpl( - NotificationLockscreenUserManager notificationLockscreenUserManager, - DeviceProvisionedController deviceProvisionedController) { - mLockscreenUserManager = notificationLockscreenUserManager; - mDeviceProvisionedController = deviceProvisionedController; - } - - @Override // NotificationEntryManager.KeyguardEnvironment - public boolean isDeviceProvisioned() { - return mDeviceProvisionedController.isDeviceProvisioned(); - } - - @Override // NotificationEntryManager.KeyguardEnvironment - public boolean isNotificationForCurrentProfiles(StatusBarNotification n) { - final int notificationUserId = n.getUserId(); - if (DEBUG && MULTIUSER_DEBUG) { - Log.v(TAG, String.format("%s: current userid: %d, notification userid: %d", n, - mLockscreenUserManager.getCurrentUserId(), notificationUserId)); - } - return mLockscreenUserManager.isCurrentProfile(notificationUserId); - } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java index ebfbf54abe1ad..ae201e3ea8cf3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeadsUpChangeListener.java @@ -120,7 +120,6 @@ public class StatusBarHeadsUpChangeListener implements OnHeadsUpChangedListener @Override public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) { - mNotificationsController.requestNotificationUpdate("onHeadsUpStateChanged"); if (mStatusBarStateController.isDozing() && isHeadsUp) { entry.setPulseSuppressed(false); mDozeServiceHost.fireNotificationPulse(entry); 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 6996ee75ef304..64ca270558e88 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java @@ -33,8 +33,6 @@ import android.view.accessibility.AccessibilityManager; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.statusbar.IStatusBarService; -import com.android.systemui.Dependency; -import com.android.systemui.ForegroundServiceNotificationListener; import com.android.systemui.InitController; import com.android.systemui.R; import com.android.systemui.plugins.ActivityStarter; @@ -184,10 +182,6 @@ class StatusBarNotificationPresenter implements NotificationPresenter, mMediaManager.setUpWithPresenter(this); mGutsManager.setUpWithPresenter( this, mNotifListContainer, mOnSettingsClickListener); - // ForegroundServiceNotificationListener adds its listener in its constructor - // but we need to request it here in order for it to be instantiated. - // TODO: figure out how to do this correctly once Dependency.get() is gone. - Dependency.get(ForegroundServiceNotificationListener.class); onUserSwitched(mLockscreenUserManager.getCurrentUserId()); }); diff --git a/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java index abffe5550415d..27746c024dade 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java @@ -56,13 +56,11 @@ import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl; import com.android.systemui.statusbar.NotificationShadeWindowController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.provider.VisualStabilityProvider; import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager; import com.android.systemui.statusbar.phone.DozeServiceHost; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; -import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.BatteryController; @@ -151,10 +149,6 @@ public abstract class TvSystemUIModule { @Binds abstract DockManager bindDockManager(DockManagerImpl dockManager); - @Binds - abstract NotificationEntryManager.KeyguardEnvironment bindKeyguardEnvironment( - KeyguardEnvironmentImpl keyguardEnvironment); - @Binds abstract ShadeController provideShadeController(ShadeControllerImpl shadeController); diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java index ce9674175bd5c..8c41374fd058e 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java @@ -57,11 +57,9 @@ import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.notification.NotificationChannelHelper; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifCollection; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.notification.collection.coordinator.BubbleCoordinator; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.DismissedByUserStats; import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; @@ -460,11 +458,6 @@ public class BubblesManager { mBubbles.onNotificationChannelModified(pkg, user, channel, modificationType); } - /** - * Gets the DismissedByUserStats used by {@link NotificationEntryManager}. - * Will not be necessary when using the new notification pipeline's {@link NotifCollection}. - * Instead, this is taken care of by {@link BubbleCoordinator}. - */ private DismissedByUserStats getDismissedByUserStats( NotificationEntry entry, boolean isVisible) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java index ba21afdfab0f1..b47b08c2d14c2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java @@ -44,12 +44,10 @@ import androidx.test.filters.SmallTest; import com.android.internal.messages.nano.SystemMessageProto; import com.android.systemui.appops.AppOpsController; -import com.android.systemui.statusbar.notification.NotificationEntryListener; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; -import com.android.systemui.util.time.FakeSystemClock; +import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener; import org.junit.Before; import org.junit.Test; @@ -64,9 +62,7 @@ import org.mockito.MockitoAnnotations; public class ForegroundServiceControllerTest extends SysuiTestCase { private ForegroundServiceController mFsc; private ForegroundServiceNotificationListener mListener; - private NotificationEntryListener mEntryListener; - private final FakeSystemClock mClock = new FakeSystemClock(); - @Mock private NotificationEntryManager mEntryManager; + private NotifCollectionListener mCollectionListener; @Mock private AppOpsController mAppOpsController; @Mock private Handler mMainHandler; @Mock private NotifPipeline mNotifPipeline; @@ -79,12 +75,13 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { MockitoAnnotations.initMocks(this); mFsc = new ForegroundServiceController(mAppOpsController, mMainHandler); mListener = new ForegroundServiceNotificationListener( - mContext, mFsc, mEntryManager, mNotifPipeline, mClock); - ArgumentCaptor entryListenerCaptor = - ArgumentCaptor.forClass(NotificationEntryListener.class); - verify(mEntryManager).addNotificationEntryListener( + mContext, mFsc, mNotifPipeline); + mListener.init(); + ArgumentCaptor entryListenerCaptor = + ArgumentCaptor.forClass(NotifCollectionListener.class); + verify(mNotifPipeline).addCollectionListener( entryListenerCaptor.capture()); - mEntryListener = entryListenerCaptor.getValue(); + mCollectionListener = entryListenerCaptor.getValue(); } @Test @@ -449,7 +446,7 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { private NotificationEntry addFgEntry() { NotificationEntry entry = createFgEntry(); - mEntryListener.onPendingEntryAdded(entry); + mCollectionListener.onEntryAdded(entry); return entry; } @@ -461,12 +458,10 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { } private void entryRemoved(StatusBarNotification notification) { - mEntryListener.onEntryRemoved( + mCollectionListener.onEntryRemoved( new NotificationEntryBuilder() .setSbn(notification) .build(), - null, - false, REASON_APP_CANCEL); } @@ -475,7 +470,7 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { .setSbn(notification) .setImportance(importance) .build(); - mEntryListener.onPendingEntryAdded(entry); + mCollectionListener.onEntryAdded(entry); } private void entryUpdated(StatusBarNotification notification, int importance) { @@ -483,7 +478,7 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { .setSbn(notification) .setImportance(importance) .build(); - mEntryListener.onPreEntryUpdated(entry); + mCollectionListener.onEntryUpdated(entry); } @UserIdInt private static final int USERID_ONE = 10; // UserManagerService.MIN_USER_ID; diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java index e2ce939cb66ca..f2670131081ff 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -124,7 +124,6 @@ import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.events.PrivacyDotViewController; import com.android.systemui.statusbar.notification.ConversationNotificationManager; import com.android.systemui.statusbar.notification.DynamicPrivacyController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener; @@ -229,8 +228,6 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { @Mock private DynamicPrivacyController mDynamicPrivacyController; @Mock - private NotificationEntryManager mNotificationEntryManager; - @Mock private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; @Mock private KeyguardStateController mKeyguardStateController; @@ -517,7 +514,6 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mFeatureFlags, coordinator, expansionHandler, mDynamicPrivacyController, mKeyguardBypassController, mFalsingManager, new FalsingCollectorFake(), - mNotificationEntryManager, mKeyguardStateController, mStatusBarStateController, mStatusBarWindowStateController, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java index 0fd2e380cf2c0..5432a74035b7f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java @@ -28,12 +28,9 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.shade.ShadeController; -import com.android.systemui.statusbar.notification.NotificationEntryListener; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager.OnSettingsClickListener; -import com.android.systemui.statusbar.notification.row.NotificationInfo.CheckSaveListener; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import org.junit.Before; @@ -54,10 +51,8 @@ import org.mockito.MockitoAnnotations; public class NonPhoneDependencyTest extends SysuiTestCase { @Mock private NotificationPresenter mPresenter; @Mock private NotificationListContainer mListContainer; - @Mock private NotificationEntryListener mEntryListener; @Mock private RemoteInputController.Delegate mDelegate; @Mock private NotificationRemoteInputManager.Callback mRemoteInputManagerCallback; - @Mock private CheckSaveListener mCheckSaveListener; @Mock private OnSettingsClickListener mOnSettingsClickListener; @Before @@ -72,7 +67,6 @@ public class NonPhoneDependencyTest extends SysuiTestCase { @Test public void testNotificationManagementCodeHasNoDependencyOnStatusBarWindowManager() { mDependency.injectMockDependency(ShadeController.class); - NotificationEntryManager entryManager = Dependency.get(NotificationEntryManager.class); NotificationGutsManager gutsManager = Dependency.get(NotificationGutsManager.class); NotificationLogger notificationLogger = Dependency.get(NotificationLogger.class); NotificationMediaManager mediaManager = Dependency.get(NotificationMediaManager.class); @@ -80,7 +74,6 @@ public class NonPhoneDependencyTest extends SysuiTestCase { Dependency.get(NotificationRemoteInputManager.class); NotificationLockscreenUserManager lockscreenUserManager = Dependency.get(NotificationLockscreenUserManager.class); - entryManager.addNotificationEntryListener(mEntryListener); gutsManager.setUpWithPresenter(mPresenter, mListContainer, mOnSettingsClickListener); notificationLogger.setUpWithContainer(mListContainer); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java index 3cc4ee14b45f0..853d1df4b9bc5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java @@ -21,7 +21,6 @@ import static android.content.Intent.ACTION_USER_SWITCHED; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -54,7 +53,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationLockscreenUserManager.NotificationStateChangedListener; -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.notifcollection.CommonNotifCollection; @@ -84,8 +82,6 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { @Mock private NotificationVisibilityProvider mVisibilityProvider; @Mock - private NotificationEntryManager mEntryManager; - @Mock private CommonNotifCollection mNotifCollection; @Mock private DevicePolicyManager mDevicePolicyManager; @@ -114,7 +110,6 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { @Before public void setUp() { MockitoAnnotations.initMocks(this); - mDependency.injectTestDependency(NotificationEntryManager.class, mEntryManager); int currentUserId = ActivityManager.getCurrentUser(); mSettings = new FakeSettings(); @@ -148,12 +143,6 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { mLockscreenUserManager.setUpWithPresenter(mPresenter); } - @Test - public void testLockScreenShowNotificationsChangeUpdatesNotifications() { - mLockscreenUserManager.getLockscreenSettingsObserverForTest().onChange(false); - verify(mEntryManager, times(1)).updateNotifications(anyString()); - } - @Test public void testLockScreenShowNotificationsFalse() { mSettings.putInt(Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0); @@ -296,13 +285,6 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { assertTrue(mLockscreenUserManager.needsRedaction(mSecondaryUserNotif)); } - @Test - public void testSettingsObserverUpdatesNotifications() { - when(mDeviceProvisionedController.isDeviceProvisioned()).thenReturn(true); - mLockscreenUserManager.getSettingsObserverForTest().onChange(false); - verify(mEntryManager, times(1)).updateNotifications(anyString()); - } - @Test public void testActionUserSwitchedCallsOnUserSwitched() { Intent intent = new Intent() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java index 6e29669a227bc..5170678cbc622 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java @@ -23,8 +23,6 @@ import static org.mockito.Mockito.when; import android.app.Notification; import android.content.Context; -import android.os.Handler; -import android.os.Looper; import android.os.SystemClock; import android.os.UserHandle; import android.testing.AndroidTestingRunner; @@ -36,7 +34,6 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotifPipelineFlags; -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.render.NotificationVisibilityProvider; @@ -70,7 +67,6 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { @Mock private StatusBarStateController mStateController; @Mock private RemoteInputUriController mRemoteInputUriController; @Mock private NotificationClickNotifier mClickNotifier; - @Mock private NotificationEntryManager mEntryManager; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; private TestableNotificationRemoteInputManager mRemoteInputManager; @@ -85,11 +81,8 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { mLockscreenUserManager, mSmartReplyController, mVisibilityProvider, - mEntryManager, - mock(RemoteInputNotificationRebuilder.class), () -> Optional.of(mock(CentralSurfaces.class)), mStateController, - Handler.createAsync(Looper.myLooper()), mRemoteInputUriController, mClickNotifier, mock(ActionClickLogger.class), @@ -145,11 +138,8 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationVisibilityProvider visibilityProvider, - NotificationEntryManager notificationEntryManager, - RemoteInputNotificationRebuilder rebuilder, Lazy> centralSurfacesOptionalLazy, StatusBarStateController statusBarStateController, - Handler mainHandler, RemoteInputUriController remoteInputUriController, NotificationClickNotifier clickNotifier, ActionClickLogger actionClickLogger, @@ -160,7 +150,6 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { lockscreenUserManager, smartReplyController, visibilityProvider, - notificationEntryManager, centralSurfacesOptionalLazy, statusBarStateController, remoteInputUriController, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt index d4f05050b6dd0..8272f5a0d5b96 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SmartspaceDedupingCoordinatorTest.kt @@ -23,11 +23,9 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.plugins.BcSmartspaceDataPlugin.SmartspaceTargetListener import com.android.systemui.plugins.statusbar.StatusBarStateController -import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController -import com.android.systemui.statusbar.notification.NotificationEntryManager import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder @@ -46,7 +44,6 @@ import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.mockito.Mock -import org.mockito.Mockito.anyString import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.never import org.mockito.Mockito.verify @@ -61,10 +58,6 @@ class SmartspaceDedupingCoordinatorTest : SysuiTestCase() { @Mock private lateinit var smartspaceController: LockscreenSmartspaceController @Mock - private lateinit var notificationEntryManager: NotificationEntryManager - @Mock - private lateinit var notificationLockscreenUserManager: NotificationLockscreenUserManager - @Mock private lateinit var notifPipeline: NotifPipeline @Mock private lateinit var pluggableListener: Pluggable.PluggableListener @@ -99,12 +92,10 @@ class SmartspaceDedupingCoordinatorTest : SysuiTestCase() { deduper = SmartspaceDedupingCoordinator( statusBarStateController, smartspaceController, - notificationEntryManager, - notificationLockscreenUserManager, notifPipeline, executor, clock - ) + ) // Attach the deduper and capture the listeners/filters that it registers deduper.attach(notifPipeline) @@ -352,7 +343,6 @@ class SmartspaceDedupingCoordinatorTest : SysuiTestCase() { // THEN the new pipeline is invalidated (but the old one isn't because it's not // necessary) because the notif should no longer be filtered out verify(pluggableListener).onPluggableInvalidated(eq(filter), any()) - verify(notificationEntryManager, never()).updateNotifications(anyString()) assertFalse(filter.shouldFilterOut(entry2HasNotRecentlyAlerted, now)) } @@ -390,7 +380,6 @@ class SmartspaceDedupingCoordinatorTest : SysuiTestCase() { private fun verifyPipelinesInvalidated() { verify(pluggableListener).onPluggableInvalidated(eq(filter), any()) - verify(notificationEntryManager).updateNotifications(anyString()) } private fun assertExecutorIsClear() { @@ -399,12 +388,10 @@ class SmartspaceDedupingCoordinatorTest : SysuiTestCase() { private fun verifyPipelinesNotInvalidated() { verify(pluggableListener, never()).onPluggableInvalidated(eq(filter), any()) - verify(notificationEntryManager, never()).updateNotifications(anyString()) } private fun clearPipelineInvocations() { clearInvocations(pluggableListener) - clearInvocations(notificationEntryManager) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java index 8a7b9d3b60242..b2dc842bc942e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java @@ -44,8 +44,6 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarStateControllerImpl; -import com.android.systemui.statusbar.notification.NotifPipelineFlags; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifLiveData; import com.android.systemui.statusbar.notification.collection.NotifLiveDataStore; import com.android.systemui.statusbar.notification.collection.NotifPipeline; @@ -85,11 +83,9 @@ public class NotificationLoggerTest extends SysuiTestCase { @Mock private NotificationLogger.ExpansionStateLogger mExpansionStateLogger; // Dependency mocks: - @Mock private NotifPipelineFlags mNotifPipelineFlags; @Mock private NotifLiveDataStore mNotifLiveDataStore; @Mock private NotifLiveData> mActiveNotifEntries; @Mock private NotificationVisibilityProvider mVisibilityProvider; - @Mock private NotificationEntryManager mEntryManager; @Mock private NotifPipeline mNotifPipeline; @Mock private NotificationListener mListener; @@ -118,17 +114,14 @@ public class NotificationLoggerTest extends SysuiTestCase { mLogger = new TestableNotificationLogger( mListener, mUiBgExecutor, - mNotifPipelineFlags, mNotifLiveDataStore, mVisibilityProvider, - mEntryManager, mNotifPipeline, mock(StatusBarStateControllerImpl.class), mBarService, mExpansionStateLogger ); mLogger.setUpWithContainer(mListContainer); - verify(mEntryManager, never()).addNotificationEntryListener(any()); verify(mNotifPipeline).addCollectionListener(any()); } @@ -266,10 +259,8 @@ public class NotificationLoggerTest extends SysuiTestCase { TestableNotificationLogger(NotificationListener notificationListener, Executor uiBgExecutor, - NotifPipelineFlags notifPipelineFlags, NotifLiveDataStore notifLiveDataStore, NotificationVisibilityProvider visibilityProvider, - NotificationEntryManager entryManager, NotifPipeline notifPipeline, StatusBarStateControllerImpl statusBarStateController, IStatusBarService barService, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java index fe2f5f0237ea8..6d687a62b077b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FeedbackInfoTest.java @@ -57,7 +57,6 @@ import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.statusbar.notification.AssistantFeedbackController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; @@ -83,8 +82,6 @@ public class FeedbackInfoTest extends SysuiTestCase { mock(AssistantFeedbackController.class); private StatusBarNotification mSbn; - @Mock - private NotificationEntryManager mNotificationEntryManager; @Mock private IStatusBarService mStatusBarService; @Mock @@ -94,7 +91,6 @@ public class FeedbackInfoTest extends SysuiTestCase { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - mDependency.injectTestDependency(NotificationEntryManager.class, mNotificationEntryManager); mDependency.injectTestDependency(IStatusBarService.class, mStatusBarService); mDependency.injectTestDependency(NotificationGutsManager.class, mNotificationGutsManager); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java index 966e233fa4109..8be9eb57aa9b9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java @@ -58,7 +58,6 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotifCollection; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager; @@ -119,7 +118,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { @Mock private SectionHeaderController mSilentHeaderController; @Mock private NotifPipeline mNotifPipeline; @Mock private NotifCollection mNotifCollection; - @Mock private NotificationEntryManager mEntryManager; @Mock private UiEventLogger mUiEventLogger; @Mock private LockscreenShadeTransitionController mLockscreenShadeTransitionController; @Mock private NotificationRemoteInputManager mRemoteInputManager; @@ -168,7 +166,6 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { mSilentHeaderController, mNotifPipeline, mNotifCollection, - mEntryManager, mLockscreenShadeTransitionController, mShadeTransitionController, mUiEventLogger, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index 735a88dc0ab74..14b74712ec437 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -127,7 +127,6 @@ import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarStateControllerImpl; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotifPipelineFlags; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotifLiveDataStore; import com.android.systemui.statusbar.notification.collection.NotifPipeline; @@ -223,7 +222,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { @Mock private NotificationShadeWindowView mNotificationShadeWindowView; @Mock private BroadcastDispatcher mBroadcastDispatcher; @Mock private AssistManager mAssistManager; - @Mock private NotificationEntryManager mNotificationEntryManager; @Mock private NotificationGutsManager mNotificationGutsManager; @Mock private NotificationMediaManager mNotificationMediaManager; @Mock private NavigationBarController mNavigationBarController; @@ -397,7 +395,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { new FalsingManagerFake(), new FalsingCollectorFake(), mBroadcastDispatcher, - mNotificationEntryManager, mNotificationGutsManager, notificationLogger, mNotificationInterruptStateProvider, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java index 2b805089a4309..c4098578197ba 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java @@ -66,7 +66,6 @@ import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.StatusBarState; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider; import com.android.systemui.statusbar.notification.collection.NotifPipeline; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -102,8 +101,6 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { @Mock private AssistManager mAssistManager; @Mock - private NotificationEntryManager mEntryManager; - @Mock private ActivityStarter mActivityStarter; @Mock private NotificationClickNotifier mClickNotifier; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java index 1ec4de9b573ee..c3a7e65f46973 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java @@ -37,7 +37,6 @@ import com.android.systemui.statusbar.ActionClickLogger; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.SysuiStatusBarStateController; -import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.DeviceProvisionedController; @@ -55,7 +54,6 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper public class StatusBarRemoteInputCallbackTest extends SysuiTestCase { - @Mock private NotificationEntryManager mEntryManager; @Mock private DeviceProvisionedController mDeviceProvisionedController; @Mock private com.android.systemui.shade.ShadeController mShadeController; @Mock private NotificationLockscreenUserManager mNotificationLockscreenUserManager; @@ -71,7 +69,6 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase { @Before public void setUp() { MockitoAnnotations.initMocks(this); - mDependency.injectTestDependency(NotificationEntryManager.class, mEntryManager); mDependency.injectTestDependency(DeviceProvisionedController.class, mDeviceProvisionedController); mDependency.injectTestDependency(ShadeController.class, mShadeController);