/**
  * Adds a callback to receive updates from the session. Updates will be posted on the specified
  * handler's thread.
  *
  * @param callback The callback object, must not be null.
  * @param handler The handler to post updates on. If null the callers thread will be used.
  */
 public void registerCallback(Callback callback, Handler handler) {
   if (callback == null) {
     throw new IllegalArgumentException("callback cannot be null");
   }
   if (handler == null) {
     handler = new Handler();
   }
   mImpl.registerCallback(callback, handler);
 }
 /**
  * Send the specified media button event to the session. Only media keys can be sent by this
  * method, other keys will be ignored.
  *
  * @param keyEvent The media button event to dispatch.
  * @return true if the event was sent to the session, false otherwise.
  */
 public boolean dispatchMediaButtonEvent(KeyEvent keyEvent) {
   if (keyEvent == null) {
     throw new IllegalArgumentException("KeyEvent may not be null");
   }
   return mImpl.dispatchMediaButtonEvent(keyEvent);
 }
 /**
  * Get a {@link TransportControls} instance for this session.
  *
  * @return A controls instance
  */
 public TransportControls getTransportControls() {
   return mImpl.getTransportControls();
 }
 /**
  * Gets the underlying framework {@link android.media.session.MediaController} object.
  *
  * <p>This method is only supported on API 21+.
  *
  * @return The underlying {@link android.media.session.MediaController} object, or null if none.
  */
 public Object getMediaController() {
   return mImpl.getMediaController();
 }
 /**
  * Sends a generic command to the session. It is up to the session creator to decide what commands
  * and parameters they will support. As such, commands should only be sent to sessions that the
  * controller owns.
  *
  * @param command The command to send
  * @param params Any parameters to include with the command
  * @param cb The callback to receive the result on
  */
 public void sendCommand(String command, Bundle params, ResultReceiver cb) {
   if (TextUtils.isEmpty(command)) {
     throw new IllegalArgumentException("command cannot be null or empty");
   }
   mImpl.sendCommand(command, params, cb);
 }
 /**
  * Stop receiving updates on the specified callback. If an update has already been posted you may
  * still receive it after calling this method.
  *
  * @param callback The callback to remove
  */
 public void unregisterCallback(Callback callback) {
   if (callback == null) {
     throw new IllegalArgumentException("callback cannot be null");
   }
   mImpl.unregisterCallback(callback);
 }
 /**
  * Get the current playback info for this session.
  *
  * @return The current playback info or null.
  */
 public PlaybackInfo getPlaybackInfo() {
   return mImpl.getPlaybackInfo();
 }
 /**
  * Get the rating type supported by the session. One of:
  *
  * <ul>
  *   <li>{@link RatingCompat#RATING_NONE}
  *   <li>{@link RatingCompat#RATING_HEART}
  *   <li>{@link RatingCompat#RATING_THUMB_UP_DOWN}
  *   <li>{@link RatingCompat#RATING_3_STARS}
  *   <li>{@link RatingCompat#RATING_4_STARS}
  *   <li>{@link RatingCompat#RATING_5_STARS}
  *   <li>{@link RatingCompat#RATING_PERCENTAGE}
  * </ul>
  *
  * @return The supported rating type
  */
 public int getRatingType() {
   return mImpl.getRatingType();
 }
 /**
  * Get the current metadata for this session.
  *
  * @return The current MediaMetadata or null.
  */
 public MediaMetadataCompat getMetadata() {
   return mImpl.getMetadata();
 }
 /**
  * Get the current playback state for this session.
  *
  * @return The current PlaybackState or null
  */
 public PlaybackStateCompat getPlaybackState() {
   return mImpl.getPlaybackState();
 }