Loading services/core/java/com/android/server/notification/NotificationManagerService.java +12 −7 Original line number Diff line number Diff line Loading @@ -5805,6 +5805,7 @@ public class NotificationManagerService extends SystemService { || channel.isImportanceLockedByCriticalDeviceFunction()); final StatusBarNotification adjustedSbn = notificationRecord.getSbn(); userId = adjustedSbn.getUser().getIdentifier(); int uid = adjustedSbn.getUid(); ArrayMap<String, String> summaries = mAutobundledSummaries.get(userId); if (summaries == null) { summaries = new ArrayMap<>(); Loading Loading @@ -5851,7 +5852,7 @@ public class NotificationManagerService extends SystemService { notificationRecord.getIsAppImportanceLocked()); summaries.put(pkg, summarySbn.getKey()); } if (summaryRecord != null && checkDisqualifyingFeatures(userId, MY_UID, if (summaryRecord != null && checkDisqualifyingFeatures(userId, uid, summaryRecord.getSbn().getId(), summaryRecord.getSbn().getTag(), summaryRecord, true)) { return summaryRecord; Loading Loading @@ -6837,7 +6838,6 @@ public class NotificationManagerService extends SystemService { return false; } // blocked apps boolean isBlocked = !areNotificationsEnabledForPackageInt(pkg, uid); synchronized (mNotificationLock) { Loading Loading @@ -7230,10 +7230,12 @@ public class NotificationManagerService extends SystemService { if (mAssistants.isEnabled()) { mAssistants.onNotificationEnqueuedLocked(r); mHandler.postDelayed( new PostNotificationRunnable(r.getKey(), enqueueElapsedTimeMs), new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), enqueueElapsedTimeMs), DELAY_FOR_ASSISTANT_TIME); } else { mHandler.post(new PostNotificationRunnable(r.getKey(), enqueueElapsedTimeMs)); mHandler.post(new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), enqueueElapsedTimeMs)); } } } Loading @@ -7257,16 +7259,19 @@ public class NotificationManagerService extends SystemService { protected class PostNotificationRunnable implements Runnable { private final String key; private final long postElapsedTimeMs; private final String pkg; private final int uid; PostNotificationRunnable(String key, @ElapsedRealtimeLong long postElapsedTimeMs) { PostNotificationRunnable(String key, String pkg, int uid, @ElapsedRealtimeLong long postElapsedTimeMs) { this.key = key; this.pkg = pkg; this.uid = uid; this.postElapsedTimeMs = postElapsedTimeMs; } @Override public void run() { String pkg = StatusBarNotification.getPkgFromKey(key); int uid = StatusBarNotification.getUidFromKey(key); boolean appBanned = !areNotificationsEnabledForPackageInt(pkg, uid); synchronized (mNotificationLock) { try { Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +20 −8 Original line number Diff line number Diff line Loading @@ -1340,7 +1340,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mBinderService.applyEnqueuedAdjustmentFromAssistant(null, adjustment); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -1361,7 +1362,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { when(mPreferencesHelper.getImportance(anyString(), anyInt())).thenReturn(IMPORTANCE_NONE); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading @@ -3923,7 +3925,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -3940,7 +3943,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -3956,7 +3960,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -3969,12 +3974,14 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { r.setCriticality(CriticalNotificationExtractor.CRITICAL_LOW); mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); r = generateNotificationRecord(mTestNotificationChannel, 1, null, false); r.setCriticality(CriticalNotificationExtractor.CRITICAL); runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); runnable = mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); mService.addEnqueuedNotification(r); runnable.run(); Loading Loading @@ -4475,6 +4482,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(original.getKey(), original.getSbn().getPackageName(), original.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -4497,6 +4506,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(update.getKey(), update.getSbn().getPackageName(), update.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading @@ -6592,7 +6603,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { assertNull(update.getSbn().getNotification().getSmallIcon()); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(update.getKey(), mService.new PostNotificationRunnable(update.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java +8 −4 Original line number Diff line number Diff line Loading @@ -657,7 +657,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { when(mPermissionHelper.hasPermission(anyInt())).thenReturn(false); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading @@ -790,7 +791,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -806,7 +808,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { r = new NotificationRecord(mContext, sbn, mTestNotificationChannel); mService.addEnqueuedNotification(r); runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); runnable = mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -822,7 +825,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { r = new NotificationRecord(mContext, sbn, mTestNotificationChannel); mService.addEnqueuedNotification(r); runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); runnable = mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +12 −7 Original line number Diff line number Diff line Loading @@ -5805,6 +5805,7 @@ public class NotificationManagerService extends SystemService { || channel.isImportanceLockedByCriticalDeviceFunction()); final StatusBarNotification adjustedSbn = notificationRecord.getSbn(); userId = adjustedSbn.getUser().getIdentifier(); int uid = adjustedSbn.getUid(); ArrayMap<String, String> summaries = mAutobundledSummaries.get(userId); if (summaries == null) { summaries = new ArrayMap<>(); Loading Loading @@ -5851,7 +5852,7 @@ public class NotificationManagerService extends SystemService { notificationRecord.getIsAppImportanceLocked()); summaries.put(pkg, summarySbn.getKey()); } if (summaryRecord != null && checkDisqualifyingFeatures(userId, MY_UID, if (summaryRecord != null && checkDisqualifyingFeatures(userId, uid, summaryRecord.getSbn().getId(), summaryRecord.getSbn().getTag(), summaryRecord, true)) { return summaryRecord; Loading Loading @@ -6837,7 +6838,6 @@ public class NotificationManagerService extends SystemService { return false; } // blocked apps boolean isBlocked = !areNotificationsEnabledForPackageInt(pkg, uid); synchronized (mNotificationLock) { Loading Loading @@ -7230,10 +7230,12 @@ public class NotificationManagerService extends SystemService { if (mAssistants.isEnabled()) { mAssistants.onNotificationEnqueuedLocked(r); mHandler.postDelayed( new PostNotificationRunnable(r.getKey(), enqueueElapsedTimeMs), new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), enqueueElapsedTimeMs), DELAY_FOR_ASSISTANT_TIME); } else { mHandler.post(new PostNotificationRunnable(r.getKey(), enqueueElapsedTimeMs)); mHandler.post(new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), enqueueElapsedTimeMs)); } } } Loading @@ -7257,16 +7259,19 @@ public class NotificationManagerService extends SystemService { protected class PostNotificationRunnable implements Runnable { private final String key; private final long postElapsedTimeMs; private final String pkg; private final int uid; PostNotificationRunnable(String key, @ElapsedRealtimeLong long postElapsedTimeMs) { PostNotificationRunnable(String key, String pkg, int uid, @ElapsedRealtimeLong long postElapsedTimeMs) { this.key = key; this.pkg = pkg; this.uid = uid; this.postElapsedTimeMs = postElapsedTimeMs; } @Override public void run() { String pkg = StatusBarNotification.getPkgFromKey(key); int uid = StatusBarNotification.getUidFromKey(key); boolean appBanned = !areNotificationsEnabledForPackageInt(pkg, uid); synchronized (mNotificationLock) { try { Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +20 −8 Original line number Diff line number Diff line Loading @@ -1340,7 +1340,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mBinderService.applyEnqueuedAdjustmentFromAssistant(null, adjustment); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -1361,7 +1362,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { when(mPreferencesHelper.getImportance(anyString(), anyInt())).thenReturn(IMPORTANCE_NONE); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading @@ -3923,7 +3925,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -3940,7 +3943,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -3956,7 +3960,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -3969,12 +3974,14 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { r.setCriticality(CriticalNotificationExtractor.CRITICAL_LOW); mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); r = generateNotificationRecord(mTestNotificationChannel, 1, null, false); r.setCriticality(CriticalNotificationExtractor.CRITICAL); runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); runnable = mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); mService.addEnqueuedNotification(r); runnable.run(); Loading Loading @@ -4475,6 +4482,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(original.getKey(), original.getSbn().getPackageName(), original.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -4497,6 +4506,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(update.getKey(), update.getSbn().getPackageName(), update.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading @@ -6592,7 +6603,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { assertNull(update.getSbn().getNotification().getSmallIcon()); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(update.getKey(), mService.new PostNotificationRunnable(update.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java +8 −4 Original line number Diff line number Diff line Loading @@ -657,7 +657,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { when(mPermissionHelper.hasPermission(anyInt())).thenReturn(false); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading Loading @@ -790,7 +791,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { mService.addEnqueuedNotification(r); NotificationManagerService.PostNotificationRunnable runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -806,7 +808,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { r = new NotificationRecord(mContext, sbn, mTestNotificationChannel); mService.addEnqueuedNotification(r); runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); runnable = mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading @@ -822,7 +825,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { r = new NotificationRecord(mContext, sbn, mTestNotificationChannel); mService.addEnqueuedNotification(r); runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime()); runnable = mService.new PostNotificationRunnable(r.getKey(), r.getSbn().getPackageName(), r.getUid(), SystemClock.elapsedRealtime()); runnable.run(); waitForIdle(); Loading