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

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

Merge "Add null check for tests" into main

parents fd49807d 1b76df58
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ public class NotificationLockscreenUserManagerImpl implements
        }
        NotificationEntry entry = mCommonNotifCollectionLazy.get().getEntry(key);
        if (mFeatureFlags.isEnabled(Flags.NOTIF_LS_BACKGROUND_THREAD)) {
            return entry != null
            return entry != null && entry.getRanking().getChannel() != null
                    && entry.getRanking().getChannel().getLockscreenVisibility()
                    == Notification.VISIBILITY_PRIVATE;
        } else {
+14 −0
Original line number Diff line number Diff line
@@ -322,6 +322,20 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
        assertTrue(mLockscreenUserManager.needsRedaction(mCurrentUserNotif));
    }

    @Test
    public void testCurrentUserPrivateNotificationsNullChannel() {
        // GIVEN current user allows private notifications to show
        mSettings.putIntForUser(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1,
                mCurrentUser.id);
        changeSetting(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);

        mCurrentUserNotif.setRanking(new RankingBuilder(mCurrentUserNotif.getRanking())
                .setChannel(null)
                .setVisibilityOverride(VISIBILITY_NO_OVERRIDE).build());
        // THEN the notification is not redacted
        assertFalse(mLockscreenUserManager.needsRedaction(mCurrentUserNotif));
    }

    @Test
    public void testWorkPrivateNotificationsRedacted() {
        // GIVEN work profile doesn't private notifications to show