Make sure the home screen widget is updated when the current playlist is cleared.
Change-Id: Ifb9bfec980ebf8d208a7020c388b239f6dc904f0
diff --git a/src/com/android/music/MediaPlaybackService.java b/src/com/android/music/MediaPlaybackService.java
index ec3ac89..eabd80d 100644
--- a/src/com/android/music/MediaPlaybackService.java
+++ b/src/com/android/music/MediaPlaybackService.java
@@ -786,6 +786,11 @@
mPlayList[position + i] = list[i];
}
mPlayListLen += addlen;
+ if (mPlayListLen == 0) {
+ mCursor.close();
+ mCursor = null;
+ notifyChange(META_CHANGED);
+ }
}
/**
@@ -1419,6 +1424,10 @@
if (mPlayListLen == 0) {
stop(true);
mPlayPos = -1;
+ if (mCursor != null) {
+ mCursor.close();
+ mCursor = null;
+ }
} else {
if (mPlayPos >= mPlayListLen) {
mPlayPos = 0;
@@ -1430,6 +1439,7 @@
play();
}
}
+ notifyChange(META_CHANGED);
}
return last - first + 1;
}