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 dcc5cfc561)
This commit is contained in:
committed by
Harrison Lingren
parent
0823f1b508
commit
51563b5ffe
@@ -1639,7 +1639,7 @@ public class ZenModeConfig implements Parcelable {
|
|||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public String name; // required for automatic
|
public String name; // required for automatic
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public int zenMode;
|
public int zenMode; // ie: Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public Uri conditionId; // required for automatic
|
public Uri conditionId; // required for automatic
|
||||||
public Condition condition; // optional
|
public Condition condition; // optional
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class ZenLog {
|
|||||||
case TYPE_SUPPRESSOR_CHANGED: return "suppressor_changed";
|
case TYPE_SUPPRESSOR_CHANGED: return "suppressor_changed";
|
||||||
case TYPE_LISTENER_HINTS_CHANGED: return "listener_hints_changed";
|
case TYPE_LISTENER_HINTS_CHANGED: return "listener_hints_changed";
|
||||||
case TYPE_SET_NOTIFICATION_POLICY: return "set_notification_policy";
|
case TYPE_SET_NOTIFICATION_POLICY: return "set_notification_policy";
|
||||||
|
case TYPE_SET_CONSOLIDATED_ZEN_POLICY: return "set_consolidated_policy";
|
||||||
default: return "unknown";
|
default: return "unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -942,12 +942,11 @@ public class ZenModeHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyCustomPolicy(ZenPolicy policy, ZenRule rule) {
|
private void applyCustomPolicy(ZenPolicy policy, ZenRule rule) {
|
||||||
if (rule.zenMode == NotificationManager.INTERRUPTION_FILTER_NONE) {
|
if (rule.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS) {
|
||||||
policy.apply(new ZenPolicy.Builder()
|
policy.apply(new ZenPolicy.Builder()
|
||||||
.disallowAllSounds()
|
.disallowAllSounds()
|
||||||
.build());
|
.build());
|
||||||
} else if (rule.zenMode
|
} else if (rule.zenMode == Global.ZEN_MODE_ALARMS) {
|
||||||
== NotificationManager.INTERRUPTION_FILTER_ALARMS) {
|
|
||||||
policy.apply(new ZenPolicy.Builder()
|
policy.apply(new ZenPolicy.Builder()
|
||||||
.disallowAllSounds()
|
.disallowAllSounds()
|
||||||
.allowAlarms(true)
|
.allowAlarms(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user