Merge "Automatic zen rules are always priority only"

This commit is contained in:
TreeHugger Robot
2017-12-06 16:46:45 +00:00
committed by Android (Google) Code Review
3 changed files with 36 additions and 4 deletions

View File

@@ -530,6 +530,13 @@ public class ZenModeConfig implements Parcelable {
rt.creationTime = safeLong(parser, RULE_ATT_CREATION_TIME, 0);
rt.enabler = parser.getAttributeValue(null, RULE_ATT_ENABLER);
rt.condition = readConditionXml(parser);
// all default rules and user created rules updated to zenMode important interruptions
if (rt.zenMode != Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS
&& Condition.isValidId(rt.conditionId, SYSTEM_AUTHORITY)) {
Slog.i(TAG, "Updating zenMode of automatic rule " + rt.name);
rt.zenMode = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
}
return rt;
}

View File

@@ -5028,8 +5028,33 @@ message MetricsEvent {
// OS: P
SCREEN_LOCK_SETTINGS = 1265;
// ---- End P Constants, all P constants go above this line ----
// OPEN: Settings > Sound > Do Not Disturb > Turn on automatically > Delete rule (trash can icon)
// CATEGORY: SETTINGS
// OS: P
NOTIFICATION_ZEN_MODE_DELETE_RULE_DIALOG = 1266;
// OPEN: Settings > Sound > Do Not Disturb > Turn on automatically > Select rule ("Event") > Rule name > OK
// CATEGORY: SETTINGS
// OS: P
ACTION_ZEN_MODE_RULE_NAME_CHANGE_OK = 1267;
// OPEN: Settings > Sound > Do Not Disturb > TURN ON NOW/TURN OFF NOW
// CATEGORY: SETTINGS
// OS: P
ACTION_ZEN_TOGGLE_DND_BUTTON = 1268;
// OPEN: Settings > Sound > Do Not Disturb > Turn on automatically > Add rule > Event/Time
// OPEN: Settings > Sound > Do Not Disturb > Turn on automatically > Select rule ("Event") > Rule name
// CATEGORY: SETTINGS
// OS: P
NOTIFICATION_ZEN_MODE_RULE_NAME_DIALOG = 1269;
// OPEN: Settings > Sound > Do Not Disturb > Turn on automatically > Add rule
// CATEGORY: SETTINGS
// OS: P
NOTIFICATION_ZEN_MODE_RULE_SELECTION_DIALOG = 1270;
// ---- End P Constants, all P constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
}

View File

@@ -947,7 +947,7 @@ public class ZenModeHelper {
rule1.enabled = false;
rule1.name = mDefaultRuleWeeknightsName;
rule1.conditionId = ZenModeConfig.toScheduleConditionId(weeknights);
rule1.zenMode = Global.ZEN_MODE_ALARMS;
rule1.zenMode = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
rule1.component = ScheduleConditionProvider.COMPONENT;
rule1.id = SCHEDULED_DEFAULT_RULE_1;
rule1.creationTime = System.currentTimeMillis();
@@ -963,7 +963,7 @@ public class ZenModeHelper {
rule2.enabled = false;
rule2.name = mDefaultRuleWeekendsName;
rule2.conditionId = ZenModeConfig.toScheduleConditionId(weekends);
rule2.zenMode = Global.ZEN_MODE_ALARMS;
rule2.zenMode = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
rule2.component = ScheduleConditionProvider.COMPONENT;
rule2.id = SCHEDULED_DEFAULT_RULE_2;
rule2.creationTime = System.currentTimeMillis();
@@ -980,7 +980,7 @@ public class ZenModeHelper {
rule.enabled = false;
rule.name = mDefaultRuleEventsName;
rule.conditionId = ZenModeConfig.toEventConditionId(events);
rule.zenMode = Global.ZEN_MODE_ALARMS;
rule.zenMode = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
rule.component = EventConditionProvider.COMPONENT;
rule.id = EVENTS_DEFAULT_RULE;
rule.creationTime = System.currentTimeMillis();