Loading packages/ExtServices/src/android/ext/services/notification/Assistant.java +1 −1 Original line number Diff line number Diff line Loading @@ -294,7 +294,7 @@ public class Assistant extends NotificationAssistantService { synchronized (mkeyToImpressions) { ChannelImpressions ci = mkeyToImpressions.getOrDefault(key, createChannelImpressionsWithThresholds()); if (stats.hasSeen()) { if (stats != null && stats.hasSeen()) { ci.incrementViews(); updatedImpressions = true; } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -4939,7 +4939,7 @@ public class NotificationManagerService extends SystemService { Slog.e(TAG, "Not posting notification without small icon: " + notification); if (old != null && !old.isCanceled) { mListeners.notifyRemovedLocked(r, NotificationListenerService.REASON_ERROR, null); NotificationListenerService.REASON_ERROR, r.getStats()); mHandler.post(new Runnable() { @Override public void run() { Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -3849,4 +3849,26 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.reportSeen(r); verify(mAppUsageStats, times(1)).reportEvent(anyString(), anyInt(), anyInt()); } @Test public void testNotificationStats_notificationError() { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addNotification(r); StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", mUid, 0, new Notification.Builder(mContext, mTestNotificationChannel.getId()).build(), new UserHandle(mUid), null, 0); NotificationRecord update = new NotificationRecord(mContext, sbn, mTestNotificationChannel); mService.addEnqueuedNotification(update); assertNull(update.sbn.getNotification().getSmallIcon()); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(update.getKey()); runnable.run(); waitForIdle(); ArgumentCaptor<NotificationStats> captor = ArgumentCaptor.forClass(NotificationStats.class); verify(mListeners).notifyRemovedLocked(any(), anyInt(), captor.capture()); assertNotNull(captor.getValue()); } } Loading
packages/ExtServices/src/android/ext/services/notification/Assistant.java +1 −1 Original line number Diff line number Diff line Loading @@ -294,7 +294,7 @@ public class Assistant extends NotificationAssistantService { synchronized (mkeyToImpressions) { ChannelImpressions ci = mkeyToImpressions.getOrDefault(key, createChannelImpressionsWithThresholds()); if (stats.hasSeen()) { if (stats != null && stats.hasSeen()) { ci.incrementViews(); updatedImpressions = true; } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -4939,7 +4939,7 @@ public class NotificationManagerService extends SystemService { Slog.e(TAG, "Not posting notification without small icon: " + notification); if (old != null && !old.isCanceled) { mListeners.notifyRemovedLocked(r, NotificationListenerService.REASON_ERROR, null); NotificationListenerService.REASON_ERROR, r.getStats()); mHandler.post(new Runnable() { @Override public void run() { Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -3849,4 +3849,26 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.reportSeen(r); verify(mAppUsageStats, times(1)).reportEvent(anyString(), anyInt(), anyInt()); } @Test public void testNotificationStats_notificationError() { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addNotification(r); StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", mUid, 0, new Notification.Builder(mContext, mTestNotificationChannel.getId()).build(), new UserHandle(mUid), null, 0); NotificationRecord update = new NotificationRecord(mContext, sbn, mTestNotificationChannel); mService.addEnqueuedNotification(update); assertNull(update.sbn.getNotification().getSmallIcon()); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(update.getKey()); runnable.run(); waitForIdle(); ArgumentCaptor<NotificationStats> captor = ArgumentCaptor.forClass(NotificationStats.class); verify(mListeners).notifyRemovedLocked(any(), anyInt(), captor.capture()); assertNotNull(captor.getValue()); } }