Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a57867ab authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Remove check_autogroup_before_post flag

Test: TH
Flag: EXEMPT flag removal
Fixes: 409611646
Change-Id: I976d12afd708cbf6b741df1fad70895e6a263780
parent 448a9c1e
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -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"
+8 −16
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -655,9 +650,6 @@ public class GroupHelper {
                        mCallback.addAutoGroup(keyToGroup, fullAggregateGroupKey.toString(),
                                true);
                    }
                    } else {
                        mCallback.addAutoGroup(keyToGroup, fullAggregateGroupKey.toString(), true);
                    }
                }

                //cleanup mUngroupedAbuseNotifications
+40 −74
Original line number Diff line number Diff line
@@ -7526,7 +7526,7 @@ public class NotificationManagerService extends SystemService {
            addAutoGroupAdjustment(r, groupName);
            EventLogTags.writeNotificationAutogrouped(key);
            if (!android.app.Flags.checkAutogroupBeforePost() || requestSort) {
            if (requestSort) {
                mRankingHandler.requestSort();
            }
@@ -9894,7 +9894,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())
@@ -9905,8 +9904,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,
@@ -9935,8 +9934,6 @@ public class NotificationManagerService extends SystemService {
                                        }, key, DELAY_FORCE_REGROUP_TIME);
                                    }
                                }
                                }
                             }
                        }
                    }
@@ -9960,37 +9957,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) {
+11 −507

File changed.

Preview size limit exceeded, changes collapsed.

+5 −12
Original line number Diff line number Diff line
@@ -2931,8 +2931,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);
@@ -2951,8 +2950,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);
@@ -2971,8 +2969,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);
@@ -3134,8 +3131,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";
@@ -3174,8 +3170,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
@@ -6754,7 +6749,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);
@@ -6764,7 +6758,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);