Allow blocked apps to create channels

Change-Id: I64b90332095f949af003db3db98da75b22a09c64
Fixes: 36040396
Test: runtest systemui-notification
(cherry picked from commit e866533f11a137a0b179c11856c6334d8b1b195e)
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index d37e209..2296838 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -424,7 +424,8 @@
      * This is a no-op for channels that already exist.
      *
      * @param channel  the channel to create.  Note that the created channel may differ from this
-     *                 value.  If the channel already exists, it will not be modified.
+     *                 value. If the provided channel is malformed, a RemoteException will be
+     *                 thrown. If the channel already exists, it will not be modified.
      */
     public void createNotificationChannel(@NonNull NotificationChannel channel) {
         createNotificationChannels(Arrays.asList(channel));
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index 6097071..4b1804c 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -510,9 +510,6 @@
         if (r == null) {
             throw new IllegalArgumentException("Invalid package");
         }
-        if (IMPORTANCE_NONE == r.importance) {
-            throw new IllegalArgumentException("Package blocked");
-        }
         if (channel.getGroup() != null && !r.groups.containsKey(channel.getGroup())) {
             throw new IllegalArgumentException("NotificationChannelGroup doesn't exist");
         }
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 450f9b6..5f215f9 100644
--- a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java
+++ b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java
@@ -427,13 +427,8 @@
     public void testCreateChannel_blocked() throws Exception {
         mHelper.setImportance(pkg, uid, NotificationManager.IMPORTANCE_NONE);
 
-        try {
-            mHelper.createNotificationChannel(pkg, uid,
-                    new NotificationChannel(pkg, "", IMPORTANCE_LOW), true);
-            fail("Channel creation should fail");
-        } catch (IllegalArgumentException e) {
-            // pass
-        }
+        mHelper.createNotificationChannel(pkg, uid,
+                new NotificationChannel(pkg, "bananas", IMPORTANCE_LOW), true);
     }
 
     @Test