Handle alarm firing outside of DND period.
Change-Id: Ib8bb878709ab8b5db8aba7f31e239e44409e18d4
Fixes: 28459870
diff --git a/services/core/java/com/android/server/notification/ScheduleCalendar.java b/services/core/java/com/android/server/notification/ScheduleCalendar.java
index 9267d82..22ca702 100644
--- a/services/core/java/com/android/server/notification/ScheduleCalendar.java
+++ b/services/core/java/com/android/server/notification/ScheduleCalendar.java
@@ -58,11 +58,7 @@
final long nextEnd = getNextTime(now, mSchedule.endHour, mSchedule.endMinute);
long nextScheduleTime = Math.min(nextStart, nextEnd);
- if (mSchedule.exitAtAlarm && mSchedule.nextAlarm > now) {
- return Math.min(nextScheduleTime, mSchedule.nextAlarm);
- } else {
- return nextScheduleTime;
- }
+ return nextScheduleTime;
}
private long getNextTime(long now, int hr, int min) {
@@ -124,4 +120,4 @@
mCalendar.add(Calendar.DATE, days);
return mCalendar.getTimeInMillis();
}
-}
\ No newline at end of file
+}
diff --git a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
index e3dcf14..8197544 100644
--- a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
+++ b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
@@ -43,8 +43,8 @@
* Built-in zen condition provider for daily scheduled time-based conditions.
*/
public class ScheduleConditionProvider extends SystemConditionProviderService {
- private static final String TAG = "ConditionProviders.SCP";
- private static final boolean DEBUG = true || Log.isLoggable("ConditionProviders", Log.DEBUG);
+ static final String TAG = "ConditionProviders.SCP";
+ static final boolean DEBUG = true || Log.isLoggable("ConditionProviders", Log.DEBUG);
public static final ComponentName COMPONENT =
new ComponentName("android", ScheduleConditionProvider.class.getName());
@@ -154,6 +154,9 @@
cal.maybeSetNextAlarm(now, nextUserAlarmTime);
} else {
notifyCondition(conditionId, Condition.STATE_FALSE, "!meetsSchedule");
+ if (nextUserAlarmTime == 0) {
+ cal.maybeSetNextAlarm(now, nextUserAlarmTime);
+ }
}
if (cal != null) {
final long nextChangeTime = cal.getNextChangeTime(now);