Reduce RankingUpdate calls on autogroup

If a new notification is posted that should be autogrouped, we can add
the group key _before_ we do a ranking sort, so that we don't have to
re-sort after we modify the notification with the autogroup attribute.
This should reduce the number of onRankingUpdate calls sent unnecessarily.

Bug: 330214226
Test: atest NotificationManagerServiceTest, GroupHelperTest
Change-Id: I60949e9ce67efae48fefcc95e2056eb68f767554
Flag: ACONFIG android.app.check_autogroup_before_post DEVELOPMENT
4 files changed