Merge \"Handle alarm firing outside of DND period.\" into nyc-dev
am: e1451c4e30
Change-Id: I2fe8f9dbc048a830e6c06b4797151aaf306ca481
This commit is contained in:
@@ -58,11 +58,7 @@ public class ScheduleCalendar {
|
|||||||
final long nextEnd = getNextTime(now, mSchedule.endHour, mSchedule.endMinute);
|
final long nextEnd = getNextTime(now, mSchedule.endHour, mSchedule.endMinute);
|
||||||
long nextScheduleTime = Math.min(nextStart, nextEnd);
|
long nextScheduleTime = Math.min(nextStart, nextEnd);
|
||||||
|
|
||||||
if (mSchedule.exitAtAlarm && mSchedule.nextAlarm > now) {
|
return nextScheduleTime;
|
||||||
return Math.min(nextScheduleTime, mSchedule.nextAlarm);
|
|
||||||
} else {
|
|
||||||
return nextScheduleTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getNextTime(long now, int hr, int min) {
|
private long getNextTime(long now, int hr, int min) {
|
||||||
@@ -124,4 +120,4 @@ public class ScheduleCalendar {
|
|||||||
mCalendar.add(Calendar.DATE, days);
|
mCalendar.add(Calendar.DATE, days);
|
||||||
return mCalendar.getTimeInMillis();
|
return mCalendar.getTimeInMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ import java.util.TimeZone;
|
|||||||
* Built-in zen condition provider for daily scheduled time-based conditions.
|
* Built-in zen condition provider for daily scheduled time-based conditions.
|
||||||
*/
|
*/
|
||||||
public class ScheduleConditionProvider extends SystemConditionProviderService {
|
public class ScheduleConditionProvider extends SystemConditionProviderService {
|
||||||
private static final String TAG = "ConditionProviders.SCP";
|
static final String TAG = "ConditionProviders.SCP";
|
||||||
private static final boolean DEBUG = true || Log.isLoggable("ConditionProviders", Log.DEBUG);
|
static final boolean DEBUG = true || Log.isLoggable("ConditionProviders", Log.DEBUG);
|
||||||
|
|
||||||
public static final ComponentName COMPONENT =
|
public static final ComponentName COMPONENT =
|
||||||
new ComponentName("android", ScheduleConditionProvider.class.getName());
|
new ComponentName("android", ScheduleConditionProvider.class.getName());
|
||||||
@@ -154,6 +154,9 @@ public class ScheduleConditionProvider extends SystemConditionProviderService {
|
|||||||
cal.maybeSetNextAlarm(now, nextUserAlarmTime);
|
cal.maybeSetNextAlarm(now, nextUserAlarmTime);
|
||||||
} else {
|
} else {
|
||||||
notifyCondition(conditionId, Condition.STATE_FALSE, "!meetsSchedule");
|
notifyCondition(conditionId, Condition.STATE_FALSE, "!meetsSchedule");
|
||||||
|
if (nextUserAlarmTime == 0) {
|
||||||
|
cal.maybeSetNextAlarm(now, nextUserAlarmTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cal != null) {
|
if (cal != null) {
|
||||||
final long nextChangeTime = cal.getNextChangeTime(now);
|
final long nextChangeTime = cal.getNextChangeTime(now);
|
||||||
|
|||||||
Reference in New Issue
Block a user