OSDN Git Service

catch USER_ALL in badging check
authorChris Wren <cwren@google.com>
Fri, 12 May 2017 19:02:06 +0000 (15:02 -0400)
committerChris Wren <cwren@google.com>
Tue, 16 May 2017 16:55:25 +0000 (12:55 -0400)
Bug: 38264652
Test: runtest systemui-notification
Change-Id: Id482ed4984eef83ad0e9876acda5addb65aca5f9

services/core/java/com/android/server/notification/RankingHelper.java
services/tests/notification/src/com/android/server/notification/RankingHelperTest.java

index e83d453..e184f83 100644 (file)
@@ -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(),
index 0f8c815..cb0ee25 100644 (file)
@@ -1232,6 +1232,15 @@ public class RankingHelperTest extends NotificationTestCase {
     }
 
     @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(),
                 Secure.NOTIFICATION_BADGING, 0,