Merge "Do not call ItemCallback after disconnected" into oc-mr1-dev
This commit is contained in:
@@ -445,6 +445,9 @@ public final class MediaBrowser {
|
||||
ResultReceiver receiver = new ResultReceiver(mHandler) {
|
||||
@Override
|
||||
protected void onReceiveResult(int resultCode, Bundle resultData) {
|
||||
if (!isConnected()) {
|
||||
return;
|
||||
}
|
||||
if (resultCode != 0 || resultData == null
|
||||
|| !resultData.containsKey(MediaBrowserService.KEY_MEDIA_ITEM)) {
|
||||
cb.onError(mediaId);
|
||||
|
||||
@@ -700,6 +700,13 @@ public abstract class MediaBrowserService extends Service {
|
||||
new Result<MediaBrowser.MediaItem>(itemId) {
|
||||
@Override
|
||||
void onResultSent(MediaBrowser.MediaItem item, @ResultFlags int flag) {
|
||||
if (mConnections.get(connection.callbacks.asBinder()) != connection) {
|
||||
if (DBG) {
|
||||
Log.d(TAG, "Not sending onLoadItem result for connection that has"
|
||||
+ " been disconnected. pkg=" + connection.pkg + " id=" + itemId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((flag & RESULT_FLAG_ON_LOAD_ITEM_NOT_IMPLEMENTED) != 0) {
|
||||
receiver.send(RESULT_ERROR, null);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user