diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java index e83d453d1938f..e184f839e8057 100644 --- a/services/core/java/com/android/server/notification/RankingHelper.java +++ b/services/core/java/com/android/server/notification/RankingHelper.java @@ -1158,6 +1158,9 @@ public class RankingHelper implements RankingConfig { public boolean badgingEnabled(UserHandle userHandle) { int userId = userHandle.getIdentifier(); + if (userId == UserHandle.USER_ALL) { + return false; + } if (mBadgingEnabled.indexOfKey(userId) < 0) { mBadgingEnabled.put(userId, Secure.getIntForUser(mContext.getContentResolver(), diff --git a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java index 0f8c815bb2a2e..cb0ee2566bee8 100644 --- a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java +++ b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java @@ -1231,6 +1231,15 @@ public class RankingHelperTest extends NotificationTestCase { assertFalse(mHelper.badgingEnabled(USER)); } + @Test + public void testBadgingForUserAll() throws Exception { + try { + mHelper.badgingEnabled(UserHandle.ALL); + } catch (Exception e) { + fail("just don't throw"); + } + } + @Test public void testBadgingOverrideUserIsolation() throws Exception { Secure.putIntForUser(getContext().getContentResolver(),