Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf16c14c authored by Beverly's avatar Beverly
Browse files

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
parent 7742160e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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;
    }

+26 −1
Original line number Diff line number Diff line
@@ -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
  }
+3 −3
Original line number Diff line number Diff line
@@ -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();