Loading core/java/android/app/notification.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -115,13 +115,6 @@ flag { bug: "299448097" } flag { name: "check_autogroup_before_post" namespace: "systemui" description: "Does a check to see if notification should be autogrouped before posting, and if so groups before post." bug: "330214226" } flag { name: "notification_expansion_optional" namespace: "systemui" Loading services/core/java/com/android/server/notification/GroupHelper.java +8 −16 Original line number Diff line number Diff line Loading @@ -362,16 +362,12 @@ public class GroupHelper { AUTOGROUP_KEY, Integer.MAX_VALUE, attr); } for (String keyToGroup : notificationsToGroup) { if (android.app.Flags.checkAutogroupBeforePost()) { if (keyToGroup.equals(sbn.getKey())) { // Autogrouping for the provided notification is to be done synchronously. sbnToBeAutogrouped = true; } else { mCallback.addAutoGroup(keyToGroup, AUTOGROUP_KEY, /*requestSort=*/true); } } else { mCallback.addAutoGroup(keyToGroup, AUTOGROUP_KEY, /*requestSort=*/true); } } } return sbnToBeAutogrouped; Loading Loading @@ -647,7 +643,6 @@ public class GroupHelper { // add notification to aggregate group for (String keyToGroup : ungrouped.keySet()) { if (android.app.Flags.checkAutogroupBeforePost()) { if (keyToGroup.equals(record.getKey())) { // Autogrouping for the posted notification is to be done synchronously. sbnToBeAutogrouped = true; Loading @@ -655,9 +650,6 @@ public class GroupHelper { mCallback.addAutoGroup(keyToGroup, fullAggregateGroupKey.toString(), true); } } else { mCallback.addAutoGroup(keyToGroup, fullAggregateGroupKey.toString(), true); } } //cleanup mUngroupedAbuseNotifications Loading services/core/java/com/android/server/notification/NotificationManagerService.java +40 −74 Original line number Diff line number Diff line Loading @@ -7524,7 +7524,7 @@ public class NotificationManagerService extends SystemService { addAutoGroupAdjustment(r, groupName); EventLogTags.writeNotificationAutogrouped(key); if (!android.app.Flags.checkAutogroupBeforePost() || requestSort) { if (requestSort) { mRankingHandler.requestSort(); } Loading Loading @@ -9892,7 +9892,6 @@ public class NotificationManagerService extends SystemService { // Posts the notification if it has a small icon, and potentially autogroup // the new notification. if (android.app.Flags.checkAutogroupBeforePost()) { if (notification.getSmallIcon() != null && !isCritical(r)) { StatusBarNotification oldSbn = (old != null) ? old.getSbn() : null; if (oldSbn == null || !Objects.equals(oldSbn.getGroup(), n.getGroup()) Loading @@ -9903,8 +9902,8 @@ public class NotificationManagerService extends SystemService { || !old.getChannel().getId().equals(r.getChannel().getId())) { synchronized (mNotificationLock) { final String autogroupName = notificationForceGrouping() ? GroupHelper.getFullAggregateGroupKey(r) notificationForceGrouping() ? GroupHelper.getFullAggregateGroupKey(r) : GroupHelper.AUTOGROUP_KEY; boolean willBeAutogrouped = mGroupHelper.onNotificationPosted(r, Loading Loading @@ -9933,8 +9932,6 @@ public class NotificationManagerService extends SystemService { }, key, DELAY_FORCE_REGROUP_TIME); } } } } } } Loading @@ -9958,37 +9955,6 @@ public class NotificationManagerService extends SystemService { getGroupInstanceId(r.getSbn().getGroupKey())); notifyListenersPostedAndLogLocked(r, old, mTracker, maybeReport); posted = true; if (!android.app.Flags.checkAutogroupBeforePost()) { StatusBarNotification oldSbn = (old != null) ? old.getSbn() : null; if (oldSbn == null || !Objects.equals(oldSbn.getGroup(), n.getGroup()) || oldSbn.getNotification().flags != n.getNotification().flags) { if (!isCritical(r)) { mHandler.post(() -> { synchronized (mNotificationLock) { mGroupHelper.onNotificationPosted( r, hasAutoGroupSummaryLocked(r)); } }); if (notificationForceGrouping()) { mHandler.postDelayed(() -> { synchronized (mNotificationLock) { NotificationRecord record = mNotificationsByKey.get(key); if (record != null) { mGroupHelper.onNotificationPostedWithDelay( record, mNotificationList, mSummaryByGroupKey); } } }, key, DELAY_FORCE_REGROUP_TIME); } } } } } else { Slog.e(TAG, "Not posting notification without small icon: " + notification); if (old != null && !old.isCanceled) { Loading services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java +11 −507 File changed.Preview size limit exceeded, changes collapsed. Show changes services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +5 −12 Original line number Diff line number Diff line Loading @@ -2930,8 +2930,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testOnlyForceGroupIfNeeded_newNotification_notAutogrouped() { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); when(mGroupHelper.onNotificationPosted(any(), anyBoolean())).thenReturn(false); Loading @@ -2950,8 +2949,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testOnlyForceGroupIfNeeded_newNotification_wasAutogrouped() { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); when(mGroupHelper.onNotificationPosted(any(), anyBoolean())).thenReturn(true); Loading @@ -2970,8 +2968,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testRemoveScheduledForceGroup_onNotificationCanceled() throws Exception { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, "tag", null, false); Loading Loading @@ -3133,8 +3130,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testScheduleGroupHelperWithDelay_onChildNotificationCanceled() throws Exception { // Post summary + 2 child notification final String originalGroupName = "originalGroup"; Loading Loading @@ -3173,8 +3169,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testCleanupScheduleGroupHelperWithDelay_onAllNotificationCanceled() throws Exception { // Post summary + 2 child notification Loading Loading @@ -6753,7 +6748,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags(android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST) public void testAutogroupSuppressSort_noSort() throws Exception { final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addNotification(r); Loading @@ -6763,7 +6757,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags(android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST) public void testAutogroupOnPost_skipManualSort() throws Exception { final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addNotification(r); Loading Loading
core/java/android/app/notification.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -115,13 +115,6 @@ flag { bug: "299448097" } flag { name: "check_autogroup_before_post" namespace: "systemui" description: "Does a check to see if notification should be autogrouped before posting, and if so groups before post." bug: "330214226" } flag { name: "notification_expansion_optional" namespace: "systemui" Loading
services/core/java/com/android/server/notification/GroupHelper.java +8 −16 Original line number Diff line number Diff line Loading @@ -362,16 +362,12 @@ public class GroupHelper { AUTOGROUP_KEY, Integer.MAX_VALUE, attr); } for (String keyToGroup : notificationsToGroup) { if (android.app.Flags.checkAutogroupBeforePost()) { if (keyToGroup.equals(sbn.getKey())) { // Autogrouping for the provided notification is to be done synchronously. sbnToBeAutogrouped = true; } else { mCallback.addAutoGroup(keyToGroup, AUTOGROUP_KEY, /*requestSort=*/true); } } else { mCallback.addAutoGroup(keyToGroup, AUTOGROUP_KEY, /*requestSort=*/true); } } } return sbnToBeAutogrouped; Loading Loading @@ -647,7 +643,6 @@ public class GroupHelper { // add notification to aggregate group for (String keyToGroup : ungrouped.keySet()) { if (android.app.Flags.checkAutogroupBeforePost()) { if (keyToGroup.equals(record.getKey())) { // Autogrouping for the posted notification is to be done synchronously. sbnToBeAutogrouped = true; Loading @@ -655,9 +650,6 @@ public class GroupHelper { mCallback.addAutoGroup(keyToGroup, fullAggregateGroupKey.toString(), true); } } else { mCallback.addAutoGroup(keyToGroup, fullAggregateGroupKey.toString(), true); } } //cleanup mUngroupedAbuseNotifications Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +40 −74 Original line number Diff line number Diff line Loading @@ -7524,7 +7524,7 @@ public class NotificationManagerService extends SystemService { addAutoGroupAdjustment(r, groupName); EventLogTags.writeNotificationAutogrouped(key); if (!android.app.Flags.checkAutogroupBeforePost() || requestSort) { if (requestSort) { mRankingHandler.requestSort(); } Loading Loading @@ -9892,7 +9892,6 @@ public class NotificationManagerService extends SystemService { // Posts the notification if it has a small icon, and potentially autogroup // the new notification. if (android.app.Flags.checkAutogroupBeforePost()) { if (notification.getSmallIcon() != null && !isCritical(r)) { StatusBarNotification oldSbn = (old != null) ? old.getSbn() : null; if (oldSbn == null || !Objects.equals(oldSbn.getGroup(), n.getGroup()) Loading @@ -9903,8 +9902,8 @@ public class NotificationManagerService extends SystemService { || !old.getChannel().getId().equals(r.getChannel().getId())) { synchronized (mNotificationLock) { final String autogroupName = notificationForceGrouping() ? GroupHelper.getFullAggregateGroupKey(r) notificationForceGrouping() ? GroupHelper.getFullAggregateGroupKey(r) : GroupHelper.AUTOGROUP_KEY; boolean willBeAutogrouped = mGroupHelper.onNotificationPosted(r, Loading Loading @@ -9933,8 +9932,6 @@ public class NotificationManagerService extends SystemService { }, key, DELAY_FORCE_REGROUP_TIME); } } } } } } Loading @@ -9958,37 +9955,6 @@ public class NotificationManagerService extends SystemService { getGroupInstanceId(r.getSbn().getGroupKey())); notifyListenersPostedAndLogLocked(r, old, mTracker, maybeReport); posted = true; if (!android.app.Flags.checkAutogroupBeforePost()) { StatusBarNotification oldSbn = (old != null) ? old.getSbn() : null; if (oldSbn == null || !Objects.equals(oldSbn.getGroup(), n.getGroup()) || oldSbn.getNotification().flags != n.getNotification().flags) { if (!isCritical(r)) { mHandler.post(() -> { synchronized (mNotificationLock) { mGroupHelper.onNotificationPosted( r, hasAutoGroupSummaryLocked(r)); } }); if (notificationForceGrouping()) { mHandler.postDelayed(() -> { synchronized (mNotificationLock) { NotificationRecord record = mNotificationsByKey.get(key); if (record != null) { mGroupHelper.onNotificationPostedWithDelay( record, mNotificationList, mSummaryByGroupKey); } } }, key, DELAY_FORCE_REGROUP_TIME); } } } } } else { Slog.e(TAG, "Not posting notification without small icon: " + notification); if (old != null && !old.isCanceled) { Loading
services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java +11 −507 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +5 −12 Original line number Diff line number Diff line Loading @@ -2930,8 +2930,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testOnlyForceGroupIfNeeded_newNotification_notAutogrouped() { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); when(mGroupHelper.onNotificationPosted(any(), anyBoolean())).thenReturn(false); Loading @@ -2950,8 +2949,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testOnlyForceGroupIfNeeded_newNotification_wasAutogrouped() { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false); when(mGroupHelper.onNotificationPosted(any(), anyBoolean())).thenReturn(true); Loading @@ -2970,8 +2968,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testRemoveScheduledForceGroup_onNotificationCanceled() throws Exception { NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, "tag", null, false); Loading Loading @@ -3133,8 +3130,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testScheduleGroupHelperWithDelay_onChildNotificationCanceled() throws Exception { // Post summary + 2 child notification final String originalGroupName = "originalGroup"; Loading Loading @@ -3173,8 +3169,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING, android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST}) @EnableFlags({FLAG_NOTIFICATION_FORCE_GROUPING}) public void testCleanupScheduleGroupHelperWithDelay_onAllNotificationCanceled() throws Exception { // Post summary + 2 child notification Loading Loading @@ -6753,7 +6748,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags(android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST) public void testAutogroupSuppressSort_noSort() throws Exception { final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addNotification(r); Loading @@ -6763,7 +6757,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test @EnableFlags(android.app.Flags.FLAG_CHECK_AUTOGROUP_BEFORE_POST) public void testAutogroupOnPost_skipManualSort() throws Exception { final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel); mService.addNotification(r); Loading