Zen: Fix downtime calculation for Sunday mornings.
Previous calculation would always exit downtime on Sunday mornings, due to the target day ending up at zero (an invalid day). Bug:17682999 Change-Id: Icc5f01a42c3c644170eea9e60442cf77ce15a06c
This commit is contained in:
@@ -193,7 +193,8 @@ public class DowntimeConditionProvider extends ConditionProviderService {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user