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

Commit 51fdfa27 authored by Yao Chen's avatar Yao Chen
Browse files

Adds getServiceComponent() to MediaBrowser, getQueueTitle() and

getExtras() to MediaController

Change-Id: I6092ac1ae05ba55c14a042698bb88bd16e9b1fa7
parent 7c7bc7f6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -16256,6 +16256,7 @@ package android.media.browse {
    method public void disconnect();
    method public android.os.Bundle getExtras();
    method public android.net.Uri getRoot();
    method public android.content.ComponentName getServiceComponent();
    method public android.media.session.MediaSession.Token getSessionToken();
    method public boolean isConnected();
    method public void loadIcon(android.net.Uri, int, int, android.media.browse.MediaBrowser.IconCallback);
@@ -16656,12 +16657,14 @@ package android.media.session {
    method public void adjustVolume(int, int);
    method public android.media.routing.MediaRouter.Delegate createMediaRouterDelegate();
    method public boolean dispatchMediaButtonEvent(android.view.KeyEvent);
    method public android.os.Bundle getExtras();
    method public long getFlags();
    method public android.app.PendingIntent getLaunchActivity();
    method public android.media.MediaMetadata getMetadata();
    method public java.lang.String getPackageName();
    method public android.media.session.PlaybackState getPlaybackState();
    method public java.util.List<android.media.session.MediaSession.Track> getQueue();
    method public java.lang.CharSequence getQueueTitle();
    method public int getRatingType();
    method public android.media.session.MediaSession.Token getSessionToken();
    method public android.media.session.MediaController.TransportControls getTransportControls();
+14 −3
Original line number Diff line number Diff line
@@ -224,6 +224,17 @@ public final class MediaBrowser {
        return mState == CONNECT_STATE_CONNECTED;
    }

    /**
     * Gets the service component that the media browser is connected to.
     */
    public @NonNull ComponentName getServiceComponent() {
        if (!isConnected()) {
            throw new IllegalStateException("getServiceComponent() called while not connected" +
                    " (state=" + mState + ")");
        }
        return mServiceComponent;
    }

    /**
     * Gets the root Uri.
     * <p>
@@ -234,7 +245,7 @@ public final class MediaBrowser {
     * @throws IllegalStateException if not connected.
     */
    public @NonNull Uri getRoot() {
        if (mState != CONNECT_STATE_CONNECTED) {
        if (!isConnected()) {
            throw new IllegalStateException("getSessionToken() called while not connected (state="
                    + getStateLabel(mState) + ")");
        }
@@ -247,7 +258,7 @@ public final class MediaBrowser {
     * @throws IllegalStateException if not connected.
     */
    public @Nullable Bundle getExtras() {
        if (mState != CONNECT_STATE_CONNECTED) {
        if (!isConnected()) {
            throw new IllegalStateException("getExtras() called while not connected (state="
                    + getStateLabel(mState) + ")");
        }
@@ -266,7 +277,7 @@ public final class MediaBrowser {
     * @throws IllegalStateException if not connected.
     */
     public @NonNull MediaSession.Token getSessionToken() {
        if (mState != CONNECT_STATE_CONNECTED) {
        if (!isConnected()) {
            throw new IllegalStateException("getSessionToken() called while not connected (state="
                    + mState + ")");
        }
+24 −0
Original line number Diff line number Diff line
@@ -195,6 +195,30 @@ public final class MediaController {
        return null;
    }

    /**
     * Get the queue title for this session.
     */
    public @Nullable CharSequence getQueueTitle() {
        try {
            return mSessionBinder.getQueueTitle();
        } catch (RemoteException e) {
            Log.wtf(TAG, "Error calling getQueueTitle", e);
        }
        return null;
    }

    /**
     * Get the extras for this session.
     */
    public @Nullable Bundle getExtras() {
        try {
            return mSessionBinder.getExtras();
        } catch (RemoteException e) {
            Log.wtf(TAG, "Error calling getExtras", e);
        }
        return null;
    }

    /**
     * Get the rating type supported by the session. One of:
     * <ul>