summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2015-05-08 22:29:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-08 22:29:12 +0000
commit4755cb3e5d8012b5554369d0df25ba8634267aa2 (patch)
treeaf73931e08f40cbc6962f09e13b3b0b2fb54489c /services
parentd89a6b2abc38907a532da7dec073663da5a74e7c (diff)
parentcb9aa20bddbeebc3a052e40ca3b7d0a511fa8358 (diff)
downloadframeworks_base-4755cb3e5d8012b5554369d0df25ba8634267aa2.zip
frameworks_base-4755cb3e5d8012b5554369d0df25ba8634267aa2.tar.gz
frameworks_base-4755cb3e5d8012b5554369d0df25ba8634267aa2.tar.bz2
Merge "Zen: Tweak default automatic rules." into mnc-dev
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/notification/CalendarTracker.java4
-rw-r--r--services/core/java/com/android/server/notification/ZenModeHelper.java17
2 files changed, 20 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/notification/CalendarTracker.java b/services/core/java/com/android/server/notification/CalendarTracker.java
index 28da73c..71d7f19 100644
--- a/services/core/java/com/android/server/notification/CalendarTracker.java
+++ b/services/core/java/com/android/server/notification/CalendarTracker.java
@@ -16,6 +16,8 @@
package com.android.server.notification;
+import static android.service.notification.ZenModeConfig.EventInfo.ANY_CALENDAR;
+
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
@@ -150,7 +152,7 @@ public class CalendarTracker {
eventId, owner, calendarId));
final boolean meetsTime = time >= begin && time < end;
final boolean meetsCalendar = visible
- && (filter.calendar == 0 || filter.calendar == calendarId)
+ && (filter.calendar == ANY_CALENDAR || filter.calendar == calendarId)
&& availability != Instances.AVAILABILITY_FREE;
if (meetsCalendar) {
if (DEBUG) Log.d(TAG, " MEETS CALENDAR");
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index ca354e0..aeb6b78 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -43,6 +43,7 @@ import android.provider.Settings.Global;
import android.service.notification.IConditionListener;
import android.service.notification.NotificationListenerService;
import android.service.notification.ZenModeConfig;
+import android.service.notification.ZenModeConfig.EventInfo;
import android.service.notification.ZenModeConfig.ScheduleInfo;
import android.service.notification.ZenModeConfig.ZenRule;
import android.util.ArraySet;
@@ -91,6 +92,7 @@ public class ZenModeHelper {
mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mDefaultConfig = readDefaultConfig(context.getResources());
appendDefaultScheduleRules(mDefaultConfig);
+ appendDefaultEventRules(mDefaultConfig);
mConfig = mDefaultConfig;
mSettingsObserver = new SettingsObserver(mHandler);
mSettingsObserver.observe();
@@ -439,6 +441,20 @@ public class ZenModeHelper {
config.automaticRules.put(config.newRuleId(), rule2);
}
+ private void appendDefaultEventRules(ZenModeConfig config) {
+ if (config == null) return;
+
+ final EventInfo events = new EventInfo();
+ events.calendar = EventInfo.ANY_CALENDAR;
+ events.reply = EventInfo.REPLY_YES_OR_MAYBE;
+ final ZenRule rule = new ZenRule();
+ rule.enabled = false;
+ rule.name = mContext.getResources().getString(R.string.zen_mode_default_events_name);
+ rule.conditionId = ZenModeConfig.toEventConditionId(events);
+ rule.zenMode = Global.ZEN_MODE_ALARMS;
+ config.automaticRules.put(config.newRuleId(), rule);
+ }
+
private static int zenSeverity(int zen) {
switch (zen) {
case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: return 1;
@@ -481,6 +497,7 @@ public class ZenModeHelper {
Log.i(TAG, "No existing V1 downtime found, generating default schedules");
appendDefaultScheduleRules(rt);
}
+ appendDefaultEventRules(rt);
return rt;
}
};