Loading packages/SystemUI/res/values/flags.xml +2 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,6 @@ <bool name="flag_ongoing_call_status_bar_chip">true</bool> <bool name="flag_smartspace">false</bool> <bool name="flag_smartspace_deduping">true</bool> </resources> packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +4 −0 Original line number Diff line number Diff line Loading @@ -92,4 +92,8 @@ public class FeatureFlags { public boolean isSmartspaceEnabled() { return mFlagReader.isEnabled(R.bool.flag_smartspace); } public boolean isSmartspaceDedupingEnabled() { return isSmartspaceEnabled() && mFlagReader.isEnabled(R.bool.flag_smartspace_deduping); } } packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,12 @@ public interface NotificationLockscreenUserManager { /** Adds a listener to be notified when the current user changes. */ void addUserChangedListener(UserChangedListener listener); /** * Registers a [KeyguardNotificationSuppressor] that will be consulted during * {@link #shouldShowOnKeyguard(NotificationEntry)} */ void addKeyguardNotificationSuppressor(KeyguardNotificationSuppressor suppressor); /** * Removes a listener previously registered with * {@link #addUserChangedListener(UserChangedListener)} Loading Loading @@ -88,4 +94,9 @@ public interface NotificationLockscreenUserManager { default void onUserChanged(int userId) {} default void onCurrentProfilesChanged(SparseArray<UserInfo> currentProfiles) {} } /** Used to hide notifications on the lockscreen */ interface KeyguardNotificationSuppressor { boolean shouldSuppressOnKeyguard(NotificationEntry entry); } } packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +11 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class NotificationLockscreenUserManagerImpl implements private LockPatternUtils mLockPatternUtils; protected KeyguardManager mKeyguardManager; private int mState = StatusBarState.SHADE; private List<KeyguardNotificationSuppressor> mKeyguardSuppressors = new ArrayList<>(); protected final BroadcastReceiver mAllUsersReceiver = new BroadcastReceiver() { @Override Loading Loading @@ -343,6 +344,11 @@ public class NotificationLockscreenUserManagerImpl implements Log.wtf(TAG, "mEntryManager was null!", new Throwable()); return false; } for (int i = 0; i < mKeyguardSuppressors.size(); i++) { if (mKeyguardSuppressors.get(i).shouldSuppressOnKeyguard(entry)) { return false; } } boolean exceedsPriorityThreshold; if (hideSilentNotificationsOnLockscreen()) { exceedsPriorityThreshold = Loading Loading @@ -620,6 +626,11 @@ public class NotificationLockscreenUserManagerImpl implements mListeners.add(listener); } @Override public void addKeyguardNotificationSuppressor(KeyguardNotificationSuppressor suppressor) { mKeyguardSuppressors.add(suppressor); } @Override public void removeUserChangedListener(UserChangedListener listener) { mListeners.remove(listener); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +11 −19 Original line number Diff line number Diff line Loading @@ -46,8 +46,9 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationRemoveInterceptor; import com.android.systemui.statusbar.NotificationUiAdjustment; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationRankingManager; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder; import com.android.systemui.statusbar.notification.collection.legacy.LegacyNotificationRanker; import com.android.systemui.statusbar.notification.collection.legacy.LegacyNotificationRankerStub; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; Loading Loading @@ -138,12 +139,11 @@ public class NotificationEntryManager implements private final LeakDetector mLeakDetector; private final List<NotifCollectionListener> mNotifCollectionListeners = new ArrayList<>(); private final KeyguardEnvironment mKeyguardEnvironment; private final NotificationGroupManagerLegacy mGroupManager; private final Lazy<NotificationRankingManager> mRankingManager; private final FeatureFlags mFeatureFlags; private final ForegroundServiceDismissalFeatureController mFgsFeatureController; private LegacyNotificationRanker mRanker = new LegacyNotificationRankerStub(); private NotificationPresenter mPresenter; private RankingMap mLatestRankingMap; Loading Loading @@ -200,8 +200,6 @@ public class NotificationEntryManager implements public NotificationEntryManager( NotificationEntryManagerLogger logger, NotificationGroupManagerLegacy groupManager, Lazy<NotificationRankingManager> rankingManager, KeyguardEnvironment keyguardEnvironment, FeatureFlags featureFlags, Lazy<NotificationRowBinder> notificationRowBinderLazy, Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy, Loading @@ -211,8 +209,6 @@ public class NotificationEntryManager implements ) { mLogger = logger; mGroupManager = groupManager; mRankingManager = rankingManager; mKeyguardEnvironment = keyguardEnvironment; mFeatureFlags = featureFlags; mNotificationRowBinderLazy = notificationRowBinderLazy; mRemoteInputManagerLazy = notificationRemoteInputManagerLazy; Loading @@ -226,6 +222,10 @@ public class NotificationEntryManager implements notificationListener.addNotificationHandler(mNotifListener); } public void setRanker(LegacyNotificationRanker ranker) { mRanker = ranker; } /** Adds a {@link NotificationEntryListener}. */ public void addNotificationEntryListener(NotificationEntryListener listener) { mNotificationEntryListeners.add(listener); Loading Loading @@ -419,7 +419,7 @@ public class NotificationEntryManager implements mActiveNotifications.put(entry.getKey(), entry); mGroupManager.onEntryAdded(entry); updateRankingAndSort(mRankingManager.get().getRankingMap(), "addEntryInternalInternal"); updateRankingAndSort(mRanker.getRankingMap(), "addEntryInternalInternal"); } /** Loading Loading @@ -698,13 +698,6 @@ public class NotificationEntryManager implements updateNotifications("updateNotificationInternal"); if (DEBUG) { // Is this for you? boolean isForCurrentUser = mKeyguardEnvironment .isNotificationForCurrentProfiles(notification); Log.d(TAG, "notification is " + (isForCurrentUser ? "" : "not ") + "for you"); } for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onPostEntryUpdated(entry); } Loading Loading @@ -862,8 +855,7 @@ public class NotificationEntryManager implements final int len = mActiveNotifications.size(); for (int i = 0; i < len; i++) { NotificationEntry entry = mActiveNotifications.valueAt(i); final StatusBarNotification sbn = entry.getSbn(); if (!mKeyguardEnvironment.isNotificationForCurrentProfiles(sbn)) { if (!mRanker.isNotificationForCurrentProfiles(entry)) { continue; } filtered.add(entry); Loading @@ -886,13 +878,13 @@ public class NotificationEntryManager implements /** Resorts / filters the current notification set with the current RankingMap */ public void reapplyFilterAndSort(String reason) { updateRankingAndSort(mRankingManager.get().getRankingMap(), reason); updateRankingAndSort(mRanker.getRankingMap(), reason); } /** Calls to NotificationRankingManager and updates mSortedAndFiltered */ private void updateRankingAndSort(@NonNull RankingMap rankingMap, String reason) { mSortedAndFiltered.clear(); mSortedAndFiltered.addAll(mRankingManager.get().updateRanking( mSortedAndFiltered.addAll(mRanker.updateRanking( rankingMap, mActiveNotifications.values(), reason)); } Loading Loading
packages/SystemUI/res/values/flags.xml +2 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,6 @@ <bool name="flag_ongoing_call_status_bar_chip">true</bool> <bool name="flag_smartspace">false</bool> <bool name="flag_smartspace_deduping">true</bool> </resources>
packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +4 −0 Original line number Diff line number Diff line Loading @@ -92,4 +92,8 @@ public class FeatureFlags { public boolean isSmartspaceEnabled() { return mFlagReader.isEnabled(R.bool.flag_smartspace); } public boolean isSmartspaceDedupingEnabled() { return isSmartspaceEnabled() && mFlagReader.isEnabled(R.bool.flag_smartspace_deduping); } }
packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,12 @@ public interface NotificationLockscreenUserManager { /** Adds a listener to be notified when the current user changes. */ void addUserChangedListener(UserChangedListener listener); /** * Registers a [KeyguardNotificationSuppressor] that will be consulted during * {@link #shouldShowOnKeyguard(NotificationEntry)} */ void addKeyguardNotificationSuppressor(KeyguardNotificationSuppressor suppressor); /** * Removes a listener previously registered with * {@link #addUserChangedListener(UserChangedListener)} Loading Loading @@ -88,4 +94,9 @@ public interface NotificationLockscreenUserManager { default void onUserChanged(int userId) {} default void onCurrentProfilesChanged(SparseArray<UserInfo> currentProfiles) {} } /** Used to hide notifications on the lockscreen */ interface KeyguardNotificationSuppressor { boolean shouldSuppressOnKeyguard(NotificationEntry entry); } }
packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +11 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class NotificationLockscreenUserManagerImpl implements private LockPatternUtils mLockPatternUtils; protected KeyguardManager mKeyguardManager; private int mState = StatusBarState.SHADE; private List<KeyguardNotificationSuppressor> mKeyguardSuppressors = new ArrayList<>(); protected final BroadcastReceiver mAllUsersReceiver = new BroadcastReceiver() { @Override Loading Loading @@ -343,6 +344,11 @@ public class NotificationLockscreenUserManagerImpl implements Log.wtf(TAG, "mEntryManager was null!", new Throwable()); return false; } for (int i = 0; i < mKeyguardSuppressors.size(); i++) { if (mKeyguardSuppressors.get(i).shouldSuppressOnKeyguard(entry)) { return false; } } boolean exceedsPriorityThreshold; if (hideSilentNotificationsOnLockscreen()) { exceedsPriorityThreshold = Loading Loading @@ -620,6 +626,11 @@ public class NotificationLockscreenUserManagerImpl implements mListeners.add(listener); } @Override public void addKeyguardNotificationSuppressor(KeyguardNotificationSuppressor suppressor) { mKeyguardSuppressors.add(suppressor); } @Override public void removeUserChangedListener(UserChangedListener listener) { mListeners.remove(listener); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +11 −19 Original line number Diff line number Diff line Loading @@ -46,8 +46,9 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationRemoveInterceptor; import com.android.systemui.statusbar.NotificationUiAdjustment; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationRankingManager; import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder; import com.android.systemui.statusbar.notification.collection.legacy.LegacyNotificationRanker; import com.android.systemui.statusbar.notification.collection.legacy.LegacyNotificationRankerStub; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; Loading Loading @@ -138,12 +139,11 @@ public class NotificationEntryManager implements private final LeakDetector mLeakDetector; private final List<NotifCollectionListener> mNotifCollectionListeners = new ArrayList<>(); private final KeyguardEnvironment mKeyguardEnvironment; private final NotificationGroupManagerLegacy mGroupManager; private final Lazy<NotificationRankingManager> mRankingManager; private final FeatureFlags mFeatureFlags; private final ForegroundServiceDismissalFeatureController mFgsFeatureController; private LegacyNotificationRanker mRanker = new LegacyNotificationRankerStub(); private NotificationPresenter mPresenter; private RankingMap mLatestRankingMap; Loading Loading @@ -200,8 +200,6 @@ public class NotificationEntryManager implements public NotificationEntryManager( NotificationEntryManagerLogger logger, NotificationGroupManagerLegacy groupManager, Lazy<NotificationRankingManager> rankingManager, KeyguardEnvironment keyguardEnvironment, FeatureFlags featureFlags, Lazy<NotificationRowBinder> notificationRowBinderLazy, Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy, Loading @@ -211,8 +209,6 @@ public class NotificationEntryManager implements ) { mLogger = logger; mGroupManager = groupManager; mRankingManager = rankingManager; mKeyguardEnvironment = keyguardEnvironment; mFeatureFlags = featureFlags; mNotificationRowBinderLazy = notificationRowBinderLazy; mRemoteInputManagerLazy = notificationRemoteInputManagerLazy; Loading @@ -226,6 +222,10 @@ public class NotificationEntryManager implements notificationListener.addNotificationHandler(mNotifListener); } public void setRanker(LegacyNotificationRanker ranker) { mRanker = ranker; } /** Adds a {@link NotificationEntryListener}. */ public void addNotificationEntryListener(NotificationEntryListener listener) { mNotificationEntryListeners.add(listener); Loading Loading @@ -419,7 +419,7 @@ public class NotificationEntryManager implements mActiveNotifications.put(entry.getKey(), entry); mGroupManager.onEntryAdded(entry); updateRankingAndSort(mRankingManager.get().getRankingMap(), "addEntryInternalInternal"); updateRankingAndSort(mRanker.getRankingMap(), "addEntryInternalInternal"); } /** Loading Loading @@ -698,13 +698,6 @@ public class NotificationEntryManager implements updateNotifications("updateNotificationInternal"); if (DEBUG) { // Is this for you? boolean isForCurrentUser = mKeyguardEnvironment .isNotificationForCurrentProfiles(notification); Log.d(TAG, "notification is " + (isForCurrentUser ? "" : "not ") + "for you"); } for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onPostEntryUpdated(entry); } Loading Loading @@ -862,8 +855,7 @@ public class NotificationEntryManager implements final int len = mActiveNotifications.size(); for (int i = 0; i < len; i++) { NotificationEntry entry = mActiveNotifications.valueAt(i); final StatusBarNotification sbn = entry.getSbn(); if (!mKeyguardEnvironment.isNotificationForCurrentProfiles(sbn)) { if (!mRanker.isNotificationForCurrentProfiles(entry)) { continue; } filtered.add(entry); Loading @@ -886,13 +878,13 @@ public class NotificationEntryManager implements /** Resorts / filters the current notification set with the current RankingMap */ public void reapplyFilterAndSort(String reason) { updateRankingAndSort(mRankingManager.get().getRankingMap(), reason); updateRankingAndSort(mRanker.getRankingMap(), reason); } /** Calls to NotificationRankingManager and updates mSortedAndFiltered */ private void updateRankingAndSort(@NonNull RankingMap rankingMap, String reason) { mSortedAndFiltered.clear(); mSortedAndFiltered.addAll(mRankingManager.get().updateRanking( mSortedAndFiltered.addAll(mRanker.updateRanking( rankingMap, mActiveNotifications.values(), reason)); } Loading