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

Commit d7bf792d authored by Ned Burns's avatar Ned Burns
Browse files

Extract NoManSimulator to top level

So it can be used by other tests (see following CLs)

Also adds some more methods to SbnBuilder to modify the underling
Notification.

Test: atest
Change-Id: I44c0b13ceabd30d633848a68074c2a9b31427d56
parent 6ebbebed
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -116,6 +116,27 @@ public class SbnBuilder {


    public SbnBuilder setNotification(Notification notification) {
    public SbnBuilder setNotification(Notification notification) {
        mNotification = notification;
        mNotification = notification;
        mNotificationBuilder = null;
        return this;
    }

    public SbnBuilder setContentTitle(Context context, String contentTitle) {
        modifyNotification(context).setContentTitle(contentTitle);
        return this;
    }

    public SbnBuilder setContentText(Context context, String contentText) {
        modifyNotification(context).setContentText(contentText);
        return this;
    }

    public SbnBuilder setGroup(Context context, String groupKey) {
        modifyNotification(context).setGroup(groupKey);
        return this;
    }

    public SbnBuilder setGroupSummary(Context context, boolean isGroupSummary) {
        modifyNotification(context).setGroupSummary(isGroupSummary);
        return this;
        return this;
    }
    }


+99 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.notification.collection;

import static org.junit.Assert.assertNotNull;

import android.service.notification.NotificationListenerService.Ranking;
import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;

import com.android.systemui.statusbar.NotificationListener.NotifServiceListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Simulates a NotificationManager
 *
 * You can post and retract notifications, each with an accompanying Ranking. The simulator will
 * keep its RankingMap up to date and call appropriate event listeners.
 */
public class NoManSimulator {
    private final List<NotifServiceListener> mListeners = new ArrayList<>();
    private final Map<String, Ranking> mRankings = new ArrayMap<>();

    public NoManSimulator() {
    }

    public void addListener(NotifServiceListener listener) {
        mListeners.add(listener);
    }

    public NotifEvent postNotif(NotificationEntryBuilder builder) {
        final NotificationEntry entry = builder.build();
        mRankings.put(entry.getKey(), entry.getRanking());
        final RankingMap rankingMap = buildRankingMap();
        for (NotifServiceListener listener : mListeners) {
            listener.onNotificationPosted(entry.getSbn(), rankingMap);
        }
        return new NotifEvent(entry.getSbn(), entry.getRanking(), rankingMap);
    }

    public NotifEvent retractNotif(StatusBarNotification sbn, int reason) {
        assertNotNull(mRankings.remove(sbn.getKey()));
        final RankingMap rankingMap = buildRankingMap();
        for (NotifServiceListener listener : mListeners) {
            listener.onNotificationRemoved(sbn, rankingMap, reason);
        }
        return new NotifEvent(sbn, null, rankingMap);
    }

    public void issueRankingUpdate() {
        final RankingMap rankingMap = buildRankingMap();
        for (NotifServiceListener listener : mListeners) {
            listener.onNotificationRankingUpdate(rankingMap);
        }
    }

    public void setRanking(String key, Ranking ranking) {
        mRankings.put(key, ranking);
    }

    private RankingMap buildRankingMap() {
        return new RankingMap(mRankings.values().toArray(new Ranking[0]));
    }

    public static class NotifEvent {
        public final String key;
        public final StatusBarNotification sbn;
        public final Ranking ranking;
        public final RankingMap rankingMap;

        private NotifEvent(
                StatusBarNotification sbn,
                Ranking ranking,
                RankingMap rankingMap) {
            this.key = sbn.getKey();
            this.sbn = sbn;
            this.ranking = ranking;
            this.rankingMap = rankingMap;
        }
    }
}
+31 −79
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import static com.android.systemui.statusbar.notification.collection.NotifCollec
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.eq;
@@ -35,9 +34,7 @@ import static org.mockito.Mockito.verify;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.os.RemoteException;
import android.os.RemoteException;
import android.service.notification.NotificationListenerService.Ranking;
import android.service.notification.NotificationListenerService.Ranking;
import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.NotificationStats;
import android.service.notification.NotificationStats;
import android.service.notification.StatusBarNotification;
import android.testing.AndroidTestingRunner;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.testing.TestableLooper;
import android.util.ArrayMap;
import android.util.ArrayMap;
@@ -50,6 +47,7 @@ import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationListener.NotifServiceListener;
import com.android.systemui.statusbar.NotificationListener.NotifServiceListener;
import com.android.systemui.statusbar.RankingBuilder;
import com.android.systemui.statusbar.RankingBuilder;
import com.android.systemui.statusbar.notification.collection.NoManSimulator.NotifEvent;
import com.android.systemui.statusbar.notification.collection.NotifCollection.CancellationReason;
import com.android.systemui.statusbar.notification.collection.NotifCollection.CancellationReason;
import com.android.systemui.util.Assert;
import com.android.systemui.util.Assert;


@@ -101,13 +99,14 @@ public class NotifCollectionTest extends SysuiTestCase {
        verify(mListenerService).addNotificationListener(mListenerCaptor.capture());
        verify(mListenerService).addNotificationListener(mListenerCaptor.capture());
        mServiceListener = Objects.requireNonNull(mListenerCaptor.getValue());
        mServiceListener = Objects.requireNonNull(mListenerCaptor.getValue());


        mNoMan = new NoManSimulator(mServiceListener);
        mNoMan = new NoManSimulator();
        mNoMan.addListener(mServiceListener);
    }
    }


    @Test
    @Test
    public void testEventDispatchedWhenNotifPosted() {
    public void testEventDispatchedWhenNotifPosted() {
        // WHEN a notification is posted
        // WHEN a notification is posted
        PostedNotif notif1 = mNoMan.postNotif(
        NotifEvent notif1 = mNoMan.postNotif(
                buildNotif(TEST_PACKAGE, 3)
                buildNotif(TEST_PACKAGE, 3)
                        .setRank(4747));
                        .setRank(4747));


@@ -127,7 +126,7 @@ public class NotifCollectionTest extends SysuiTestCase {
                .setRank(4747));
                .setRank(4747));


        // WHEN the notif is reposted
        // WHEN the notif is reposted
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3)
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3)
                .setRank(89));
                .setRank(89));


        // THEN the listener is notified
        // THEN the listener is notified
