Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8724fb93 authored by Sungsoo Lim's avatar Sungsoo Lim Committed by Android (Google) Code Review
Browse files

Merge "Do not call ItemCallback after disconnected" into oc-mr1-dev

parents 437e43ed be87b680
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
+7 −0
Original line number Diff line number Diff line
@@ -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;