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

Commit caf147a2 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Update ranking for uninflated updated notifs"

parents b943579d 29ad6792
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -618,6 +618,7 @@ public class NotificationEntryManager implements
        NotificationEntry entry = mPendingNotifications.get(key);
        if (entry != null) {
            entry.setSbn(notification);
            entry.setRanking(ranking);
        } else {
            entry = new NotificationEntry(
                    notification,
+4 −6
Original line number Diff line number Diff line
@@ -41,8 +41,6 @@ import javax.inject.Inject;
 */
@SysUISingleton
public class RankingCoordinator implements Coordinator {
    private static final String TAG = "RankingNotificationCoordinator";

    private final StatusBarStateController mStatusBarStateController;
    private final HighPriorityProvider mHighPriorityProvider;
    private final NodeController mSilentHeaderController;
@@ -65,7 +63,7 @@ public class RankingCoordinator implements Coordinator {
        mStatusBarStateController.addCallback(mStatusBarStateCallback);

        pipeline.addPreGroupFilter(mSuspendedFilter);
        pipeline.addPreGroupFilter(mDozingFilter);
        pipeline.addPreGroupFilter(mDndVisualEffectsFilter);
    }

    public NotifSectioner getAlertingSectioner() {
@@ -114,10 +112,10 @@ public class RankingCoordinator implements Coordinator {
        }
    };

    private final NotifFilter mDozingFilter = new NotifFilter("IsDozingFilter") {
    private final NotifFilter mDndVisualEffectsFilter = new NotifFilter(
            "DndSuppressingVisualEffects") {
        @Override
        public boolean shouldFilterOut(NotificationEntry entry, long now) {
            // Dozing + DND Settings from Ranking object
            if (mStatusBarStateController.isDozing() && entry.shouldSuppressAmbient()) {
                return true;
            }
@@ -130,7 +128,7 @@ public class RankingCoordinator implements Coordinator {
            new StatusBarStateController.StateListener() {
                @Override
                public void onDozingChanged(boolean isDozing) {
                    mDozingFilter.invalidateList();
                    mDndVisualEffectsFilter.invalidateList();
                }
            };
}
+1 −1
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView

    /**
     * Returns whether this row is considered non-blockable (i.e. it's a non-blockable system notif
     * or is in a whitelist).
     * or is in an allowList).
     */
    public boolean getIsNonblockable() {
        // If the SystemNotifAsyncTask hasn't finished running or retrieved a value, we'll try once
+30 −0
Original line number Diff line number Diff line
@@ -379,6 +379,36 @@ public class NotificationEntryManagerTest extends SysuiTestCase {
        assertEquals("action", mEntry.getSmartActions().get(0).title);
    }

    @Test
    public void testUpdatePendingNotification_rankingUpdated() {
        // GIVEN a notification with ranking is pending
        final Ranking originalRanking = mEntry.getRanking();
        mEntryManager.mPendingNotifications.put(mEntry.getKey(), mEntry);

        // WHEN the same notification has been updated with a new ranking
        final int newRank = 2345;
        doAnswer(invocationOnMock -> {
            Ranking ranking = (Ranking)
                    invocationOnMock.getArguments()[1];
            ranking.populate(
                    mEntry.getKey(),
                    newRank, /* this changed!! */
                    false,
                    0,
                    0,
                    IMPORTANCE_DEFAULT,
                    null, null,
                    null, null, null, true,
                    Ranking.USER_SENTIMENT_NEUTRAL, false, -1,
                    false, null, null, false, false, false, null, 0, false);
            return true;
        }).when(mRankingMap).getRanking(eq(mEntry.getKey()), any(Ranking.class));
        mEntryManager.addNotification(mSbn, mRankingMap);

        // THEN ranking for the entry has been updated with new ranking
        assertEquals(newRank, mEntry.getRanking().getRank());
    }

    @Test
    public void testLifetimeExtenders_ifNotificationIsRetainedItIsntRemoved() {
        // GIVEN an entry manager with a notification