am eeac1f1d: am cbb732a8: am 39838b98: Merge "Zen: Fix downtime calculation for Sunday mornings." into lmp-dev

* commit 'eeac1f1df96c049125de1bb231106acac0b9019d':
  Zen: Fix downtime calculation for Sunday mornings.
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;