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

Commit 280dd704 authored by Hyundo Moon's avatar Hyundo Moon Committed by Android (Google) Code Review
Browse files

Merge "Add MediaController#getSessionInfo()"

parents 08d1b027 5fc8db02
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27458,6 +27458,7 @@ package android.media.session {
    method @Nullable public CharSequence getQueueTitle();
    method public int getRatingType();
    method @Nullable public android.app.PendingIntent getSessionActivity();
    method @Nullable public android.os.Bundle getSessionInfo();
    method @NonNull public android.media.session.MediaSession.Token getSessionToken();
    method @NonNull public android.media.session.MediaController.TransportControls getTransportControls();
    method public void registerCallback(@NonNull android.media.session.MediaController.Callback);
@@ -27517,6 +27518,7 @@ package android.media.session {
  public final class MediaSession {
    ctor public MediaSession(@NonNull android.content.Context, @NonNull String);
    ctor public MediaSession(@NonNull android.content.Context, @NonNull String, @Nullable android.os.Bundle);
    method @NonNull public android.media.session.MediaController getController();
    method @NonNull public android.media.session.MediaSessionManager.RemoteUserInfo getCurrentControllerInfo();
    method @NonNull public android.media.session.MediaSession.Token getSessionToken();
+23 −0
Original line number Diff line number Diff line
@@ -157,6 +157,18 @@ public final class ControllerLink implements Parcelable {
        }
    }

    /**
     * Gets the session info of the connected session.
     */
    @Nullable
    Bundle getSessionInfo() {
        try {
            return mISessionController.getSessionInfo();
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Gets the {@link PendingIntent} for launching UI of the connected session.
     */
@@ -666,6 +678,12 @@ public final class ControllerLink implements Parcelable {
            return null;
        }

        /** Stub method for ISessionController.getSessionInfo */
        @Nullable
        public Bundle getSessionInfo() {
            return null;
        }

        /** Stub method for ISessionController.getLaunchPendingIntent */
        @Nullable
        public PendingIntent getLaunchPendingIntent() {
@@ -855,6 +873,11 @@ public final class ControllerLink implements Parcelable {
            return mControllerStub.getTag();
        }

        @Override
        public Bundle getSessionInfo() {
            return mControllerStub.getSessionInfo();
        }

        @Override
        public PendingIntent getLaunchPendingIntent() {
            return mControllerStub.getLaunchPendingIntent();
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ interface ISessionController {
    void unregisterCallback(in ControllerCallbackLink cb);
    String getPackageName();
    String getTag();
    Bundle getSessionInfo();
    PendingIntent getLaunchPendingIntent();
    long getFlags();
    MediaController.PlaybackInfo getVolumeAttributes();
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import android.view.KeyEvent;
 */
interface ISessionManager {
    SessionLink createSession(String packageName, in SessionCallbackLink sessionCb, String tag,
            int userId);
            in Bundle sessionInfo, int userId);
    void notifySession2Created(in Session2Token sessionToken);
    List<MediaSession.Token> getSessions(in ComponentName compName, int userId);
    List<Session2Token> getSession2Tokens(int userId);
+18 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ public final class MediaController {
    private boolean mCbRegistered = false;
    private String mPackageName;
    private String mTag;
    private Bundle mSessionInfo;

    private final TransportControls mTransportControls;

@@ -409,6 +410,23 @@ public final class MediaController {
        return mPackageName;
    }

    /**
     * Gets the additional session information which was set when the session was created.
     *
     * @return The additional session information
     */
    @Nullable
    public Bundle getSessionInfo() {
        if (mSessionInfo == null) {
            try {
                mSessionInfo = mSessionBinder.getSessionInfo();
            } catch (RuntimeException e) {
                Log.d(TAG, "Dead object in getSessionInfo.", e);
            }
        }
        return mSessionInfo;
    }

    /**
     * Get the session's tag for debugging purposes.
     *
Loading