From 7930c169da5d4141c9079e049a0571bc8f041ddf Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Mon, 18 Mar 2013 12:43:31 -0700 Subject: [PATCH] Fixed bugs with NotificationTests --- .../com/todoroo/astrid/reminders/Notifications.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java index e77dd7071..4c7298824 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java @@ -8,6 +8,7 @@ package com.todoroo.astrid.reminders; import java.util.Date; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import android.app.Notification; import android.app.PendingIntent; @@ -260,7 +261,7 @@ public class Notifications extends BroadcastReceiver { */ private static boolean checkLastNotificationSound() { long now = DateUtilities.now(); - if (now - lastNotificationSound > 10000) { + if (now - lastNotificationSound > 10000 || forceNotificationManager) { lastNotificationSound = now; return true; } @@ -395,6 +396,12 @@ public class Notifications extends BroadcastReceiver { singleThreadVoicePool.submit(new NotificationRunnable(ringTimes, notificationId, notification, voiceReminder, maxOutVolumeForMultipleRingReminders, audioManager, previousAlarmVolume, text)); + if (forceNotificationManager) + try { + singleThreadVoicePool.awaitTermination(1000, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + // + } } private static class NotificationRunnable implements Runnable {