mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mDefaultConfig = new ZenModeConfig();
- mDefaultRuleWeeknightsName = mContext.getResources()
- .getString(R.string.zen_mode_default_weeknights_name);
- mDefaultRuleWeekendsName = mContext.getResources()
- .getString(R.string.zen_mode_default_weekends_name);
- mDefaultRuleEventsName = mContext.getResources()
- .getString(R.string.zen_mode_default_events_name);
setDefaultZenRules(mContext);
mConfig = mDefaultConfig;
mConfigs.put(UserHandle.USER_SYSTEM, mConfig);
}
private void appendDefaultRules (ZenModeConfig config) {
+ getDefaultRuleNames();
appendDefaultScheduleRules(config);
appendDefaultEventRules(config);
}
}
}
+ private void getDefaultRuleNames() {
+ // on locale-change, these values differ
+ mDefaultRuleWeeknightsName = mContext.getResources()
+ .getString(R.string.zen_mode_default_weeknights_name);
+ mDefaultRuleWeekendsName = mContext.getResources()
+ .getString(R.string.zen_mode_default_weekends_name);
+ mDefaultRuleEventsName = mContext.getResources()
+ .getString(R.string.zen_mode_default_events_name);
+ }
+
@VisibleForTesting
protected void applyRestrictions() {
final boolean zen = mZenMode != Global.ZEN_MODE_OFF;
weeknights.days = ZenModeConfig.WEEKNIGHT_DAYS;
weeknights.startHour = 22;
weeknights.endHour = 7;
+ weeknights.exitAtAlarm = true;
final ZenRule rule1 = new ZenRule();
rule1.enabled = false;
rule1.name = mDefaultRuleWeeknightsName;
weekends.startHour = 23;
weekends.startMinute = 30;
weekends.endHour = 10;
+ weekends.exitAtAlarm = true;
final ZenRule rule2 = new ZenRule();
rule2.enabled = false;
rule2.name = mDefaultRuleWeekendsName;