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

Commit 52d04f1f authored by Sungsoo Lim's avatar Sungsoo Lim Committed by android-build-merger
Browse files

Minor changes on MediaBrowser am: 77dc4bb0

am: 01da43b1

* commit '01da43b1':
  Minor changes on MediaBrowser
parents 7fd98bb1 01da43b1
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -475,7 +475,7 @@ public final class MediaBrowser {
            sub = new Subscription();
            mSubscriptions.put(parentId, sub);
        }
        sub.add(callback, options);
        sub.putCallback(options, callback);

        // If we are connected, tell the service that we are watching. If we aren't connected,
        // the service will be told when we connect.
@@ -507,7 +507,7 @@ public final class MediaBrowser {
        Subscription sub = mSubscriptions.get(parentId);

        // Tell the service if necessary.
        if (sub != null && sub.remove(options) && mState == CONNECT_STATE_CONNECTED) {
        if (sub != null && sub.removeCallback(options) && mState == CONNECT_STATE_CONNECTED) {
            try {
                // NOTE: Do not call removeSubscriptionWithOptions when options are null. Otherwise,
                // it will break the action of support library which expects removeSubscription will
@@ -1098,7 +1098,16 @@ public final class MediaBrowser {
            return mCallbacks;
        }

        public void add(SubscriptionCallback callback, Bundle options) {
        public SubscriptionCallback getCallback(Bundle options) {
            for (int i = 0; i < mOptionsList.size(); ++i) {
                if (MediaBrowserUtils.areSameOptions(mOptionsList.get(i), options)) {
                    return mCallbacks.get(i);
                }
            }
            return null;
        }

        public void putCallback(Bundle options, SubscriptionCallback callback) {
            for (int i = 0; i < mOptionsList.size(); ++i) {
                if (MediaBrowserUtils.areSameOptions(mOptionsList.get(i), options)) {
                    mCallbacks.set(i, callback);
@@ -1109,7 +1118,7 @@ public final class MediaBrowser {
            mOptionsList.add(options);
        }

        public boolean remove(Bundle options) {
        public boolean removeCallback(Bundle options) {
            for (int i = 0; i < mOptionsList.size(); ++i) {
                if (MediaBrowserUtils.areSameOptions(mOptionsList.get(i), options)) {
                    mCallbacks.remove(i);
@@ -1119,14 +1128,5 @@ public final class MediaBrowser {
            }
            return false;
        }

        public SubscriptionCallback getCallback(Bundle options) {
            for (int i = 0; i < mOptionsList.size(); ++i) {
                if (MediaBrowserUtils.areSameOptions(mOptionsList.get(i), options)) {
                    return mCallbacks.get(i);
                }
            }
            return null;
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ public abstract class MediaBrowserService extends Service {
     * be thrown.
     *
     * @see MediaBrowserService#onLoadChildren
     * @see MediaBrowserService#onGetMediaItem
     * @see MediaBrowserService#onLoadItem
     */
    public class Result<T> {
        private Object mDebug;