Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 51563b5

Browse files
Beverlyharrisonlingren
authored andcommitted
Fix zen alarms only mode check
Also fixes setting the consolidated zen policy logging. Fixes: 140329813 Test: android.app.cts.NotificationManagerTest#testTotalSilenceOnlyMuteStreams Test: android.app.cts.NotificationManagerTest#testAlarmsOnlyMuteStreams Change-Id: I43d503ac23d7b0b141930d77cb76f1f589b22525 (cherry picked from commit dcc5cfc)
1 parent 0823f1b commit 51563b5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

core/java/android/service/notification/ZenModeConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ public static class ZenRule implements Parcelable {
16391639
@UnsupportedAppUsage
16401640
public String name; // required for automatic
16411641
@UnsupportedAppUsage
1642-
public int zenMode;
1642+
public int zenMode; // ie: Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
16431643
@UnsupportedAppUsage
16441644
public Uri conditionId; // required for automatic
16451645
public Condition condition; // optional

services/core/java/com/android/server/notification/ZenLog.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ private static String typeToString(int type) {
179179
case TYPE_SUPPRESSOR_CHANGED: return "suppressor_changed";
180180
case TYPE_LISTENER_HINTS_CHANGED: return "listener_hints_changed";
181181
case TYPE_SET_NOTIFICATION_POLICY: return "set_notification_policy";
182+
case TYPE_SET_CONSOLIDATED_ZEN_POLICY: return "set_consolidated_policy";
182183
default: return "unknown";
183184
}
184185
}

services/core/java/com/android/server/notification/ZenModeHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,12 +942,11 @@ private int computeZenMode() {
942942
}
943943

944944
private void applyCustomPolicy(ZenPolicy policy, ZenRule rule) {
945-
if (rule.zenMode == NotificationManager.INTERRUPTION_FILTER_NONE) {
945+
if (rule.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS) {
946946
policy.apply(new ZenPolicy.Builder()
947947
.disallowAllSounds()
948948
.build());
949-
} else if (rule.zenMode
950-
== NotificationManager.INTERRUPTION_FILTER_ALARMS) {
949+
} else if (rule.zenMode == Global.ZEN_MODE_ALARMS) {
951950
policy.apply(new ZenPolicy.Builder()
952951
.disallowAllSounds()
953952
.allowAlarms(true)

0 commit comments

Comments
 (0)