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

Commit ca0ee961 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaController2: Add getConnectedSessionToken()"

parents b0d60c4c 5886d3d5
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -24533,6 +24533,7 @@ package android.media {
    ctor public MediaController2(@NonNull android.content.Context, @NonNull android.media.Session2Token, @NonNull java.util.concurrent.Executor, @NonNull android.media.MediaController2.ControllerCallback);
    ctor public MediaController2(@NonNull android.content.Context, @NonNull android.media.Session2Token, @NonNull java.util.concurrent.Executor, @NonNull android.media.MediaController2.ControllerCallback);
    method public void cancelSessionCommand(@NonNull Object);
    method public void cancelSessionCommand(@NonNull Object);
    method public void close();
    method public void close();
    method public android.media.Session2Token getConnectedSessionToken();
    method public boolean isPlaybackActive();
    method public boolean isPlaybackActive();
    method @NonNull public Object sendSessionCommand(@NonNull android.media.Session2Command, @Nullable android.os.Bundle);
    method @NonNull public Object sendSessionCommand(@NonNull android.media.Session2Command, @Nullable android.os.Bundle);
  }
  }
+17 −0
Original line number Original line Diff line number Diff line
@@ -152,6 +152,7 @@ public class MediaController2 implements AutoCloseable {
                    // No-op
                    // No-op
                }
                }
            }
            }
            mConnectedToken = null;
            mPendingCommands.clear();
            mPendingCommands.clear();
            mRequestedCommandSeqNumbers.clear();
            mRequestedCommandSeqNumbers.clear();
            mCallbackExecutor.execute(() -> {
            mCallbackExecutor.execute(() -> {
@@ -161,6 +162,22 @@ public class MediaController2 implements AutoCloseable {
        }
        }
    }
    }


    /**
     * Returns {@link Session2Token} of the connected session.
     * If it is not connected yet, it returns {@code null}.
     * <p>
     * This may differ with the {@link Session2Token} from the constructor. For example, if the
     * controller is created with the token for MediaSession2Service, this would return
     * token for the {@link MediaSession2} in the service.
     *
     * @return Session2Token of the connected session, or {@code null} if not connected
     */
    public Session2Token getConnectedSessionToken() {
        synchronized (mLock) {
            return mConnectedToken;
        }
    }

    /**
    /**
     * Returns whether the session's playback is active.
     * Returns whether the session's playback is active.
     *
     *