From bf16c14cbf4af54153e691ea419c853cc5f11b62 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 27 Nov 2017 16:21:34 -0500 Subject: Automatic zen rules are always priority only - Default automatic rules are priority only - Existing user-created rules will be changed to priority only - New user-created rules will always be priority only - Metrics for new dialogs and zen preference controllers Test: manual Bug: 63077372 Change-Id: I8694d10ebdfa67ba96f4936c74eae17b450e32af --- .../service/notification/ZenModeConfig.java | 7 ++++++ proto/src/metrics_constants.proto | 27 +++++++++++++++++++++- .../android/server/notification/ZenModeHelper.java | 6 ++--- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index 512f2df9747e..74866b85a1c5 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -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; } diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index 968e08b00663..6faf1f9dcd71 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -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 } diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java index 1e9fab5ce574..b746b2c6aa38 100644 --- a/services/core/java/com/android/server/notification/ZenModeHelper.java +++ b/services/core/java/com/android/server/notification/ZenModeHelper.java @@ -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(); -- cgit v1.2.3-59-g8ed1b