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

Commit effe42e2 authored by RoboErik's avatar RoboErik Committed by Android (Google) Code Review
Browse files

Merge "Reload MediaBrowser children on each call to subscribe"

parents 1a1779de 7554d099
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -293,9 +293,11 @@ public final class MediaBrowser {
     * The list of subscriptions is maintained even when not connected and is
     * restored after reconnection. It is ok to subscribe while not connected
     * but the results will not be returned until the connection completes.
     * </p><p>
     * </p>
     * <p>
     * If the id is already subscribed with a different callback then the new
     * callback will replace the previous one.
     * callback will replace the previous one and the child data will be
     * reloaded.
     * </p>
     *
     * @param parentId The id of the parent media item whose list of children
@@ -322,7 +324,7 @@ public final class MediaBrowser {

        // If we are connected, tell the service that we are watching.  If we aren't
        // connected, the service will be told when we connect.
        if (mState == CONNECT_STATE_CONNECTED && newSubscription) {
        if (mState == CONNECT_STATE_CONNECTED) {
            try {
                mServiceBinder.addSubscription(parentId, mServiceCallbacks);
            } catch (RemoteException ex) {
+3 −5
Original line number Diff line number Diff line
@@ -405,13 +405,11 @@ public abstract class MediaBrowserService extends Service {
     */
    private void addSubscription(String id, ConnectionRecord connection) {
        // Save the subscription
        final boolean added = connection.subscriptions.add(id);
        connection.subscriptions.add(id);

        // If this is a new subscription, send the results
        if (added) {
        // send the results
        performLoadChildren(id, connection);
    }
    }

    /**
     * Call onLoadChildren and then send the results back to the connection.