Merge "Zen: Fix downtime calculation for Sunday mornings." into lmp-dev
diff --git a/services/core/java/com/android/server/notification/DowntimeConditionProvider.java b/services/core/java/com/android/server/notification/DowntimeConditionProvider.java
index b71bad8..efe47c3 100644
--- a/services/core/java/com/android/server/notification/DowntimeConditionProvider.java
+++ b/services/core/java/com/android/server/notification/DowntimeConditionProvider.java
@@ -193,7 +193,8 @@
}
private boolean isInDowntime(int daysOffset, long time, long start, long end) {
- final int day = ((getDayOfWeek(time) + daysOffset - 1) % Calendar.SATURDAY) + 1;
+ final int n = Calendar.SATURDAY;
+ final int day = ((getDayOfWeek(time) - 1) + (daysOffset % n) + n) % n + 1;
start = addDays(start, daysOffset);
end = addDays(end, daysOffset);
return mDays.contains(day) && time >= start && time < end;