Fix scheduling tasks on shutdown executor

This commit is contained in:
Joe Stein 2019-05-21 18:20:57 -04:00
parent 4f3fa6246e
commit effa17c41d

View File

@ -165,7 +165,7 @@ public class PlaybackServiceTaskManager {
* Starts the widget updater task. If the widget updater is already active, nothing will happen. * Starts the widget updater task. If the widget updater is already active, nothing will happen.
*/ */
public synchronized void startWidgetUpdater() { public synchronized void startWidgetUpdater() {
if (!isWidgetUpdaterActive()) { if (!isWidgetUpdaterActive() && !schedExecutor.isShutdown()) {
Runnable widgetUpdater = callback::onWidgetUpdaterTick; Runnable widgetUpdater = callback::onWidgetUpdaterTick;
widgetUpdater = useMainThreadIfNecessary(widgetUpdater); widgetUpdater = useMainThreadIfNecessary(widgetUpdater);
widgetUpdaterFuture = schedExecutor.scheduleWithFixedDelay(widgetUpdater, WIDGET_UPDATER_NOTIFICATION_INTERVAL, widgetUpdaterFuture = schedExecutor.scheduleWithFixedDelay(widgetUpdater, WIDGET_UPDATER_NOTIFICATION_INTERVAL,