Merge "Do not wake AOD for hidden notifications" into udc-dev am: c429c8d00a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22241748

Change-Id: I813ebe5dfb579e222a423142a885ea78f25a322e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Julia Reynolds
2023-03-27 16:21:55 +00:00
committed by Automerger Merge Worker
3 changed files with 32 additions and 0 deletions

View File

@@ -234,6 +234,14 @@ class NotificationInterruptLogger @Inject constructor(
}) })
} }
fun logNoPulsingNotificationHidden(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = entry.logKey
}, {
"No pulsing: notification hidden on lock screen: $str1"
})
}
fun logNoPulsingNotImportant(entry: NotificationEntry) { fun logNoPulsingNotImportant(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, { buffer.log(TAG, DEBUG, {
str1 = entry.logKey str1 = entry.logKey

View File

@@ -482,6 +482,12 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
return false; return false;
} }
if (entry.getRanking().getLockscreenVisibilityOverride()
== Notification.VISIBILITY_PRIVATE) {
if (log) mLogger.logNoPulsingNotificationHidden(entry);
return false;
}
if (entry.getImportance() < NotificationManager.IMPORTANCE_DEFAULT) { if (entry.getImportance() < NotificationManager.IMPORTANCE_DEFAULT) {
if (log) mLogger.logNoPulsingNotImportant(entry); if (log) mLogger.logNoPulsingNotImportant(entry);
return false; return false;

View File

@@ -19,12 +19,14 @@ package com.android.systemui.statusbar.notification.interruption;
import static android.app.Notification.FLAG_BUBBLE; import static android.app.Notification.FLAG_BUBBLE;
import static android.app.Notification.FLAG_FOREGROUND_SERVICE; import static android.app.Notification.FLAG_FOREGROUND_SERVICE;
import static android.app.Notification.GROUP_ALERT_SUMMARY; import static android.app.Notification.GROUP_ALERT_SUMMARY;
import static android.app.Notification.VISIBILITY_PRIVATE;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.NotificationManager.IMPORTANCE_HIGH; import static android.app.NotificationManager.IMPORTANCE_HIGH;
import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
import static android.app.NotificationManager.VISIBILITY_NO_OVERRIDE;
import static com.android.systemui.statusbar.NotificationEntryHelper.modifyRanking; import static com.android.systemui.statusbar.NotificationEntryHelper.modifyRanking;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
@@ -222,9 +224,25 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
ensureStateForHeadsUpWhenDozing(); ensureStateForHeadsUpWhenDozing();
NotificationEntry entry = createNotification(IMPORTANCE_DEFAULT); NotificationEntry entry = createNotification(IMPORTANCE_DEFAULT);
modifyRanking(entry)
.setVisibilityOverride(VISIBILITY_NO_OVERRIDE)
.build();
assertThat(mNotifInterruptionStateProvider.shouldHeadsUp(entry)).isTrue(); assertThat(mNotifInterruptionStateProvider.shouldHeadsUp(entry)).isTrue();
} }
@Test
public void testShouldHeadsUpWhenDozing_hiddenOnLockscreen() {
ensureStateForHeadsUpWhenDozing();
NotificationEntry entry = createNotification(IMPORTANCE_DEFAULT);
modifyRanking(entry)
.setVisibilityOverride(VISIBILITY_PRIVATE)
.build();
assertThat(mNotifInterruptionStateProvider.shouldHeadsUp(entry)).isFalse();
}
@Test @Test
public void testShouldNotHeadsUpWhenDozing_pulseDisabled() { public void testShouldNotHeadsUpWhenDozing_pulseDisabled() {
// GIVEN state for "heads up when dozing" is true // GIVEN state for "heads up when dozing" is true