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

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

Allow apps to enable notification badging.

Test: runtest systemui-notification
Change-Id: Ia16d671d864d1eee902652e31f023e30dc6b7387
parent 496777de
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -243,18 +243,6 @@ public final class NotificationChannel implements Parcelable {
        this.mImportance = importance;
    }

    /**
     * Sets whether notifications posted to this channel can appear as application icon badges
     * in a Launcher.
     *
     * Only modifiable by the system and notification ranker.
     *
     * @param showBadge true if badges should be allowed to be shown.
     */
    public void setShowBadge(boolean showBadge) {
        this.mShowBadge = showBadge;
    }

    /**
     * Sets whether notifications are allowed to be posted to this channel.
     *
@@ -269,6 +257,16 @@ public final class NotificationChannel implements Parcelable {

    // Modifiable by apps on channel creation.

    /**
     * Sets whether notifications posted to this channel can appear as application icon badges
     * in a Launcher.
     *
     * @param showBadge true if badges should be allowed to be shown.
     */
    public void setShowBadge(boolean showBadge) {
        this.mShowBadge = showBadge;
    }

    /**
     * Sets the sound that should be played for notifications posted to this channel if
     * the notifications don't supply a sound. Only modifiable before the channel is submitted
+0 −1
Original line number Diff line number Diff line
@@ -442,7 +442,6 @@ public class RankingHelper implements RankingConfig {
        }
        // Reset fields that apps aren't allowed to set.
        if (fromTargetApp) {
            channel.setShowBadge(false);
            channel.setBypassDnd(r.priority == Notification.PRIORITY_MAX);
            channel.setLockscreenVisibility(r.visibility);
        }
+2 −2
Original line number Diff line number Diff line
@@ -583,7 +583,7 @@ public class RankingHelperTest {
        assertEquals(channel.shouldShowLights(), savedChannel.shouldShowLights());
        assertFalse(savedChannel.canBypassDnd());
        assertFalse(Notification.VISIBILITY_SECRET == savedChannel.getLockscreenVisibility());
        assertFalse(savedChannel.canShowBadge());
        assertEquals(channel.canShowBadge(), savedChannel.canShowBadge());
    }

    @Test
@@ -611,6 +611,6 @@ public class RankingHelperTest {
        assertEquals(channel.shouldShowLights(), savedChannel.shouldShowLights());
        assertFalse(savedChannel.canBypassDnd());
        assertFalse(Notification.VISIBILITY_SECRET == savedChannel.getLockscreenVisibility());
        assertFalse(savedChannel.canShowBadge());
        assertEquals(channel.canShowBadge(), savedChannel.canShowBadge());
    }
}