@@ -145,7 +144,7 @@ public class NotifCollectionTest extends SysuiTestCase {
        mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3));
        mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3));
        clearInvocations(mCollectionListener);
        clearInvocations(mCollectionListener);


        PostedNotif notif = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotificationEntry entry = mCollectionListener.getEntry(notif.key);
        NotificationEntry entry = mCollectionListener.getEntry(notif.key);
        clearInvocations(mCollectionListener);
        clearInvocations(mCollectionListener);


@@ -161,7 +160,7 @@ public class NotifCollectionTest extends SysuiTestCase {
    @Test
    @Test
    public void testRankingsAreUpdatedForOtherNotifs() {
    public void testRankingsAreUpdatedForOtherNotifs() {
        // GIVEN a collection with one notif
        // GIVEN a collection with one notif
        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3)
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3)
                .setRank(47));
                .setRank(47));
        NotificationEntry entry1 = mCollectionListener.getEntry(notif1.key);
        NotificationEntry entry1 = mCollectionListener.getEntry(notif1.key);


@@ -178,11 +177,11 @@ public class NotifCollectionTest extends SysuiTestCase {
    @Test
    @Test
    public void testRankingUpdateIsProperlyIssuedToEveryone() {
    public void testRankingUpdateIsProperlyIssuedToEveryone() {
        // GIVEN a collection with a couple notifs
        // GIVEN a collection with a couple notifs
        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3)
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3)
                .setRank(3));
                .setRank(3));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 8)
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 8)
                .setRank(2));
                .setRank(2));
        PostedNotif notif3 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 77)
        NotifEvent notif3 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 77)
                .setRank(1));
                .setRank(1));


        NotificationEntry entry1 = mCollectionListener.getEntry(notif1.key);
        NotificationEntry entry1 = mCollectionListener.getEntry(notif1.key);
