Loading services/core/java/com/android/server/notification/GroupHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ public class GroupHelper { } String combinedKey = generatePackageGroupKey(userId, sbn.getPackageName(), group); boolean needsOngoingFlag = notifications.size() > 0; mCallback.updateAutogroupSummary(sbn.getKey(), needsOngoingFlag); mCallback.updateAutogroupSummary(userId, sbn.getPackageName(), needsOngoingFlag); } public void onNotificationUpdated(StatusBarNotification childSbn, Loading Loading @@ -211,6 +211,6 @@ public class GroupHelper { void removeAutoGroup(String key); void addAutoGroupSummary(int userId, String pkg, String triggeringKey); void removeAutoGroupSummary(int user, String pkg); void updateAutogroupSummary(String key, boolean needsOngoingFlag); void updateAutogroupSummary(int userId, String pkg, boolean needsOngoingFlag); } } services/core/java/com/android/server/notification/NotificationManagerService.java +2 −10 Original line number Diff line number Diff line Loading @@ -2587,19 +2587,11 @@ public class NotificationManagerService extends SystemService { } @Override public void updateAutogroupSummary(String key, boolean needsOngoingFlag) { String pkg; synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); pkg = r != null && r.getSbn() != null ? r.getSbn().getPackageName() : null; } public void updateAutogroupSummary(int userId, String pkg, boolean needsOngoingFlag) { boolean isAppForeground = pkg != null && mActivityManager.getPackageImportance(pkg) == IMPORTANCE_FOREGROUND; synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); if (r == null) return; updateAutobundledSummaryFlags(r.getUser().getIdentifier(), r.getSbn().getPackageName(), needsOngoingFlag, isAppForeground); updateAutobundledSummaryFlags(userId, pkg, needsOngoingFlag, isAppForeground); } } }); Loading services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java +7 −7 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ public class GroupHelperTest extends UiServiceTestCase { } verify(mCallback, times(AUTOGROUP_AT_COUNT + 1)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading Loading @@ -203,7 +203,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationUpdated(notifications.get(0), true); verify(mCallback, times(AUTOGROUP_AT_COUNT + 2)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading Loading @@ -236,7 +236,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationUpdated(notifications.get(0), true); verify(mCallback, times(AUTOGROUP_AT_COUNT + 3)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading @@ -263,7 +263,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationRemoved(notifications.get(0)); verify(mCallback, times(AUTOGROUP_AT_COUNT + 2)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading Loading @@ -291,7 +291,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationUpdated(notifications.get(0), true); verify(mCallback, times(1)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading @@ -315,7 +315,7 @@ public class GroupHelperTest extends UiServiceTestCase { } verify(mCallback, times(1)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading @@ -339,7 +339,7 @@ public class GroupHelperTest extends UiServiceTestCase { } verify(mCallback, times(0)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount(userId, pkg, AUTOGROUP_KEY), 0); Loading Loading
services/core/java/com/android/server/notification/GroupHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ public class GroupHelper { } String combinedKey = generatePackageGroupKey(userId, sbn.getPackageName(), group); boolean needsOngoingFlag = notifications.size() > 0; mCallback.updateAutogroupSummary(sbn.getKey(), needsOngoingFlag); mCallback.updateAutogroupSummary(userId, sbn.getPackageName(), needsOngoingFlag); } public void onNotificationUpdated(StatusBarNotification childSbn, Loading Loading @@ -211,6 +211,6 @@ public class GroupHelper { void removeAutoGroup(String key); void addAutoGroupSummary(int userId, String pkg, String triggeringKey); void removeAutoGroupSummary(int user, String pkg); void updateAutogroupSummary(String key, boolean needsOngoingFlag); void updateAutogroupSummary(int userId, String pkg, boolean needsOngoingFlag); } }
services/core/java/com/android/server/notification/NotificationManagerService.java +2 −10 Original line number Diff line number Diff line Loading @@ -2587,19 +2587,11 @@ public class NotificationManagerService extends SystemService { } @Override public void updateAutogroupSummary(String key, boolean needsOngoingFlag) { String pkg; synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); pkg = r != null && r.getSbn() != null ? r.getSbn().getPackageName() : null; } public void updateAutogroupSummary(int userId, String pkg, boolean needsOngoingFlag) { boolean isAppForeground = pkg != null && mActivityManager.getPackageImportance(pkg) == IMPORTANCE_FOREGROUND; synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); if (r == null) return; updateAutobundledSummaryFlags(r.getUser().getIdentifier(), r.getSbn().getPackageName(), needsOngoingFlag, isAppForeground); updateAutobundledSummaryFlags(userId, pkg, needsOngoingFlag, isAppForeground); } } }); Loading
services/tests/uiservicestests/src/com/android/server/notification/GroupHelperTest.java +7 −7 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ public class GroupHelperTest extends UiServiceTestCase { } verify(mCallback, times(AUTOGROUP_AT_COUNT + 1)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading Loading @@ -203,7 +203,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationUpdated(notifications.get(0), true); verify(mCallback, times(AUTOGROUP_AT_COUNT + 2)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading Loading @@ -236,7 +236,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationUpdated(notifications.get(0), true); verify(mCallback, times(AUTOGROUP_AT_COUNT + 3)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading @@ -263,7 +263,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationRemoved(notifications.get(0)); verify(mCallback, times(AUTOGROUP_AT_COUNT + 2)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading Loading @@ -291,7 +291,7 @@ public class GroupHelperTest extends UiServiceTestCase { mGroupHelper.onNotificationUpdated(notifications.get(0), true); verify(mCallback, times(1)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading @@ -315,7 +315,7 @@ public class GroupHelperTest extends UiServiceTestCase { } verify(mCallback, times(1)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount( Loading @@ -339,7 +339,7 @@ public class GroupHelperTest extends UiServiceTestCase { } verify(mCallback, times(0)) .updateAutogroupSummary(anyString(), eq(true)); .updateAutogroupSummary(anyInt(), anyString(), eq(true)); int userId = UserHandle.SYSTEM.getIdentifier(); assertEquals(mGroupHelper.getOngoingGroupCount(userId, pkg, AUTOGROUP_KEY), 0); Loading