diff --git a/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java b/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java index c205bb49228cd..53a88a9a54e9b 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/CarNotificationEntryManager.java @@ -20,6 +20,7 @@ import android.service.notification.StatusBarNotification; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationData; +import com.android.systemui.statusbar.notification.logging.NotifLog; import javax.inject.Inject; import javax.inject.Singleton; @@ -34,8 +35,8 @@ import javax.inject.Singleton; public class CarNotificationEntryManager extends NotificationEntryManager { @Inject - public CarNotificationEntryManager(NotificationData notificationData) { - super(notificationData); + public CarNotificationEntryManager(NotificationData notificationData, NotifLog notifLog) { + super(notificationData, notifLog); } @Override diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index cc6e842598932..681d8f543575d 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -108,6 +108,7 @@ import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.VisualStabilityManager; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.phone.AutoHideController; @@ -296,7 +297,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt NotificationListener notificationListener, ConfigurationController configurationController, StatusBarWindowController statusBarWindowController, - StatusBarWindowViewController.Builder statusBarWindowViewControllerBuild) { + StatusBarWindowViewController.Builder statusBarWindowViewControllerBuild, + NotifLog notifLog) { super( lightBarController, autoHideController, @@ -350,7 +352,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt notificationListener, configurationController, statusBarWindowController, - statusBarWindowViewControllerBuild); + statusBarWindowViewControllerBuild, + notifLog); mNavigationBarController = navigationBarController; } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 8240345070195..cc548d0c7f8ef 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -569,7 +569,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (mStackView != null) { mStackView.updateDotVisibility(entry.key); } - mNotificationEntryManager.updateNotifications(); + mNotificationEntryManager.updateNotifications( + "BubbleController.onNotificationRemoveRequested"); return true; } else if (!userRemovedNotif && entry != null) { // This wasn't a user removal so we should remove the bubble as well @@ -609,7 +610,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mBubbleData.addSummaryToSuppress(summary.notification.getGroupKey(), summary.key); // Tell shade to update for the suppression - mNotificationEntryManager.updateNotifications(); + mNotificationEntryManager.updateNotifications( + "BubbleController.handleSummaryRemovalInterception"); } return !isAutogroupSummary; } else { @@ -760,7 +762,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mStackView.setExpanded(true); } - mNotificationEntryManager.updateNotifications(); + mNotificationEntryManager.updateNotifications( + "BubbleData.Listener.applyUpdate"); updateStack(); if (DEBUG_BUBBLE_CONTROLLER) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java index 6c0f90a65ae9f..c4de2d3572bd7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java @@ -127,7 +127,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { mEntryManager.removeNotification(key, rankingMap, UNDEFINED_DISMISS_REASON); } else { mEntryManager.getNotificationData() - .updateRanking(rankingMap); + .updateRanking(rankingMap, "onNotificationPosted"); } return; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index 4ba1114360480..6ffea79c420a3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -106,7 +106,7 @@ public class NotificationLockscreenUserManagerImpl implements isCurrentProfile(getSendingUserId())) { mUsersAllowingPrivateNotifications.clear(); updateLockscreenNotificationSetting(); - getEntryManager().updateNotifications(); + getEntryManager().updateNotifications("ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED"); } } }; @@ -124,7 +124,7 @@ public class NotificationLockscreenUserManagerImpl implements 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().getNotificationData().filterAndSort(); + getEntryManager().getNotificationData().filterAndSort("user switched"); mPresenter.onUserSwitched(mCurrentUserId); for (UserChangedListener listener : mListeners) { @@ -205,7 +205,8 @@ public class NotificationLockscreenUserManagerImpl implements mUsersAllowingNotifications.clear(); // ... and refresh all the notifications updateLockscreenNotificationSetting(); - getEntryManager().updateNotifications(); + getEntryManager().updateNotifications("LOCK_SCREEN_SHOW_NOTIFICATIONS," + + " or LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS change"); } }; @@ -214,7 +215,8 @@ public class NotificationLockscreenUserManagerImpl implements public void onChange(boolean selfChange) { updateLockscreenNotificationSetting(); if (mDeviceProvisionedController.isDeviceProvisioned()) { - getEntryManager().updateNotifications(); + getEntryManager().updateNotifications("LOCK_SCREEN_ALLOW_REMOTE_INPUT" + + " or ZEN_MODE change"); } } }; @@ -532,7 +534,7 @@ public class NotificationLockscreenUserManagerImpl implements setLockscreenPublicMode(isProfilePublic, userId); mUsersWithSeperateWorkChallenge.put(userId, needsSeparateChallenge); } - getEntryManager().updateNotifications(); + getEntryManager().updateNotifications("NotificationLockscreenUserManager.updatePublicMode"); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index c50fb3d76b51a..3616b541741c6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -361,7 +361,7 @@ public class NotificationMediaManager implements Dumpable { } if (metaDataChanged) { - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("NotificationMediaManager - metaDataChanged"); } dispatchUpdateMediaMetaData(metaDataChanged, true /* allowEnterAnimation */); 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 148a1a87f3056..01c79b3df0648 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -40,6 +40,8 @@ import com.android.systemui.statusbar.notification.collection.NotificationData; import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationRowBinder; +import com.android.systemui.statusbar.notification.logging.NotifEvent; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.NotificationContentInflater; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; @@ -92,6 +94,7 @@ public class NotificationEntryManager implements private NotificationListenerService.RankingMap mLatestRankingMap; @VisibleForTesting protected NotificationData mNotificationData; + private NotifLog mNotifLog; @VisibleForTesting final ArrayList mNotificationLifetimeExtenders @@ -123,8 +126,9 @@ public class NotificationEntryManager implements } @Inject - public NotificationEntryManager(NotificationData notificationData) { + public NotificationEntryManager(NotificationData notificationData, NotifLog notifLog) { mNotificationData = notificationData; + mNotifLog = notifLog; } /** Adds a {@link NotificationEntryListener}. */ @@ -178,7 +182,7 @@ public class NotificationEntryManager implements @Override public void onReorderingAllowed() { - updateNotifications(); + updateNotifications("reordering is now allowed"); } /** @@ -203,15 +207,19 @@ public class NotificationEntryManager implements return NotificationVisibility.obtain(key, rank, count, true, location); } - private void abortExistingInflation(String key) { + private void abortExistingInflation(String key, String reason) { if (mPendingNotifications.containsKey(key)) { NotificationEntry entry = mPendingNotifications.get(key); entry.abortTask(); mPendingNotifications.remove(key); + mNotifLog.log(NotifEvent.INFLATION_ABORTED, entry.sbn(), null, + "PendingNotification aborted. " + reason); } NotificationEntry addedEntry = mNotificationData.get(key); if (addedEntry != null) { addedEntry.abortTask(); + mNotifLog.log(NotifEvent.INFLATION_ABORTED, addedEntry.sbn(), + null, reason); } } @@ -247,7 +255,7 @@ public class NotificationEntryManager implements for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onBeforeNotificationAdded(entry); } - updateNotifications(); + updateNotifications("onAsyncInflationFinished"); for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onNotificationAdded(entry); } @@ -276,7 +284,8 @@ public class NotificationEntryManager implements if (mRemoveInterceptor != null && mRemoveInterceptor.onNotificationRemoveRequested(key, reason)) { - // Remove intercepted; skip + // Remove intercepted; log and skip + mNotifLog.log(NotifEvent.REMOVE_INTERCEPTED); return; } @@ -291,13 +300,17 @@ public class NotificationEntryManager implements if (extender.shouldExtendLifetimeForPendingNotification(pendingEntry)) { extendLifetime(pendingEntry, extender); lifetimeExtended = true; + mNotifLog.log( + NotifEvent.LIFETIME_EXTENDED, + pendingEntry.sbn(), + "pendingEntry extendedBy=" + extender.toString()); } } } } if (!lifetimeExtended) { - abortExistingInflation(key); + abortExistingInflation(key, "removeNotification"); } if (entry != null) { @@ -310,6 +323,10 @@ public class NotificationEntryManager implements mLatestRankingMap = ranking; extendLifetime(entry, extender); lifetimeExtended = true; + mNotifLog.log( + NotifEvent.LIFETIME_EXTENDED, + entry.sbn(), + "entry extendedBy=" + extender.toString()); break; } } @@ -329,10 +346,12 @@ public class NotificationEntryManager implements handleGroupSummaryRemoved(key); mNotificationData.remove(key, ranking); - updateNotifications(); + updateNotifications("removeNotificationInternal"); Dependency.get(LeakDetector.class).trackGarbage(entry); removedByUser |= entryDismissed; + mNotifLog.log(NotifEvent.NOTIF_REMOVED, entry.sbn(), + "removedByUser=" + removedByUser); for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onEntryRemoved(entry, visibility, removedByUser); } @@ -389,7 +408,7 @@ public class NotificationEntryManager implements Log.d(TAG, "addNotification key=" + key); } - mNotificationData.updateRanking(rankingMap); + mNotificationData.updateRanking(rankingMap, "addNotificationInternal"); Ranking ranking = new Ranking(); rankingMap.getRanking(key, ranking); @@ -400,9 +419,9 @@ public class NotificationEntryManager implements requireBinder().inflateViews(entry, () -> performRemoveNotification(notification, REASON_CANCEL)); - abortExistingInflation(key); - + abortExistingInflation(key, "addNotification"); mPendingNotifications.put(key, entry); + mNotifLog.log(NotifEvent.NOTIF_ADDED, entry.sbn()); for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onPendingEntryAdded(entry); } @@ -423,7 +442,7 @@ public class NotificationEntryManager implements if (DEBUG) Log.d(TAG, "updateNotification(" + notification + ")"); final String key = notification.getKey(); - abortExistingInflation(key); + abortExistingInflation(key, "updateNotification"); NotificationEntry entry = mNotificationData.get(key); if (entry == null) { return; @@ -433,15 +452,15 @@ public class NotificationEntryManager implements // to keep its lifetime extended. cancelLifetimeExtension(entry); - mNotificationData.update(entry, ranking, notification); - + mNotificationData.update(entry, ranking, notification, "updateNotificationInternal"); + mNotifLog.log(NotifEvent.NOTIF_UPDATED, entry.sbn(), entry.ranking()); for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onPreEntryUpdated(entry); } requireBinder().inflateViews(entry, () -> performRemoveNotification(notification, REASON_CANCEL)); - updateNotifications(); + updateNotifications("updateNotificationInternal"); if (DEBUG) { // Is this for you? @@ -465,8 +484,12 @@ public class NotificationEntryManager implements } } - public void updateNotifications() { - mNotificationData.filterAndSort(); + /** + * Update the notifications + * @param reason why the notifications are updating + */ + public void updateNotifications(String reason) { + mNotificationData.filterAndSort(reason); if (mPresenter != null) { mPresenter.updateNotificationViews(); } @@ -489,7 +512,7 @@ public class NotificationEntryManager implements } // Populate notification entries from the new rankings. - mNotificationData.updateRanking(rankingMap); + mNotificationData.updateRanking(rankingMap, "updateNotificationRanking"); updateRankingOfPendingNotifications(rankingMap); // By comparing the old and new UI adjustments, reinflate the view accordingly. @@ -501,7 +524,7 @@ public class NotificationEntryManager implements NotificationUiAdjustment.extractFromNotificationEntry(entry)); } - updateNotifications(); + updateNotifications("updateNotificationRanking"); for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onNotificationRankingUpdated(rankingMap); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java index 769cbb7b984cd..970cbf9aa1e23 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationListController.java @@ -81,7 +81,7 @@ public class NotificationListController { new DeviceProvisionedListener() { @Override public void onDeviceProvisionedChanged() { - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("device provisioned changed"); } }; @@ -106,7 +106,7 @@ public class NotificationListController { if (foregroundKey != null) { mEntryManager .getNotificationData().updateAppOp(appOp, uid, pkg, foregroundKey, showIcon); - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("app opp changed pkg=" + pkg); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java index cf0fbbb5d9c1b..a98fa664a3573 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java @@ -35,6 +35,8 @@ import com.android.systemui.Dependency; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.notification.NotificationFilter; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; +import com.android.systemui.statusbar.notification.logging.NotifEvent; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.policy.HeadsUpManager; @@ -73,10 +75,13 @@ public class NotificationData { private RankingMap mRankingMap; private final Ranking mTmpRanking = new Ranking(); private final boolean mUsePeopleFiltering; + private final NotifLog mNotifLog; @Inject - public NotificationData(NotificationSectionsFeatureManager sectionsFeatureManager) { + public NotificationData(NotificationSectionsFeatureManager sectionsFeatureManager, + NotifLog notifLog) { mUsePeopleFiltering = sectionsFeatureManager.isFilteringEnabled(); + mNotifLog = notifLog; } public void setHeadsUpManager(HeadsUpManager headsUpManager) { @@ -179,7 +184,7 @@ public class NotificationData { } mGroupManager.onEntryAdded(entry); - updateRankingAndSort(mRankingMap); + updateRankingAndSort(mRankingMap, "addEntry=" + entry.sbn()); } public NotificationEntry remove(String key, RankingMap ranking) { @@ -189,7 +194,7 @@ public class NotificationData { } if (removed == null) return null; mGroupManager.onEntryRemoved(removed); - updateRankingAndSort(ranking); + updateRankingAndSort(ranking, "removeEntry=" + removed.sbn()); return removed; } @@ -197,15 +202,19 @@ public class NotificationData { public void update( NotificationEntry entry, RankingMap ranking, - StatusBarNotification notification) { - updateRanking(ranking); + StatusBarNotification notification, + String reason) { + updateRanking(ranking, reason); final StatusBarNotification oldNotification = entry.notification; entry.setNotification(notification); mGroupManager.onEntryUpdated(entry, oldNotification); } - public void updateRanking(RankingMap ranking) { - updateRankingAndSort(ranking); + /** + * Update ranking and trigger a re-sort + */ + public void updateRanking(RankingMap ranking, String reason) { + updateRankingAndSort(ranking, reason); } public void updateAppOp(int appOp, int uid, String pkg, String key, boolean showIcon) { @@ -352,7 +361,7 @@ public class NotificationData { return false; } - private void updateRankingAndSort(RankingMap rankingMap) { + private void updateRankingAndSort(RankingMap rankingMap, String reason) { if (rankingMap != null) { mRankingMap = rankingMap; synchronized (mEntries) { @@ -375,7 +384,7 @@ public class NotificationData { } } } - filterAndSort(); + filterAndSort(reason); } /** @@ -393,7 +402,11 @@ public class NotificationData { // TODO: This should not be public. Instead the Environment should notify this class when // anything changed, and this class should call back the UI so it updates itself. - public void filterAndSort() { + /** + * Filters and sorts the list of notification entries + */ + public void filterAndSort(String reason) { + mNotifLog.log(NotifEvent.FILTER_AND_SORT, reason); mSortedAndFiltered.clear(); synchronized (mEntries) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java index 60cf995ad8d1a..e5571b64cc9e4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRowBinderImpl.java @@ -41,6 +41,8 @@ import com.android.systemui.statusbar.NotificationUiAdjustment; import com.android.systemui.statusbar.notification.InflationException; import com.android.systemui.statusbar.notification.NotificationClicker; import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; +import com.android.systemui.statusbar.notification.logging.NotifEvent; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationContentInflater; @@ -72,6 +74,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { private final boolean mAllowLongPress; private final KeyguardBypassController mKeyguardBypassController; private final StatusBarStateController mStatusBarStateController; + private final NotifLog mNotifLog; private NotificationRemoteInputManager mRemoteInputManager; private NotificationPresenter mPresenter; @@ -85,12 +88,14 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { public NotificationRowBinderImpl(Context context, boolean allowLongPress, KeyguardBypassController keyguardBypassController, - StatusBarStateController statusBarStateController) { + StatusBarStateController statusBarStateController, + NotifLog notifLog) { mContext = context; mMessagingUtil = new NotificationMessagingUtil(context); mAllowLongPress = allowLongPress; mKeyguardBypassController = keyguardBypassController; mStatusBarStateController = statusBarStateController; + mNotifLog = notifLog; } private NotificationRemoteInputManager getRemoteInputManager() { @@ -143,6 +148,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { row -> { bindRow(entry, pmUser, sbn, row, onDismissRunnable); updateNotification(entry, pmUser, sbn, row); + mNotifLog.log(NotifEvent.INFLATED, sbn); }); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifEvent.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifEvent.java index 2396d28bd46d0..7703cbd94e1cc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifEvent.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifEvent.java @@ -30,9 +30,9 @@ import java.lang.annotation.RetentionPolicy; * and triaging purposes. */ public class NotifEvent extends RichEvent { - public static final int TOTAL_EVENT_TYPES = 8; - private StatusBarNotification mSbn; - private Ranking mRanking; + public static final int TOTAL_EVENT_TYPES = 11; + private final StatusBarNotification mSbn; + private final Ranking mRanking; /** * Creates a NotifEvent with an event type that matches with an index in the array @@ -44,9 +44,20 @@ public class NotifEvent extends RichEvent { public NotifEvent(int logLevel, int type, String reason, StatusBarNotification sbn, Ranking ranking) { super(logLevel, type, reason); - mSbn = sbn.clone(); - mRanking = new Ranking(); - mRanking.populate(ranking); + + if (sbn != null) { + mSbn = sbn.cloneLight(); + } else { + mSbn = null; + } + + if (ranking != null) { + mRanking = new Ranking(); + mRanking.populate(ranking); + } else { + mRanking = null; + } + mMessage += getExtraInfo(); } @@ -76,11 +87,14 @@ public class NotifEvent extends RichEvent { "NotifAdded", "NotifRemoved", "NotifUpdated", - "HeadsUpStarted", - "HeadsUpEnded", "Filter", "Sort", + "FilterAndSort", "NotifVisibilityChanged", + "LifetimeExtended", + "RemoveIntercepted", + "InflationAborted", + "Inflated" }; if (events.length != TOTAL_EVENT_TYPES) { @@ -135,8 +149,19 @@ public class NotifEvent extends RichEvent { } } - @IntDef({NOTIF_ADDED, NOTIF_REMOVED, NOTIF_UPDATED, HEADS_UP_STARTED, HEADS_UP_ENDED, FILTER, - SORT, NOTIF_VISIBILITY_CHANGED}) + @IntDef({NOTIF_ADDED, + NOTIF_REMOVED, + NOTIF_UPDATED, + FILTER, + SORT, + FILTER_AND_SORT, + NOTIF_VISIBILITY_CHANGED, + LIFETIME_EXTENDED, + REMOVE_INTERCEPTED, + INFLATION_ABORTED, + INFLATED + }) + /** * Types of NotifEvents */ @@ -145,9 +170,13 @@ public class NotifEvent extends RichEvent { public static final int NOTIF_ADDED = 0; public static final int NOTIF_REMOVED = 1; public static final int NOTIF_UPDATED = 2; - public static final int HEADS_UP_STARTED = 3; - public static final int HEADS_UP_ENDED = 4; - public static final int FILTER = 5; - public static final int SORT = 6; - public static final int NOTIF_VISIBILITY_CHANGED = 7; + public static final int FILTER = 3; + public static final int SORT = 4; + public static final int FILTER_AND_SORT = 5; + public static final int NOTIF_VISIBILITY_CHANGED = 6; + public static final int LIFETIME_EXTENDED = 7; + // unable to remove notif - removal intercepted by {@link NotificationRemoveInterceptor} + public static final int REMOVE_INTERCEPTED = 8; + public static final int INFLATION_ABORTED = 9; + public static final int INFLATED = 10; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifLog.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifLog.java index d42cd82f97846..8466d2e830022 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifLog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotifLog.java @@ -81,6 +81,14 @@ public class NotifLog extends SysuiLog { return log(eventType, sbn, null, ""); } + /** + * Logs a {@link NotifEvent} with a notification + * @return true if successfully logged, else false + */ + public boolean log(@NotifEvent.EventType int eventType, StatusBarNotification sbn, String msg) { + return log(eventType, sbn, null, msg); + } + /** * Logs a {@link NotifEvent} with a ranking * @return true if successfully logged, else false diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 9f4b026b3d38d..924a3470b8321 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -1447,6 +1447,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } setDismissed(fromAccessibility); if (mEntry.isClearable()) { + // TODO: beverlyt, log dismissal // TODO: track dismiss sentiment if (mOnDismissRunnable != null) { mOnDismissRunnable.run(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java index 73093c6f471ff..37f63c9779f8f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java @@ -139,7 +139,8 @@ public class NotificationBlockingHelperManager { mBlockingHelperRow.setBlockingHelperShowing(false); if (mBlockingHelperRow.isAttachedToWindow()) { - Dependency.get(NotificationEntryManager.class).updateNotifications(); + Dependency.get(NotificationEntryManager.class).updateNotifications( + "dismissCurrentBlockingHelper"); } mBlockingHelperRow = null; return true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index f5705c5f643b3..7bbe8188b4029 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -5333,7 +5333,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd requestChildrenUpdate(); onUpdateRowStates(); - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("StatusBar state changed"); updateVisibility(); } @@ -6492,12 +6492,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @Override public void onGroupCreatedFromChildren(NotificationGroupManager.NotificationGroup group) { - mStatusBar.requestNotificationUpdate(); + mStatusBar.requestNotificationUpdate("onGroupCreatedFromChildren"); } @Override public void onGroupsChanged() { - mStatusBar.requestNotificationUpdate(); + mStatusBar.requestNotificationUpdate("onGroupsChanged"); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 6ce6dfaf3c207..2b80d2282661b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -210,6 +210,7 @@ import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationRowBinderImpl; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; @@ -385,6 +386,7 @@ public class StatusBar extends SystemUI implements DemoMode, private final BroadcastDispatcher mBroadcastDispatcher; private final ConfigurationController mConfigurationController; private final StatusBarWindowViewController.Builder mStatusBarWindowViewControllerBuilder; + private final NotifLog mNotifLog; // expanded notifications protected NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window @@ -585,7 +587,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onStrongAuthStateChanged(int userId) { super.onStrongAuthStateChanged(userId); - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("onStrongAuthStateChanged"); } }; private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper()); @@ -599,6 +601,7 @@ public class StatusBar extends SystemUI implements DemoMode, private boolean mPulsing; private final BubbleController mBubbleController; private final BubbleController.BubbleExpandListener mBubbleExpandListener; + private ActivityIntentHelper mActivityIntentHelper; @Override @@ -669,7 +672,8 @@ public class StatusBar extends SystemUI implements DemoMode, NotificationListener notificationListener, ConfigurationController configurationController, StatusBarWindowController statusBarWindowController, - StatusBarWindowViewController.Builder statusBarWindowViewControllerBuilder) { + StatusBarWindowViewController.Builder statusBarWindowViewControllerBuilder, + NotifLog notifLog) { mLightBarController = lightBarController; mAutoHideController = autoHideController; mKeyguardUpdateMonitor = keyguardUpdateMonitor; @@ -723,10 +727,11 @@ public class StatusBar extends SystemUI implements DemoMode, mConfigurationController = configurationController; mStatusBarWindowController = statusBarWindowController; mStatusBarWindowViewControllerBuilder = statusBarWindowViewControllerBuilder; + mNotifLog = notifLog; mBubbleExpandListener = (isExpanding, key) -> { - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("onBubbleExpandChanged"); updateScrimController(); }; } @@ -1160,7 +1165,8 @@ public class StatusBar extends SystemUI implements DemoMode, mContext, mAllowNotificationLongPress, mKeyguardBypassController, - mStatusBarStateController); + mStatusBarStateController, + mNotifLog); mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanel, mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController, @@ -1443,8 +1449,12 @@ public class StatusBar extends SystemUI implements DemoMode, return mZenController.areNotificationsHiddenInShade(); } - public void requestNotificationUpdate() { - mEntryManager.updateNotifications(); + /** + * Request a notification update + * @param reason why we're requesting a notification update + */ + public void requestNotificationUpdate(String reason) { + mEntryManager.updateNotifications(reason); } /** @@ -1685,7 +1695,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) { - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("onHeadsUpStateChanged"); if (isDozing() && isHeadsUp) { entry.setPulseSuppressed(false); mDozeServiceHost.fireNotificationPulse(entry); @@ -3566,7 +3576,7 @@ public class StatusBar extends SystemUI implements DemoMode, updateQsExpansionEnabled(); mKeyguardViewMediator.setDozing(mDozing); - mEntryManager.updateNotifications(); + mEntryManager.updateNotifications("onDozingChanged"); updateDozingState(); updateScrimController(); updateReportRejectedTouchVisibility(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java index 2798c6b56771a..5a2b5e38222a5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java @@ -33,6 +33,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -91,7 +92,6 @@ import org.mockito.MockitoAnnotations; @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper(setAsMainLooper = true) public class BubbleControllerTest extends SysuiTestCase { - @Mock private NotificationEntryManager mNotificationEntryManager; @Mock @@ -223,13 +223,13 @@ public class BubbleControllerTest extends SysuiTestCase { mBubbleController.updateBubble(mRow.getEntry()); assertNotNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key)); assertTrue(mBubbleController.hasBubbles()); - verify(mNotificationEntryManager).updateNotifications(); + verify(mNotificationEntryManager).updateNotifications(any()); verify(mBubbleStateChangeListener).onHasBubblesChanged(true); mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE); assertFalse(mStatusBarWindowController.getBubblesShowing()); assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key)); - verify(mNotificationEntryManager, times(2)).updateNotifications(); + verify(mNotificationEntryManager, times(2)).updateNotifications(anyString()); verify(mBubbleStateChangeListener).onHasBubblesChanged(false); } @@ -257,16 +257,16 @@ public class BubbleControllerTest extends SysuiTestCase { @Test public void testDismissStack() { mBubbleController.updateBubble(mRow.getEntry()); - verify(mNotificationEntryManager, times(1)).updateNotifications(); + verify(mNotificationEntryManager, times(1)).updateNotifications(any()); assertNotNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key)); mBubbleController.updateBubble(mRow2.getEntry()); - verify(mNotificationEntryManager, times(2)).updateNotifications(); + verify(mNotificationEntryManager, times(2)).updateNotifications(any()); assertNotNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().key)); assertTrue(mBubbleController.hasBubbles()); mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE); assertFalse(mStatusBarWindowController.getBubblesShowing()); - verify(mNotificationEntryManager, times(3)).updateNotifications(); + verify(mNotificationEntryManager, times(3)).updateNotifications(any()); assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().key)); assertNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().key)); } 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 a02764320b6c1..0569c55981fb8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java @@ -25,6 +25,7 @@ import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -99,7 +100,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { @Test public void testLockScreenShowNotificationsChangeUpdatesNotifications() { mLockscreenUserManager.getLockscreenSettingsObserverForTest().onChange(false); - verify(mEntryManager, times(1)).updateNotifications(); + verify(mEntryManager, times(1)).updateNotifications(anyString()); } @Test @@ -138,7 +139,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { public void testSettingsObserverUpdatesNotifications() { when(mDeviceProvisionedController.isDeviceProvisioned()).thenReturn(true); mLockscreenUserManager.getSettingsObserverForTest().onChange(false); - verify(mEntryManager, times(1)).updateNotifications(); + verify(mEntryManager, times(1)).updateNotifications(anyString()); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java index 866ea51127946..e52a25806086d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doAnswer; @@ -80,6 +81,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationData.K import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationRowBinder; import com.android.systemui.statusbar.notification.collection.NotificationRowBinderImpl; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; @@ -146,7 +148,8 @@ public class NotificationEntryManagerTest extends SysuiTestCase { private final CountDownLatch mCountDownLatch; TestableNotificationEntryManager() { - super(new NotificationData(mock(NotificationSectionsFeatureManager.class))); + super(new NotificationData(mock(NotificationSectionsFeatureManager.class), + mock(NotifLog.class)), mock(NotifLog.class)); mCountDownLatch = new CountDownLatch(1); } @@ -259,7 +262,9 @@ public class NotificationEntryManagerTest extends SysuiTestCase { NotificationRowBinderImpl notificationRowBinder = new NotificationRowBinderImpl(mContext, true, /* allowLongPress */ - mock(KeyguardBypassController.class), mock(StatusBarStateController.class)); + mock(KeyguardBypassController.class), + mock(StatusBarStateController.class), + mock(NotifLog.class)); notificationRowBinder.setUpWithPresenter( mPresenter, mListContainer, mHeadsUpManager, mEntryManager, mBindCallback); notificationRowBinder.setNotificationClicker(mock(NotificationClicker.class)); @@ -350,7 +355,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { // Ensure that update callbacks happen in correct order InOrder order = inOrder(mEntryListener, notifData, mPresenter, mEntryListener); order.verify(mEntryListener).onPreEntryUpdated(mEntry); - order.verify(notifData).filterAndSort(); + order.verify(notifData).filterAndSort(anyString()); order.verify(mPresenter).updateNotificationViews(); order.verify(mEntryListener).onPostEntryUpdated(mEntry); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java index 6d275419ee948..8207a041ef507 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationListControllerTest.java @@ -21,6 +21,7 @@ import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -43,6 +44,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationEntryBuilder; import com.android.systemui.statusbar.notification.collection.NotificationData; import com.android.systemui.statusbar.notification.collection.NotificationEntry; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; @@ -76,7 +78,7 @@ public class NotificationListControllerTest extends SysuiTestCase { // TODO: Remove this once EntryManager no longer needs to be mocked private NotificationData mNotificationData = new NotificationData(new NotificationSectionsFeatureManager( - new DeviceConfigProxyFake(), mContext)); + new DeviceConfigProxyFake(), mContext), mock(NotifLog.class)); private int mNextNotifId = 0; @@ -113,7 +115,7 @@ public class NotificationListControllerTest extends SysuiTestCase { @Test public void testCallUpdateNotificationsOnDeviceProvisionedChange() { mProvisionedListener.onDeviceProvisionedChanged(); - verify(mEntryManager).updateNotifications(); + verify(mEntryManager).updateNotifications(anyString()); } @Test @@ -133,8 +135,8 @@ public class NotificationListControllerTest extends SysuiTestCase { // THEN the app op is added to the entry assertTrue(entry.mActiveAppOps.contains(AppOpsManager.OP_CAMERA)); - // THEN updateNotifications() is called - verify(mEntryManager, times(1)).updateNotifications(); + // THEN updateNotifications(TEST) is called + verify(mEntryManager, times(1)).updateNotifications(anyString()); } @Test @@ -146,8 +148,8 @@ public class NotificationListControllerTest extends SysuiTestCase { // WHEN An unrelated notification gets a new app op mController.updateNotificationsForAppOp(AppOpsManager.OP_CAMERA, 1000, "pkg", true); - // THEN We never call updateNotifications() - verify(mEntryManager, never()).updateNotifications(); + // THEN We never call updateNotifications(TEST) + verify(mEntryManager, never()).updateNotifications(anyString()); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java index 5fbacb1d7adff..59c76a8cbb77c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java @@ -79,6 +79,7 @@ import com.android.systemui.statusbar.RankingBuilder; import com.android.systemui.statusbar.SbnBuilder; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.phone.ShadeController; @@ -141,7 +142,7 @@ public class NotificationDataTest extends SysuiTestCase { when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true); mNotificationData = new TestableNotificationData( mock(NotificationSectionsFeatureManager.class)); - mNotificationData.updateRanking(mock(NotificationListenerService.RankingMap.class)); + mNotificationData.updateRanking(mock(NotificationListenerService.RankingMap.class), ""); mRow = new NotificationTestHelper(getContext()).createRow(); Dependency.get(InitController.class).executePostInitTasks(); } @@ -633,7 +634,7 @@ public class NotificationDataTest extends SysuiTestCase { public static class TestableNotificationData extends NotificationData { public TestableNotificationData(NotificationSectionsFeatureManager sectionsFeatureManager) { - super(sectionsFeatureManager); + super(sectionsFeatureManager, mock(NotifLog.class)); } public static final String OVERRIDE_RANK = "r"; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java index 6d64395329129..cc89504cb54d0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java @@ -27,6 +27,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; @@ -62,7 +63,6 @@ import org.mockito.MockitoAnnotations; @org.junit.runner.RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper public class NotificationBlockingHelperManagerTest extends SysuiTestCase { - private NotificationBlockingHelperManager mBlockingHelperManager; private NotificationTestHelper mHelper; @@ -112,7 +112,7 @@ public class NotificationBlockingHelperManagerTest extends SysuiTestCase { assertTrue(mBlockingHelperManager.dismissCurrentBlockingHelper()); assertTrue(mBlockingHelperManager.isBlockingHelperRowNull()); - verify(mEntryManager, times(0)).updateNotifications(); + verify(mEntryManager, times(0)).updateNotifications(anyString()); } @Test @@ -125,7 +125,7 @@ public class NotificationBlockingHelperManagerTest extends SysuiTestCase { assertTrue(mBlockingHelperManager.dismissCurrentBlockingHelper()); assertTrue(mBlockingHelperManager.isBlockingHelperRowNull()); - verify(mEntryManager).updateNotifications(); + verify(mEntryManager).updateNotifications(anyString()); } @Test @@ -267,7 +267,7 @@ public class NotificationBlockingHelperManagerTest extends SysuiTestCase { assertTrue(mBlockingHelperManager.dismissCurrentBlockingHelper()); assertTrue(mBlockingHelperManager.isBlockingHelperRowNull()); - verify(mEntryManager).updateNotifications(); + verify(mEntryManager).updateNotifications(anyString()); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index 98485b311d17d..95e9e67cb8304 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -56,6 +56,7 @@ import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotificationData; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.stack.NotificationRoundnessManager; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.policy.ConfigurationController; @@ -232,7 +233,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { mock(ShadeController.class), mock(NotificationLockscreenUserManager.class), new NotificationEntryManager(new NotificationData(mock( - NotificationSectionsFeatureManager.class))), + NotificationSectionsFeatureManager.class), mock(NotifLog.class)), + mock(NotifLog.class)), mock(DozeLog.class)); mNotificationStackScroller = mNotificationStackScrollLayout; mKeyguardStatusView = NotificationPanelViewTest.this.mKeyguardStatusView; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index 914717c0266d0..12e9be15354f1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -117,6 +117,7 @@ import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.NotificationData; import com.android.systemui.statusbar.notification.collection.NotificationEntry; +import com.android.systemui.statusbar.notification.logging.NotifLog; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; @@ -218,6 +219,7 @@ public class StatusBarTest extends SysuiTestCase { @Mock private NotificationIconAreaController mNotificationIconAreaController; @Mock private StatusBarWindowViewController.Builder mStatusBarWindowViewControllerBuilder; @Mock private StatusBarWindowViewController mStatusBarWindowViewController; + @Mock private NotifLog mNotifLog; @Before public void setup() throws Exception { @@ -339,7 +341,8 @@ public class StatusBarTest extends SysuiTestCase { mNotificationListener, configurationController, mStatusBarWindowController, - mStatusBarWindowViewControllerBuilder); + mStatusBarWindowViewControllerBuilder, + mNotifLog); // TODO: we should be able to call mStatusBar.start() and have all the below values // initialized automatically. mStatusBar.mContext = mContext; @@ -873,7 +876,7 @@ public class StatusBarTest extends SysuiTestCase { public static class TestableNotificationEntryManager extends NotificationEntryManager { public TestableNotificationEntryManager(NotificationData notificationData) { - super(notificationData); + super(notificationData, mock(NotifLog.class)); } public void setUpForTest(NotificationPresenter presenter,