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

Commit d9864e25 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Allow blocked apps to create channels"

parents 37fb4967 e866533f
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