summaryrefslogtreecommitdiffstats
path: root/core/java/android/service
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-11-30 16:26:19 -0500
committerJohn Spurlock <jspurlock@google.com>2014-12-08 11:00:57 -0500
commit530052a2fe3b6a6a4246ce28ab0ced647fe7f470 (patch)
treea54342518eb9b94bf43b49fb50d2db1771463436 /core/java/android/service
parent78a7357787406220c4c2459f8d25a0175ac98347 (diff)
downloadframeworks_base-530052a2fe3b6a6a4246ce28ab0ced647fe7f470.zip
frameworks_base-530052a2fe3b6a6a4246ce28ab0ced647fe7f470.tar.gz
frameworks_base-530052a2fe3b6a6a4246ce28ab0ced647fe7f470.tar.bz2
Zen: New behavior for built-in downtime + nextalarm conditions.
- Downtime: Allow user to enter downtime early, offer as an end condition four hours before downtime starts. Available in either none or priority, regardless of settings configuration. - Downtime: Always exit before next alarm if zen=none. - Downtime: Make more like any other condition provider, remove special status (mostly). - Downtime: New auto-triggering rules, allow triggering after a manual condition ends, once. - Decouple NextAlarm + Downtime providers, allow them to offer their conditions at the same time. - Downtime/NextAlarm: Update conditions if they change while being requested, even if unsubscribed. - Make all three built-in condition providers optional, via config. - New internal helper for runtime config. - Don't follow changes to next alarm, consider the condition false. - Isolate downtime calendar logic into separate class (for testing). - Allow a:bb -> a:bb as a valid downtime range (all day). - Volume dialog: configuration establishes maximum number of visible conditions, including built-ins. - Zen mode panel: avoid widget updates during layout transition. - Zen mode panel: move controller callers to background thread. - Zen mode panel: hide/show/rebind rows instead of adding/removing. - ZenLog: Add downtime autotrigger results. - Volume panel: Smarter refresh on ringer/zen changes. Bug: 16373455 Change-Id: I4f801018ddb0beb6eb9fa03a81c79f7949888a3f
Diffstat (limited to 'core/java/android/service')
-rw-r--r--core/java/android/service/notification/ZenModeConfig.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index ce28d0a..979a01b 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -64,7 +64,7 @@ public class ZenModeConfig implements Parcelable {
public static final int[] MINUTE_BUCKETS = new int[] { 15, 30, 45, 60, 120, 180, 240, 480 };
private static final int SECONDS_MS = 1000;
private static final int MINUTES_MS = 60 * SECONDS_MS;
- private static final int ZERO_VALUE_MS = 20 * SECONDS_MS;
+ private static final int ZERO_VALUE_MS = 10 * SECONDS_MS;
private static final boolean DEFAULT_ALLOW_EVENTS = true;
@@ -471,6 +471,8 @@ public class ZenModeConfig implements Parcelable {
downtime.startMinute = sleepStartMinute;
downtime.endHour = sleepEndHour;
downtime.endMinute = sleepEndMinute;
+ downtime.mode = sleepMode;
+ downtime.none = sleepNone;
return downtime;
}
@@ -510,7 +512,7 @@ public class ZenModeConfig implements Parcelable {
public static final String SYSTEM_AUTHORITY = "android";
// Built-in countdown conditions, e.g. condition://android/countdown/1399917958951
- private static final String COUNTDOWN_PATH = "countdown";
+ public static final String COUNTDOWN_PATH = "countdown";
public static Uri toCountdownConditionId(long time) {
return new Uri.Builder().scheme(Condition.SCHEME)
@@ -536,8 +538,9 @@ public class ZenModeConfig implements Parcelable {
return tryParseCountdownConditionId(conditionId) != 0;
}
- // Built-in downtime conditions, e.g. condition://android/downtime?start=10.00&end=7.00
- private static final String DOWNTIME_PATH = "downtime";
+ // Built-in downtime conditions
+ // e.g. condition://android/downtime?start=10.00&end=7.00&mode=days%3A5%2C6&none=false
+ public static final String DOWNTIME_PATH = "downtime";
public static Uri toDowntimeConditionId(DowntimeInfo downtime) {
return new Uri.Builder().scheme(Condition.SCHEME)
@@ -545,6 +548,8 @@ public class ZenModeConfig implements Parcelable {
.appendPath(DOWNTIME_PATH)
.appendQueryParameter("start", downtime.startHour + "." + downtime.startMinute)
.appendQueryParameter("end", downtime.endHour + "." + downtime.endMinute)
+ .appendQueryParameter("mode", downtime.mode)
+ .appendQueryParameter("none", Boolean.toString(downtime.none))
.build();
}
@@ -562,6 +567,8 @@ public class ZenModeConfig implements Parcelable {
downtime.startMinute = start[1];
downtime.endHour = end[0];
downtime.endMinute = end[1];
+ downtime.mode = conditionId.getQueryParameter("mode");
+ downtime.none = Boolean.toString(true).equals(conditionId.getQueryParameter("none"));
return downtime;
}
@@ -583,6 +590,8 @@ public class ZenModeConfig implements Parcelable {
public int startMinute; // 0-59
public int endHour;
public int endMinute;
+ public String mode;
+ public boolean none;
@Override
public int hashCode() {
@@ -596,7 +605,12 @@ public class ZenModeConfig implements Parcelable {
return startHour == other.startHour
&& startMinute == other.startMinute
&& endHour == other.endHour
- && endMinute == other.endMinute;
+ && endMinute == other.endMinute
+ && Objects.equals(mode, other.mode)
+ && none == other.none;
}
}
+
+ // built-in next alarm conditions
+ public static final String NEXT_ALARM_PATH = "next_alarm";
}