diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index 1311abe971670..fa2ef30f7b02d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -51,12 +51,12 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; -import com.android.systemui.flags.FeatureFlags; 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; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -89,8 +89,8 @@ public class NotificationLockscreenUserManagerImpl implements // Lazy private NotificationEntryManager mEntryManager; - private final FeatureFlags mFeatureFlags; private final Lazy mVisibilityProviderLazy; + private final Lazy mCommonNotifCollectionLazy; private final DevicePolicyManager mDevicePolicyManager; private final SparseBooleanArray mLockscreenPublicMode = new SparseBooleanArray(); private final SparseBooleanArray mUsersWithSeperateWorkChallenge = new SparseBooleanArray(); @@ -195,11 +195,11 @@ public class NotificationLockscreenUserManagerImpl implements @Inject public NotificationLockscreenUserManagerImpl(Context context, - FeatureFlags featureFlags, BroadcastDispatcher broadcastDispatcher, DevicePolicyManager devicePolicyManager, UserManager userManager, Lazy visibilityProviderLazy, + Lazy commonNotifCollectionLazy, NotificationClickNotifier clickNotifier, KeyguardManager keyguardManager, StatusBarStateController statusBarStateController, @@ -208,12 +208,12 @@ public class NotificationLockscreenUserManagerImpl implements KeyguardStateController keyguardStateController, DumpManager dumpManager) { mContext = context; - mFeatureFlags = featureFlags; mMainHandler = mainHandler; mDevicePolicyManager = devicePolicyManager; mUserManager = userManager; mCurrentUserId = ActivityManager.getCurrentUser(); mVisibilityProviderLazy = visibilityProviderLazy; + mCommonNotifCollectionLazy = commonNotifCollectionLazy; mClickNotifier = clickNotifier; statusBarStateController.addCallback(this); mLockPatternUtils = new LockPatternUtils(context); @@ -339,22 +339,18 @@ public class NotificationLockscreenUserManagerImpl implements * package-specific override. */ public boolean shouldHideNotifications(String key) { - // TODO(b/204764178): support new pipeline - mFeatureFlags.checkLegacyPipelineEnabled(); - if (getEntryManager() == null) { - Log.wtf(TAG, "mEntryManager was null!", new Throwable()); + if (mCommonNotifCollectionLazy.get() == null) { + Log.wtf(TAG, "mCommonNotifCollectionLazy was null!", new Throwable()); return true; } - NotificationEntry visibleEntry = getEntryManager().getActiveNotificationUnfiltered(key); + NotificationEntry visibleEntry = mCommonNotifCollectionLazy.get().getEntry(key); return isLockscreenPublicMode(mCurrentUserId) && visibleEntry != null && visibleEntry.getRanking().getLockscreenVisibilityOverride() == VISIBILITY_SECRET; } public boolean shouldShowOnKeyguard(NotificationEntry entry) { - // TODO(b/204764178): support new pipeline - mFeatureFlags.checkLegacyPipelineEnabled(); - if (getEntryManager() == null) { - Log.wtf(TAG, "mEntryManager was null!", new Throwable()); + if (mCommonNotifCollectionLazy.get() == null) { + Log.wtf(TAG, "mCommonNotifCollectionLazy was null!", new Throwable()); return false; } for (int i = 0; i < mKeyguardSuppressors.size(); i++) { @@ -526,13 +522,11 @@ public class NotificationLockscreenUserManagerImpl implements } private boolean packageHasVisibilityOverride(String key) { - // TODO(b/204764178): support new pipeline - mFeatureFlags.checkLegacyPipelineEnabled(); - if (getEntryManager() == null) { + if (mCommonNotifCollectionLazy.get() == null) { Log.wtf(TAG, "mEntryManager was null!", new Throwable()); return true; } - NotificationEntry entry = getEntryManager().getActiveNotificationUnfiltered(key); + NotificationEntry entry = mCommonNotifCollectionLazy.get().getEntry(key); return entry != null && entry.getRanking().getLockscreenVisibilityOverride() == Notification.VISIBILITY_PRIVATE; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java index a0daf8c255697..82f35a814d226 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -721,8 +721,12 @@ public class NotificationEntryManager implements * @param reason why the notifications are updating */ public void updateNotifications(String reason) { + if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) { + mLogger.logUseWhileNewPipelineActive("updateNotifications", reason); + return; + } reapplyFilterAndSort(reason); - if (mPresenter != null && !mFeatureFlags.isNewNotifPipelineRenderingEnabled()) { + if (mPresenter != null) { mPresenter.updateNotificationViews(reason); } } @@ -880,11 +884,19 @@ public class NotificationEntryManager implements /** Resorts / filters the current notification set with the current RankingMap */ public void reapplyFilterAndSort(String reason) { + if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) { + mLogger.logUseWhileNewPipelineActive("reapplyFilterAndSort", reason); + return; + } updateRankingAndSort(mRanker.getRankingMap(), reason); } /** Calls to NotificationRankingManager and updates mSortedAndFiltered */ private void updateRankingAndSort(@NonNull RankingMap rankingMap, String reason) { + if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) { + mLogger.logUseWhileNewPipelineActive("updateRankingAndSort", reason); + return; + } mSortedAndFiltered.clear(); mSortedAndFiltered.addAll(mRanker.updateRanking( rankingMap, mActiveNotifications.values(), reason)); @@ -892,7 +904,7 @@ public class NotificationEntryManager implements /** dump the current active notification list. Called from StatusBar */ public void dump(PrintWriter pw, String indent) { - pw.println("NotificationEntryManager"); + pw.println("NotificationEntryManager (Legacy)"); int filteredLen = mSortedAndFiltered.size(); pw.print(indent); pw.println("active notifications: " + filteredLen); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt index 4382ab50390a3..2397005a1a61a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManagerLogger.kt @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification import com.android.systemui.log.LogBuffer 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.dagger.NotificationLog import javax.inject.Inject @@ -95,6 +96,15 @@ class NotificationEntryManagerLogger @Inject constructor( "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/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java index 0946ffddf709b..48f820626face 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java @@ -57,12 +57,12 @@ import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dump.DumpManager; -import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationLockscreenUserManager.KeyguardNotificationSuppressor; 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; import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -90,6 +90,8 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { @Mock private NotificationEntryManager mEntryManager; @Mock + private CommonNotifCollection mNotifCollection; + @Mock private DevicePolicyManager mDevicePolicyManager; @Mock private NotificationClickNotifier mClickNotifier; @@ -100,8 +102,6 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { @Mock private StatusBarStateController mStatusBarStateController; @Mock - private FeatureFlags mFeatureFlags; - @Mock private BroadcastDispatcher mBroadcastDispatcher; @Mock private KeyguardStateController mKeyguardStateController; @@ -422,11 +422,11 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { public TestNotificationLockscreenUserManager(Context context) { super( context, - mFeatureFlags, mBroadcastDispatcher, mDevicePolicyManager, mUserManager, (() -> mVisibilityProvider), + (() -> mNotifCollection), mClickNotifier, NotificationLockscreenUserManagerTest.this.mKeyguardManager, mStatusBarStateController,