@@ -217,7 +216,7 @@ public class NotifCollectionTest extends SysuiTestCase {
    @Test
    @Test
    public void testNotifEntriesAreNotPersistedAcrossRemovalAndReposting() {
    public void testNotifEntriesAreNotPersistedAcrossRemovalAndReposting() {
        // GIVEN a notification that has been posted
        // GIVEN a notification that has been posted
        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 3));
        NotificationEntry entry1 = mCollectionListener.getEntry(notif1.key);
        NotificationEntry entry1 = mCollectionListener.getEntry(notif1.key);


        // WHEN the notification is retracted and then reposted
        // WHEN the notification is retracted and then reposted
@@ -234,8 +233,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        // GIVEN a collection with a couple notifications and a lifetime extender
        // GIVEN a collection with a couple notifications and a lifetime extender
        mCollection.addNotificationLifetimeExtender(mExtender1);
        mCollection.addNotificationLifetimeExtender(mExtender1);


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47, "myTag"));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47, "myTag"));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88, "barTag"));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88, "barTag"));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // WHEN a notification is manually dismissed
        // WHEN a notification is manually dismissed
@@ -267,9 +266,9 @@ public class NotifCollectionTest extends SysuiTestCase {
    @Test(expected = IllegalStateException.class)
    @Test(expected = IllegalStateException.class)
    public void testDismissingNonExistentNotificationThrows() {
    public void testDismissingNonExistentNotificationThrows() {
        // GIVEN a collection that originally had three notifs, but where one was dismissed
        // GIVEN a collection that originally had three notifs, but where one was dismissed
        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        PostedNotif notif3 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 99));
        NotifEvent notif3 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 99));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        mNoMan.retractNotif(notif2.sbn, REASON_UNKNOWN);
        mNoMan.retractNotif(notif2.sbn, REASON_UNKNOWN);


@@ -292,8 +291,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender3);
        mCollection.addNotificationLifetimeExtender(mExtender3);


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // WHEN a notification is removed
        // WHEN a notification is removed
@@ -320,8 +319,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender3);
        mCollection.addNotificationLifetimeExtender(mExtender3);


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // GIVEN a notification gets lifetime-extended by one of them
        // GIVEN a notification gets lifetime-extended by one of them
@@ -357,8 +356,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender3);
        mCollection.addNotificationLifetimeExtender(mExtender3);


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // GIVEN a notification gets lifetime-extended by a couple of them
        // GIVEN a notification gets lifetime-extended by a couple of them
@@ -392,8 +391,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender2);
        mCollection.addNotificationLifetimeExtender(mExtender3);
        mCollection.addNotificationLifetimeExtender(mExtender3);


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // GIVEN a notification gets lifetime-extended by a couple of them
        // GIVEN a notification gets lifetime-extended by a couple of them
@@ -422,8 +421,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mExtender1.shouldExtendLifetime = true;
        mExtender1.shouldExtendLifetime = true;
        mExtender2.shouldExtendLifetime = true;
        mExtender2.shouldExtendLifetime = true;


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // GIVEN a notification gets lifetime-extended by a couple of them
        // GIVEN a notification gets lifetime-extended by a couple of them
@@ -452,8 +451,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mExtender1.shouldExtendLifetime = true;
        mExtender1.shouldExtendLifetime = true;
        mExtender2.shouldExtendLifetime = true;
        mExtender2.shouldExtendLifetime = true;


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // GIVEN a notification gets lifetime-extended by a couple of them
        // GIVEN a notification gets lifetime-extended by a couple of them
