Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e866533f authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Allow blocked apps to create channels

Change-Id: I64b90332095f949af003db3db98da75b22a09c64
Fixes: 36040396
Test: runtest systemui-notification
parent 41eae911
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -424,7 +424,8 @@ public class NotificationManager
     * 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));
+0 −3
Original line number Diff line number Diff line
@@ -510,9 +510,6 @@ public class RankingHelper implements RankingConfig {
        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");
        }
+2 −7
Original line number Diff line number Diff line
@@ -427,13 +427,8 @@ public class RankingHelperTest {
    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
        }
                new NotificationChannel(pkg, "bananas", IMPORTANCE_LOW), true);
    }

    @Test