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

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

Merge "Add protective null check" into main

parents 43b0f2fe 14ec8fe5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -223,7 +223,8 @@ class KeyguardNotificationVisibilityProviderImpl @Inject constructor(
            // ranking.lockscreenVisibilityOverride contains possibly out of date DPC and Setting
            // info, and NotificationLockscreenUserManagerImpl is already listening for updates
            // to those
            entry.ranking.channel.lockscreenVisibility == VISIBILITY_SECRET
            entry.ranking.channel != null && entry.ranking.channel.lockscreenVisibility ==
                    VISIBILITY_SECRET
        } else {
            entry.ranking.lockscreenVisibilityOverride == VISIBILITY_SECRET
        }
+17 −0
Original line number Diff line number Diff line
@@ -471,6 +471,23 @@ public class KeyguardNotificationVisibilityProviderTest extends SysuiTestCase {
        assertTrue(mKeyguardNotificationVisibilityProvider.shouldHideNotification(mEntry));
    }

    @Test
    public void publicMode_nullChannel_allowed() {
        mFeatureFlags.set(Flags.NOTIF_LS_BACKGROUND_THREAD, true);
        // GIVEN an 'unfiltered-keyguard-showing' state
        setupUnfilteredState(mEntry);

        // WHEN the notification's user is in public mode and settings are configured to disallow
        // notifications in public mode
        when(mLockscreenUserManager.isLockscreenPublicMode(CURR_USER_ID)).thenReturn(true);
        mEntry.setRanking(new RankingBuilder()
                .setKey(mEntry.getKey())
                .setVisibilityOverride(VISIBILITY_SECRET).build());

        // THEN allow the entry
        assertFalse(mKeyguardNotificationVisibilityProvider.shouldHideNotification(mEntry));
    }

    @Test
    public void publicMode_notifDisallowed() {
        mFeatureFlags.set(Flags.NOTIF_LS_BACKGROUND_THREAD, true);