@@ -481,8 +480,8 @@ public class NotifCollectionTest extends SysuiTestCase {
        mExtender1.shouldExtendLifetime = true;
        mExtender1.shouldExtendLifetime = true;
        mExtender2.shouldExtendLifetime = true;
        mExtender2.shouldExtendLifetime = true;


        PostedNotif notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        NotifEvent notif1 = mNoMan.postNotif(buildNotif(TEST_PACKAGE, 47));
        PostedNotif notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotifEvent notif2 = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88));
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);
        NotificationEntry entry2 = mCollectionListener.getEntry(notif2.key);


        // GIVEN a notification gets lifetime-extended by a couple of them
        // GIVEN a notification gets lifetime-extended by a couple of them
@@ -491,7 +490,7 @@ public class NotifCollectionTest extends SysuiTestCase {
        clearInvocations(mExtender1, mExtender2, mExtender3);
        clearInvocations(mExtender1, mExtender2, mExtender3);


        // WHEN the notification is reposted
        // WHEN the notification is reposted
        PostedNotif notif2a = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88)
        NotifEvent notif2a = mNoMan.postNotif(buildNotif(TEST_PACKAGE2, 88)
                .setRank(4747)
                .setRank(4747)
                .setExplanation("Some new explanation"));
                .setExplanation("Some new explanation"));


@@ -512,53 +511,6 @@ public class NotifCollectionTest extends SysuiTestCase {
                .setId(id);
                .setId(id);
    }
    }


    private static class NoManSimulator {
        private final NotifServiceListener mListener;
        private final Map<String, Ranking> mRankings = new ArrayMap<>();

        private NoManSimulator(
                NotifServiceListener listener) {
            mListener = listener;
        }

        PostedNotif postNotif(NotificationEntryBuilder builder) {
            NotificationEntry entry = builder.build();
            mRankings.put(entry.getKey(), entry.getRanking());
            mListener.onNotificationPosted(entry.getSbn(), buildRankingMap());
            return new PostedNotif(entry.getSbn(), entry.getRanking());
        }

        void retractNotif(StatusBarNotification sbn, int reason) {
            assertNotNull(mRankings.remove(sbn.getKey()));
            mListener.onNotificationRemoved(sbn, buildRankingMap(), reason);
        }

        void issueRankingUpdate() {
            mListener.onNotificationRankingUpdate(buildRankingMap());
        }

        void setRanking(String key, Ranking ranking) {
            mRankings.put(key, ranking);
        }

        private RankingMap buildRankingMap() {
            return new RankingMap(mRankings.values().toArray(new Ranking[0]));
        }
    }

    private static class PostedNotif {
        public final String key;
        public final StatusBarNotification sbn;
        public final Ranking ranking;

        private PostedNotif(StatusBarNotification sbn,
                Ranking ranking) {
            this.key = sbn.getKey();
            this.sbn = sbn;
            this.ranking = ranking;
        }
    }

    private static class RecordingCollectionListener implements NotifCollectionListener {
    private static class RecordingCollectionListener implements NotifCollectionListener {
        private final Map<String, NotificationEntry> mLastSeenEntries = new ArrayMap<>();
        private final Map<String, NotificationEntry> mLastSeenEntries = new ArrayMap<>();


+22 −0
Original line number Original line Diff line number Diff line
@@ -140,6 +140,28 @@ public class NotificationEntryBuilder {
        return this;
        return this;
    }
    }


    /* Delegated to Notification.Builder (via SbnBuilder) */

    public NotificationEntryBuilder setContentTitle(Context context, String contentTitle) {
        mSbnBuilder.setContentTitle(context, contentTitle);
        return this;
    }

    public NotificationEntryBuilder setContentText(Context context, String contentText) {
        mSbnBuilder.setContentText(context, contentText);
        return this;
    }

    public NotificationEntryBuilder setGroup(Context context, String groupKey) {
        mSbnBuilder.setGroup(context, groupKey);
        return this;
    }

    public NotificationEntryBuilder setGroupSummary(Context context, boolean isGroupSummary) {
        mSbnBuilder.setGroupSummary(context, isGroupSummary);
        return this;
    }

    /* Delegated to RankingBuilder */
    /* Delegated to RankingBuilder */


    public NotificationEntryBuilder setRank(int rank) {
    public NotificationEntryBuilder setRank(int rank) {