Do not set PlaybackService to null while still updating widget

This commit is contained in:
ByteHamster 2019-07-23 21:05:37 +02:00
parent 76f9040184
commit 8b9c31ccf0
2 changed files with 10 additions and 2 deletions

View File

@ -169,6 +169,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
pager.setCurrentItem(lastPosition);
}
@Override
protected void onStart() {
super.onStart();
EventDistributor.getInstance().register(contentUpdate);

View File

@ -41,6 +41,7 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
private PlaybackService playbackService;
private final Object waitForService = new Object();
private final Object waitUsingService = new Object();
private static final int JOB_ID = -17001;
@ -67,7 +68,11 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
}
}
synchronized (waitUsingService) {
if (playbackService != null) {
updateViews();
}
}
if (playbackService != null) {
try {
@ -230,7 +235,9 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
@Override
public void onServiceDisconnected(ComponentName name) {
synchronized (waitUsingService) {
playbackService = null;
}
Log.d(TAG, "Disconnected from service");
}