commit | 93d17dbc2b0d16c3090537e29693d260602b4a40 | [log] [tgz] |
---|---|---|
author | Julia Reynolds <juliacr@google.com> | Thu Feb 08 14:28:38 2024 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Thu Feb 08 14:28:38 2024 +0000 |
tree | c9ee3e63f49caf764a4fdc35820b632949647122 | |
parent | 43b0f2fe3705c33cd9ecf7de7b89667da8ab7413 [diff] | |
parent | 14ec8fe56c996be4f9f104ebf14593631693e931 [diff] |
Merge "Add protective null check" into main
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt index aca8b64..d7fe36f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt
@@ -223,7 +223,8 @@ // 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 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java index b922ab3..3811f04 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProviderTest.java
@@ -472,6 +472,23 @@ } @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); NotificationChannel channel = new NotificationChannel("1", "1", IMPORTANCE_HIGH);