diff options
| -rw-r--r-- | api/current.txt | 76 | ||||
| -rw-r--r-- | media/java/android/media/MediaBrowser2.java | 53 | ||||
| -rw-r--r-- | media/java/android/media/MediaController2.java | 84 | ||||
| -rw-r--r-- | media/java/android/media/MediaLibraryService2.java | 48 | ||||
| -rw-r--r-- | media/java/android/media/MediaSession2.java | 96 | ||||
| -rw-r--r-- | media/java/android/media/MediaSessionService2.java | 5 | ||||
| -rw-r--r-- | services/core/java/com/android/server/media/MediaSessionService.java | 2 |
7 files changed, 218 insertions, 146 deletions
diff --git a/api/current.txt b/api/current.txt index fcfdab574906..50d601d52105 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22865,12 +22865,12 @@ package android.media { public static class MediaBrowser2.BrowserCallback extends android.media.MediaController2.ControllerCallback { ctor public MediaBrowser2.BrowserCallback(); - method public void onChildrenChanged(java.lang.String, int, android.os.Bundle); - method public void onGetChildrenDone(java.lang.String, int, int, java.util.List<android.media.MediaItem2>, android.os.Bundle); - method public void onGetItemDone(java.lang.String, android.media.MediaItem2); - method public void onGetLibraryRootDone(android.os.Bundle, java.lang.String, android.os.Bundle); - method public void onGetSearchResultDone(java.lang.String, int, int, java.util.List<android.media.MediaItem2>, android.os.Bundle); - method public void onSearchResultChanged(java.lang.String, int, android.os.Bundle); + method public void onChildrenChanged(android.media.MediaBrowser2, java.lang.String, int, android.os.Bundle); + method public void onGetChildrenDone(android.media.MediaBrowser2, java.lang.String, int, int, java.util.List<android.media.MediaItem2>, android.os.Bundle); + method public void onGetItemDone(android.media.MediaBrowser2, java.lang.String, android.media.MediaItem2); + method public void onGetLibraryRootDone(android.media.MediaBrowser2, android.os.Bundle, java.lang.String, android.os.Bundle); + method public void onGetSearchResultDone(android.media.MediaBrowser2, java.lang.String, int, int, java.util.List<android.media.MediaItem2>, android.os.Bundle); + method public void onSearchResultChanged(android.media.MediaBrowser2, java.lang.String, int, android.os.Bundle); } public final class MediaCas implements java.lang.AutoCloseable { @@ -23392,20 +23392,20 @@ package android.media { public static abstract class MediaController2.ControllerCallback { ctor public MediaController2.ControllerCallback(); - method public void onAllowedCommandsChanged(android.media.MediaSession2.CommandGroup); - method public void onBufferedPositionChanged(long); - method public void onConnected(android.media.MediaSession2.CommandGroup); - method public void onCurrentPlaylistItemChanged(android.media.MediaItem2); - method public void onCustomCommand(android.media.MediaSession2.Command, android.os.Bundle, android.os.ResultReceiver); - method public void onCustomLayoutChanged(java.util.List<android.media.MediaSession2.CommandButton>); - method public void onDisconnected(); - method public void onError(int, android.os.Bundle); - method public void onPlaybackInfoChanged(android.media.MediaController2.PlaybackInfo); - method public void onPlaybackSpeedChanged(float); - method public void onPlayerStateChanged(int); - method public void onPlaylistChanged(java.util.List<android.media.MediaItem2>); - method public void onPlaylistParamsChanged(android.media.MediaSession2.PlaylistParams); - method public void onPositionChanged(long, long); + method public void onAllowedCommandsChanged(android.media.MediaController2, android.media.MediaSession2.CommandGroup); + method public void onBufferedPositionChanged(android.media.MediaController2, long); + method public void onConnected(android.media.MediaController2, android.media.MediaSession2.CommandGroup); + method public void onCurrentPlaylistItemChanged(android.media.MediaController2, android.media.MediaItem2); + method public void onCustomCommand(android.media.MediaController2, android.media.MediaSession2.Command, android.os.Bundle, android.os.ResultReceiver); + method public void onCustomLayoutChanged(android.media.MediaController2, java.util.List<android.media.MediaSession2.CommandButton>); + method public void onDisconnected(android.media.MediaController2); + method public void onError(android.media.MediaController2, int, android.os.Bundle); + method public void onPlaybackInfoChanged(android.media.MediaController2, android.media.MediaController2.PlaybackInfo); + method public void onPlaybackSpeedChanged(android.media.MediaController2, float); + method public void onPlayerStateChanged(android.media.MediaController2, int); + method public void onPlaylistChanged(android.media.MediaController2, java.util.List<android.media.MediaItem2>); + method public void onPlaylistParamsChanged(android.media.MediaController2, android.media.MediaSession2.PlaylistParams); + method public void onPositionChanged(android.media.MediaController2, long, long); } public static final class MediaController2.PlaybackInfo { @@ -23874,13 +23874,13 @@ package android.media { public static class MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback extends android.media.MediaSession2.SessionCallback { ctor public MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback(android.content.Context); - method public java.util.List<android.media.MediaItem2> onGetChildren(android.media.MediaSession2.ControllerInfo, java.lang.String, int, int, android.os.Bundle); - method public android.media.MediaItem2 onGetItem(android.media.MediaSession2.ControllerInfo, java.lang.String); - method public android.media.MediaLibraryService2.LibraryRoot onGetLibraryRoot(android.media.MediaSession2.ControllerInfo, android.os.Bundle); - method public java.util.List<android.media.MediaItem2> onGetSearchResult(android.media.MediaSession2.ControllerInfo, java.lang.String, int, int, android.os.Bundle); - method public void onSearch(android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); - method public void onSubscribe(android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); - method public void onUnsubscribe(android.media.MediaSession2.ControllerInfo, java.lang.String); + method public java.util.List<android.media.MediaItem2> onGetChildren(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, java.lang.String, int, int, android.os.Bundle); + method public android.media.MediaItem2 onGetItem(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, java.lang.String); + method public android.media.MediaLibraryService2.LibraryRoot onGetLibraryRoot(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, android.os.Bundle); + method public java.util.List<android.media.MediaItem2> onGetSearchResult(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, java.lang.String, int, int, android.os.Bundle); + method public void onSearch(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); + method public void onSubscribe(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); + method public void onUnsubscribe(android.media.MediaLibraryService2.MediaLibrarySession, android.media.MediaSession2.ControllerInfo, java.lang.String); } public final class MediaMetadata implements android.os.Parcelable { @@ -24968,17 +24968,17 @@ package android.media { public static abstract class MediaSession2.SessionCallback { ctor public MediaSession2.SessionCallback(android.content.Context); - method public boolean onCommandRequest(android.media.MediaSession2.ControllerInfo, android.media.MediaSession2.Command); - method public android.media.MediaSession2.CommandGroup onConnect(android.media.MediaSession2.ControllerInfo); - method public void onCustomCommand(android.media.MediaSession2.ControllerInfo, android.media.MediaSession2.Command, android.os.Bundle, android.os.ResultReceiver); - method public void onDisconnected(android.media.MediaSession2.ControllerInfo); - method public void onPlayFromMediaId(android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); - method public void onPlayFromSearch(android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); - method public void onPlayFromUri(android.media.MediaSession2.ControllerInfo, android.net.Uri, android.os.Bundle); - method public void onPrepareFromMediaId(android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); - method public void onPrepareFromSearch(android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); - method public void onPrepareFromUri(android.media.MediaSession2.ControllerInfo, android.net.Uri, android.os.Bundle); - method public void onSetRating(android.media.MediaSession2.ControllerInfo, java.lang.String, android.media.Rating2); + method public boolean onCommandRequest(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, android.media.MediaSession2.Command); + method public android.media.MediaSession2.CommandGroup onConnect(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo); + method public void onCustomCommand(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, android.media.MediaSession2.Command, android.os.Bundle, android.os.ResultReceiver); + method public void onDisconnected(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo); + method public void onPlayFromMediaId(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); + method public void onPlayFromSearch(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); + method public void onPlayFromUri(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, android.net.Uri, android.os.Bundle); + method public void onPrepareFromMediaId(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); + method public void onPrepareFromSearch(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, java.lang.String, android.os.Bundle); + method public void onPrepareFromUri(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, android.net.Uri, android.os.Bundle); + method public void onSetRating(android.media.MediaSession2, android.media.MediaSession2.ControllerInfo, java.lang.String, android.media.Rating2); } public abstract class MediaSessionService2 extends android.app.Service { diff --git a/media/java/android/media/MediaBrowser2.java b/media/java/android/media/MediaBrowser2.java index dea38a80d6b3..35edc4afe24e 100644 --- a/media/java/android/media/MediaBrowser2.java +++ b/media/java/android/media/MediaBrowser2.java @@ -46,12 +46,13 @@ public class MediaBrowser2 extends MediaController2 { * {@code rootMediaId} and {@code rootExtra} can be {@code null} if the library root isn't * available. * + * @param browser the browser for this event * @param rootHints rootHints that you previously requested. * @param rootMediaId media id of the library root. Can be {@code null} * @param rootExtra extra of the library root. Can be {@code null} */ - public void onGetLibraryRootDone(Bundle rootHints, @Nullable String rootMediaId, - @Nullable Bundle rootExtra) { } + public void onGetLibraryRootDone(@NonNull MediaBrowser2 browser, @Nullable Bundle rootHints, + @Nullable String rootMediaId, @Nullable Bundle rootExtra) { } /** * Called when there's change in the parent's children. @@ -60,18 +61,20 @@ public class MediaBrowser2 extends MediaController2 { * {@link MediaLibrarySession#notifyChildrenChanged(ControllerInfo, String, int, Bundle)} or * {@link MediaLibrarySession#notifyChildrenChanged(String, int, Bundle)} for the parent. * + * @param browser the browser for this event * @param parentId parent id that you've specified with {@link #subscribe(String, Bundle)} * @param itemCount number of children * @param extras extra bundle from the library service. Can be differ from extras that * you've specified with {@link #subscribe(String, Bundle)}. */ - public void onChildrenChanged(@NonNull String parentId, int itemCount, - @Nullable Bundle extras) { } + public void onChildrenChanged(@NonNull MediaBrowser2 browser, @NonNull String parentId, + int itemCount, @Nullable Bundle extras) { } /** * Called when the list of items has been returned by the library service for the previous * {@link MediaBrowser2#getChildren(String, int, int, Bundle)}. * + * @param browser the browser for this event * @param parentId parent id * @param page page number that you've specified with * {@link #getChildren(String, int, int, Bundle)} @@ -80,8 +83,9 @@ public class MediaBrowser2 extends MediaController2 { * @param result result. Can be {@code null} * @param extras extra bundle from the library service */ - public void onGetChildrenDone(@NonNull String parentId, int page, int pageSize, - @Nullable List<MediaItem2> result, @Nullable Bundle extras) { } + public void onGetChildrenDone(@NonNull MediaBrowser2 browser, @NonNull String parentId, + int page, int pageSize, @Nullable List<MediaItem2> result, + @Nullable Bundle extras) { } /** * Called when the item has been returned by the library service for the previous @@ -89,21 +93,24 @@ public class MediaBrowser2 extends MediaController2 { * <p> * Result can be null if there had been error. * + * @param browser the browser for this event * @param mediaId media id * @param result result. Can be {@code null} */ - public void onGetItemDone(@NonNull String mediaId, @Nullable MediaItem2 result) { } + public void onGetItemDone(@NonNull MediaBrowser2 browser, @NonNull String mediaId, + @Nullable MediaItem2 result) { } /** * Called when there's change in the search result requested by the previous * {@link MediaBrowser2#search(String, Bundle)}. * + * @param browser the browser for this event * @param query search query that you've specified with {@link #search(String, Bundle)} * @param itemCount The item count for the search result * @param extras extra bundle from the library service */ - public void onSearchResultChanged(@NonNull String query, int itemCount, - @Nullable Bundle extras) { } + public void onSearchResultChanged(@NonNull MediaBrowser2 browser, @NonNull String query, + int itemCount, @Nullable Bundle extras) { } /** * Called when the search result has been returned by the library service for the previous @@ -111,6 +118,7 @@ public class MediaBrowser2 extends MediaController2 { * <p> * Result can be null if there had been error. * + * @param browser the browser for this event * @param query search query that you've specified with * {@link #getSearchResult(String, int, int, Bundle)} * @param page page number that you've specified with @@ -120,8 +128,9 @@ public class MediaBrowser2 extends MediaController2 { * @param result result. Can be {@code null}. * @param extras extra bundle from the library service */ - public void onGetSearchResultDone(@NonNull String query, int page, int pageSize, - @Nullable List<MediaItem2> result, @Nullable Bundle extras) { } + public void onGetSearchResultDone(@NonNull MediaBrowser2 browser, @NonNull String query, + int page, int pageSize, @Nullable List<MediaItem2> result, + @Nullable Bundle extras) { } } public MediaBrowser2(@NonNull Context context, @NonNull SessionToken2 token, @@ -139,10 +148,10 @@ public class MediaBrowser2 extends MediaController2 { /** * Get the library root. Result would be sent back asynchronously with the - * {@link BrowserCallback#onGetLibraryRootDone(Bundle, String, Bundle)}. + * {@link BrowserCallback#onGetLibraryRootDone(MediaBrowser2, Bundle, String, Bundle)}. * * @param rootHints hint for the root - * @see BrowserCallback#onGetLibraryRootDone(Bundle, String, Bundle) + * @see BrowserCallback#onGetLibraryRootDone(MediaBrowser2, Bundle, String, Bundle) */ public void getLibraryRoot(Bundle rootHints) { mProvider.getLibraryRoot_impl(rootHints); @@ -150,9 +159,9 @@ public class MediaBrowser2 extends MediaController2 { /** * Subscribe to a parent id for the change in its children. When there's a change, - * {@link BrowserCallback#onChildrenChanged(String, int, Bundle)} will be called with the bundle - * that you've specified. You should call {@link #getChildren(String, int, int, Bundle)} to get - * the actual contents for the parent. + * {@link BrowserCallback#onChildrenChanged(MediaBrowser2, String, int, Bundle)} will be called + * with the bundle that you've specified. You should call + * {@link #getChildren(String, int, int, Bundle)} to get the actual contents for the parent. * * @param parentId parent id * @param extras extra bundle @@ -176,7 +185,7 @@ public class MediaBrowser2 extends MediaController2 { /** * Get list of children under the parent. Result would be sent back asynchronously with the - * {@link BrowserCallback#onGetChildrenDone(String, int, int, List, Bundle)}. + * {@link BrowserCallback#onGetChildrenDone(MediaBrowser2, String, int, int, List, Bundle)}. * * @param parentId parent id for getting the children. * @param page page number to get the result. Starts from {@code 1} @@ -189,7 +198,7 @@ public class MediaBrowser2 extends MediaController2 { /** * Get the media item with the given media id. Result would be sent back asynchronously with the - * {@link BrowserCallback#onGetItemDone(String, MediaItem2)}. + * {@link BrowserCallback#onGetItemDone(MediaBrowser2, String, MediaItem2)}. * * @param mediaId media id for specifying the item */ @@ -199,8 +208,9 @@ public class MediaBrowser2 extends MediaController2 { /** * Send a search request to the library service. When the search result is changed, - * {@link BrowserCallback#onSearchResultChanged(String, int, Bundle)} will be called. You should - * call {@link #getSearchResult(String, int, int, Bundle)} to get the actual search result. + * {@link BrowserCallback#onSearchResultChanged(MediaBrowser2, String, int, Bundle)} will be + * called. You should call {@link #getSearchResult(String, int, int, Bundle)} to get the actual + * search result. * * @param query search query. Should not be an empty string. * @param extras extra bundle @@ -211,7 +221,8 @@ public class MediaBrowser2 extends MediaController2 { /** * Get the search result from lhe library service. Result would be sent back asynchronously with - * the {@link BrowserCallback#onGetSearchResultDone(String, int, int, List, Bundle)}. + * the + * {@link BrowserCallback#onGetSearchResultDone(MediaBrowser2, String, int, int, List, Bundle)}. * * @param query search query that you've specified with {@link #search(String, Bundle)} * @param page page number to get search result. Starts from {@code 1} diff --git a/media/java/android/media/MediaController2.java b/media/java/android/media/MediaController2.java index 38d50004a95f..2ef2bb355f0d 100644 --- a/media/java/android/media/MediaController2.java +++ b/media/java/android/media/MediaController2.java @@ -51,9 +51,9 @@ import java.util.concurrent.Executor; * <p> * When controlling {@link MediaSessionService2}, the {@link MediaController2} would be * available only if the session service allows this controller by - * {@link MediaSession2.SessionCallback#onConnect(ControllerInfo)} for the service. Wait - * {@link ControllerCallback#onConnected(CommandGroup)} or - * {@link ControllerCallback#onDisconnected()} for the result. + * {@link MediaSession2.SessionCallback#onConnect(MediaSession2, ControllerInfo)} for the service. + * Wait {@link ControllerCallback#onConnected(MediaController2, CommandGroup)} or + * {@link ControllerCallback#onDisconnected(MediaController2)} for the result. * <p> * A controller can be created through token from {@link MediaSessionManager} if you hold the * signature|privileged permission "android.permission.MEDIA_CONTENT_CONTROL" permission or are @@ -75,9 +75,11 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * Called when the controller is successfully connected to the session. The controller * becomes available afterwards. * + * @param controller the controller for this event * @param allowedCommands commands that's allowed by the session. */ - public void onConnected(CommandGroup allowedCommands) { } + public void onConnected(@NonNull MediaController2 controller, + @NonNull CommandGroup allowedCommands) { } /** * Called when the session refuses the controller or the controller is disconnected from @@ -86,41 +88,52 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * <p> * It will be also called after the {@link #close()}, so you can put clean up code here. * You don't need to call {@link #close()} after this. + * + * @param controller the controller for this event + * @param controller controller for this event */ - public void onDisconnected() { } + public void onDisconnected(@NonNull MediaController2 controller) { } /** * Called when the session set the custom layout through the * {@link MediaSession2#setCustomLayout(ControllerInfo, List)}. * <p> - * Can be called before {@link #onConnected(CommandGroup)} is called. + * Can be called before {@link #onConnected(MediaController2, CommandGroup)} is called. * + * @param controller the controller for this event * @param layout */ - public void onCustomLayoutChanged(List<CommandButton> layout) { } + public void onCustomLayoutChanged(@NonNull MediaController2 controller, + @NonNull List<CommandButton> layout) { } /** * Called when the session has changed anything related with the {@link PlaybackInfo}. * + * @param controller the controller for this event * @param info new playback info */ - public void onPlaybackInfoChanged(PlaybackInfo info) { } + public void onPlaybackInfoChanged(@NonNull MediaController2 controller, + @NonNull PlaybackInfo info) { } /** * Called when the allowed commands are changed by session. * + * @param controller the controller for this event * @param commands newly allowed commands */ - public void onAllowedCommandsChanged(CommandGroup commands) { } + public void onAllowedCommandsChanged(@NonNull MediaController2 controller, + @NonNull CommandGroup commands) { } /** * Called when the session sent a custom command. * + * @param controller the controller for this event * @param command * @param args * @param receiver */ - public void onCustomCommand(Command command, @Nullable Bundle args, + public void onCustomCommand(@NonNull MediaController2 controller, + @NonNull Command command, @Nullable Bundle args, @Nullable ResultReceiver receiver) { } /** @@ -129,70 +142,87 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController * When it's called, you should invalidate previous playback information such as position, * player state, current item, etc. * + * @param controller the controller for this event * @param playlist A new playlist set by the session. */ // TODO(jaewan): Enhance doc - public void onPlaylistChanged(@NonNull List<MediaItem2> playlist) { } + public void onPlaylistChanged(@NonNull MediaController2 controller, + @NonNull List<MediaItem2> playlist) { } /** * Called when the playback state is changed. * + * @param controller the controller for this event * @param state latest playback state * @hide */ // TODo(jaewan): Remove - public void onPlaybackStateChanged(@NonNull PlaybackState2 state) { } + public void onPlaybackStateChanged(@NonNull MediaController2 controller, + @NonNull PlaybackState2 state) { } /** * Called when the player state is changed. * + * @param controller the controller for this event * @param state */ - public void onPlayerStateChanged(int state) { } + public void onPlayerStateChanged(@NonNull MediaController2 controller, int state) { } /** * Called when the player's position is changed * - * @param updateTimeMs timestamp when the position information is sent from the session + * @param controller the controller for this event + * @param eventTimeMs timestamp when the position information is sent from the session * @param positionMs position in millis */ - public void onPositionChanged(long updateTimeMs, long positionMs) { } + public void onPositionChanged(@NonNull MediaController2 controller, + long eventTimeMs, long positionMs) { } /** * Called when playback speed is changed. * + * @param controller the controller for this event * @param speed speed */ - public void onPlaybackSpeedChanged(float speed) { } + public void onPlaybackSpeedChanged(@NonNull MediaController2 controller, + float speed) { } /** * Called when the player's buffering position * + * @param controller the controller for this event * @param positionMs buffering position in millis */ - public void onBufferedPositionChanged(long positionMs) { } + public void onBufferedPositionChanged(@NonNull MediaController2 controller, + long positionMs) { } /** * Called when a error from * + * @param controller the controller for this event * @param errorCode error code * @param extras extra information */ - public void onError(@ErrorCode int errorCode, @Nullable Bundle extras) { } + public void onError(@NonNull MediaController2 controller, @ErrorCode int errorCode, + @Nullable Bundle extras) { } /** * Called when the player's current playing item is changed * + * @param controller the controller for this event * @param item new item */ - public void onCurrentPlaylistItemChanged(MediaItem2 item) { } + public void onCurrentPlaylistItemChanged(@NonNull MediaController2 controller, + @NonNull MediaItem2 item) { } /** * Called when the playlist parameters are changed. * + * @param controller the controller for this event * @param params The new play list parameters. */ - public void onPlaylistParamsChanged(@NonNull PlaylistParams params) { } + public void onPlaylistParamsChanged(@NonNull MediaController2 controller, + @NonNull PlaylistParams params) { } } /** @@ -577,7 +607,7 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController /** * Get the lastly cached {@link PlaybackState2} from - * {@link ControllerCallback#onPlaybackStateChanged(PlaybackState2)}. + * {@link ControllerCallback#onPlaybackStateChanged(MediaController2, PlaybackState2)}. * <p> * It may return {@code null} before the first callback or session has sent {@code null} * playback state. @@ -590,7 +620,8 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController } /** - * Get the lastly cached player state from {@link ControllerCallback#onPlayerStateChanged(int)}. + * Get the lastly cached player state from + * {@link ControllerCallback#onPlayerStateChanged(MediaController2, int)}. * * @return player state */ @@ -599,7 +630,8 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController } /** - * Get the lastly cached position from {@link ControllerCallback#onPositionChanged(long, long)}. + * Get the lastly cached position from + * {@link ControllerCallback#onPositionChanged(MediaController2, long, long)}. * <p> * This returns the calculated value of the position, based on the difference between the * update time and current time. @@ -612,7 +644,7 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController /** * Get the lastly cached playback speed from - * {@link ControllerCallback#onPlaybackSpeedChanged(float)}. + * {@link ControllerCallback#onPlaybackSpeedChanged(MediaController2, float)}. * * @return speed */ @@ -629,7 +661,7 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController /** * Get the lastly cached buffered position from - * {@link ControllerCallback#onBufferedPositionChanged(long)}. + * {@link ControllerCallback#onBufferedPositionChanged(MediaController2, long)}. * * @return buffering position in millis */ @@ -639,7 +671,7 @@ public class MediaController2 implements AutoCloseable, MediaPlaylistController /** * Get the lastly cached current item from - * {@link ControllerCallback#onCurrentPlaylistItemChanged(MediaItem2)}. + * {@link ControllerCallback#onCurrentPlaylistItemChanged(MediaController2, MediaItem2)}. * * @return index of the current item */ diff --git a/media/java/android/media/MediaLibraryService2.java b/media/java/android/media/MediaLibraryService2.java index 5917190b17de..237268515c0d 100644 --- a/media/java/android/media/MediaLibraryService2.java +++ b/media/java/android/media/MediaLibraryService2.java @@ -85,6 +85,7 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * should return null if the client is not allowed to access this * information. * + * @param session the session for this event * @param controllerInfo information of the controller requesting access to browse media. * @param rootHints An optional bundle of service-specific arguments to send * to the media library service when connecting and retrieving the @@ -95,8 +96,8 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * @see LibraryRoot#EXTRA_OFFLINE * @see LibraryRoot#EXTRA_SUGGESTED */ - public @Nullable LibraryRoot onGetLibraryRoot(@NonNull ControllerInfo controllerInfo, - @Nullable Bundle rootHints) { + public @Nullable LibraryRoot onGetLibraryRoot(@NonNull MediaLibrarySession session, + @NonNull ControllerInfo controllerInfo, @Nullable Bundle rootHints) { return null; } @@ -105,11 +106,12 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * <p> * Return {@code null} for no result or error. * + * @param session the session for this event * @param mediaId item id to get media item. * @return a media item. {@code null} for no result or error. */ - public @Nullable MediaItem2 onGetItem(@NonNull ControllerInfo controllerInfo, - @NonNull String mediaId) { + public @Nullable MediaItem2 onGetItem(@NonNull MediaLibrarySession session, + @NonNull ControllerInfo controllerInfo, @NonNull String mediaId) { return null; } @@ -118,14 +120,16 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * <p> * Return an empty list for no children, and return {@code null} for the error. * + * @param session the session for this event * @param parentId parent id to get children * @param page number of page * @param pageSize size of the page * @param extras extra bundle * @return list of children. Can be {@code null}. */ - public @Nullable List<MediaItem2> onGetChildren(@NonNull ControllerInfo controller, - @NonNull String parentId, int page, int pageSize, @Nullable Bundle extras) { + public @Nullable List<MediaItem2> onGetChildren(@NonNull MediaLibrarySession session, + @NonNull ControllerInfo controller, @NonNull String parentId, int page, + int pageSize, @Nullable Bundle extras) { return null; } @@ -136,32 +140,37 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * {@link MediaLibrarySession#notifyChildrenChanged(ControllerInfo, String, int, Bundle)} * when the parent is changed. * + * @param session the session for this event * @param controller controller * @param parentId parent id * @param extras extra bundle */ - public void onSubscribe(@NonNull ControllerInfo controller, @NonNull String parentId, + public void onSubscribe(@NonNull MediaLibrarySession session, + @NonNull ControllerInfo controller, @NonNull String parentId, @Nullable Bundle extras) { } /** * Called when a controller unsubscribes to the parent. * + * @param session the session for this event * @param controller controller * @param parentId parent id */ - public void onUnsubscribe(@NonNull ControllerInfo controller, - @NonNull String parentId) { + public void onUnsubscribe(@NonNull MediaLibrarySession session, + @NonNull ControllerInfo controller, @NonNull String parentId) { } /** * Called when a controller requests search. * + * @param session the session for this event * @param query The search query sent from the media browser. It contains keywords * separated by space. * @param extras The bundle of service-specific arguments sent from the media browser. */ - public void onSearch(@NonNull ControllerInfo controllerInfo, @NonNull String query, + public void onSearch(@NonNull MediaLibrarySession session, + @NonNull ControllerInfo controllerInfo, @NonNull String query, @Nullable Bundle extras) { } @@ -171,17 +180,18 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * <p> * Return an empty list for no search result, and return {@code null} for the error. * + * @param session the session for this event * @param controllerInfo Information of the controller requesting the search result. * @param query The search query which was previously sent through - * {@link #onSearch(ControllerInfo, String, Bundle)} call. + * {@link #onSearch(MediaLibrarySession, ControllerInfo, String, Bundle)}. * @param page page number. Starts from {@code 1}. * @param pageSize page size. Should be greater or equal to {@code 1}. * @param extras The bundle of service-specific arguments sent from the media browser. * @return search result. {@code null} for error. */ public @Nullable List<MediaItem2> onGetSearchResult( - @NonNull ControllerInfo controllerInfo, @NonNull String query, int page, - int pageSize, @Nullable Bundle extras) { + @NonNull MediaLibrarySession session, @NonNull ControllerInfo controllerInfo, + @NonNull String query, int page, int pageSize, @Nullable Bundle extras) { return null; } } @@ -335,8 +345,8 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * supplied as a root hint for retrieving media items that are recently played. * If the media library service can provide such media items, the implementation must return * the key in the root hint when - * {@link MediaLibrarySessionCallback#onGetLibraryRoot(ControllerInfo, Bundle)} is called - * back. + * {@link MediaLibrarySessionCallback#onGetLibraryRoot(MediaLibrarySession, ControllerInfo, Bundle)} + * is called back. * * <p>The root hint may contain multiple keys. * @@ -354,8 +364,8 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * internet connection. * If the media library service can provide such media items, the implementation must return * the key in the root hint when - * {@link MediaLibrarySessionCallback#onGetLibraryRoot(ControllerInfo, Bundle)} is called - * back. + * {@link MediaLibrarySessionCallback#onGetLibraryRoot(MediaLibrarySession, ControllerInfo, Bundle)} + * is called back. * * <p>The root hint may contain multiple keys. * @@ -374,8 +384,8 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 { * suggestion. * If the media library service can provide such media items, the implementation must return * the key in the root hint when - * {@link MediaLibrarySessionCallback#onGetLibraryRoot(ControllerInfo, Bundle)} is called - * back. + * {@link MediaLibrarySessionCallback#onGetLibraryRoot(MediaLibrarySession, ControllerInfo, Bundle)} + * is called back. * * <p>The root hint may contain multiple keys. * diff --git a/media/java/android/media/MediaSession2.java b/media/java/android/media/MediaSession2.java index ae5a8c6b4c2d..bbc4299751ce 100644 --- a/media/java/android/media/MediaSession2.java +++ b/media/java/android/media/MediaSession2.java @@ -24,7 +24,6 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.media.MediaPlayerBase.PlayerEventCallback; -import android.media.MediaPlaylistController; import android.media.session.MediaSession; import android.media.session.MediaSession.Callback; import android.media.session.PlaybackState; @@ -97,7 +96,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#play()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_PLAY = 1; @@ -105,7 +104,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#pause()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_PAUSE = 2; @@ -113,7 +112,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#stop()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_STOP = 3; @@ -121,7 +120,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#skipToNext()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_SKIP_NEXT_ITEM = 4; @@ -129,7 +128,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#skipToPrevious()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_SKIP_PREV_ITEM = 5; @@ -137,7 +136,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#prepare()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_PREPARE = 6; @@ -146,7 +145,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * <p> * This is transport control command. Command would be sent directly to the player if the * session doesn't reject the request through the - * {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_FAST_FORWARD = 7; @@ -154,7 +153,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#rewind()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_REWIND = 8; @@ -162,14 +161,14 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#seekTo(long)}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_SEEK_TO = 9; /** * Command code for {@link MediaController2#skipToPlaylistItem(MediaItem2)}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_SKIP_TO_PLAYLIST_ITEM = 10; @@ -177,7 +176,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#setPlaylistParams(PlaylistParams)}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYBACK_SET_PLAYLIST_PARAMS = 11; @@ -185,7 +184,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#addPlaylistItem(int, MediaItem2)}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYLIST_ADD = 12; @@ -193,7 +192,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#addPlaylistItem(int, MediaItem2)}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYLIST_REMOVE = 13; @@ -201,7 +200,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Command code for {@link MediaController2#getPlaylist()}. * <p> * Command would be sent directly to the player if the session doesn't reject the request - * through the {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * through the {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_PLAYLIST_GET = 14; @@ -211,7 +210,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * <p> * Command would adjust the volume or sent to the volume provider directly if the session * doesn't reject the request through the - * {@link SessionCallback#onCommandRequest(ControllerInfo, Command)}. + * {@link SessionCallback#onCommandRequest(MediaSession2, ControllerInfo, Command)}. */ public static final int COMMAND_CODE_SET_VOLUME = 15; @@ -483,13 +482,16 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * controller. By default it allows all connection requests and commands. * <p> * You can reject the connection by return {@code null}. In that case, controller receives - * {@link MediaController2.ControllerCallback#onDisconnected()} and cannot be usable. + * {@link MediaController2.ControllerCallback#onDisconnected(MediaController2)} and cannot + * be usable. * + * @param session the session for this event * @param controller controller information. * @return allowed commands. Can be {@code null} to reject coonnection. */ // TODO(jaewan): Change return type. Once we do, null is for reject. - public @Nullable CommandGroup onConnect(@NonNull ControllerInfo controller) { + public @Nullable CommandGroup onConnect(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller) { CommandGroup commands = new CommandGroup(mContext); commands.addAllPredefinedCommands(); return commands; @@ -498,14 +500,17 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { /** * Called when a controller is disconnected * + * @param session the session for this event * @param controller controller information */ - public void onDisconnected(@NonNull ControllerInfo controller) { } + public void onDisconnected(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller) { } /** * Called when a controller sent a command that will be sent directly to the player. Return * {@code false} here to reject the request and stop sending command to the player. * + * @param session the session for this event * @param controller controller information. * @param command a command. This method will be called for every single command. * @return {@code true} if you want to accept incoming command. {@code false} otherwise. @@ -525,8 +530,8 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * @see #COMMAND_CODE_PLAYLIST_GET * @see #COMMAND_CODE_SET_VOLUME */ - public boolean onCommandRequest(@NonNull ControllerInfo controller, - @NonNull Command command) { + public boolean onCommandRequest(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull Command command) { return true; } @@ -539,37 +544,41 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * in order to provide possible rating style for controller. Controller will follow the * rating style. * + * @param session the session for this event * @param controller controller information * @param mediaId media id from the controller * @param rating new rating from the controller */ - public void onSetRating(@NonNull ControllerInfo controller, @NonNull String mediaId, - @NonNull Rating2 rating) { } + public void onSetRating(@NonNull MediaSession2 session, @NonNull ControllerInfo controller, + @NonNull String mediaId, @NonNull Rating2 rating) { } /** * Called when a controller sent a custom command through * {@link MediaController2#sendCustomCommand(Command, Bundle, ResultReceiver)}. * + * @param session the session for this event * @param controller controller information * @param customCommand custom command. * @param args optional arguments * @param cb optional result receiver */ - public void onCustomCommand(@NonNull ControllerInfo controller, - @NonNull Command customCommand, @Nullable Bundle args, - @Nullable ResultReceiver cb) { } + public void onCustomCommand(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull Command customCommand, + @Nullable Bundle args, @Nullable ResultReceiver cb) { } /** * Called when a controller requested to play a specific mediaId through * {@link MediaController2#playFromMediaId(String, Bundle)}. * + * @param session the session for this event * @param controller controller information * @param mediaId media id * @param extras optional extra bundle * @see #COMMAND_CODE_PLAY_FROM_MEDIA_ID */ - public void onPlayFromMediaId(@NonNull ControllerInfo controller, - @NonNull String mediaId, @Nullable Bundle extras) { } + public void onPlayFromMediaId(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull String mediaId, + @Nullable Bundle extras) { } /** * Called when a controller requested to begin playback from a search query through @@ -578,25 +587,29 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * An empty query indicates that the app may play any music. The implementation should * attempt to make a smart choice about what to play. * + * @param session the session for this event * @param controller controller information * @param query query string. Can be empty to indicate any suggested media * @param extras optional extra bundle * @see #COMMAND_CODE_PLAY_FROM_SEARCH */ - public void onPlayFromSearch(@NonNull ControllerInfo controller, - @NonNull String query, @Nullable Bundle extras) { } + public void onPlayFromSearch(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull String query, + @Nullable Bundle extras) { } /** * Called when a controller requested to play a specific media item represented by a URI * through {@link MediaController2#playFromUri(Uri, Bundle)} * + * @param session the session for this event * @param controller controller information * @param uri uri * @param extras optional extra bundle * @see #COMMAND_CODE_PLAY_FROM_URI */ - public void onPlayFromUri(@NonNull ControllerInfo controller, - @NonNull Uri uri, @Nullable Bundle extras) { } + public void onPlayFromUri(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull Uri uri, + @Nullable Bundle extras) { } /** * Called when a controller requested to prepare for playing a specific mediaId through @@ -612,13 +625,15 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Override {@link #onPlayFromMediaId} to handle requests for starting * playback without preparation. * + * @param session the session for this event * @param controller controller information * @param mediaId media id to prepare * @param extras optional extra bundle * @see #COMMAND_CODE_PREPARE_FROM_MEDIA_ID */ - public void onPrepareFromMediaId(@NonNull ControllerInfo controller, - @NonNull String mediaId, @Nullable Bundle extras) { } + public void onPrepareFromMediaId(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull String mediaId, + @Nullable Bundle extras) { } /** * Called when a controller requested to prepare playback from a search query through @@ -634,13 +649,15 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Override {@link #onPlayFromSearch} to handle requests for starting playback without * preparation. * + * @param session the session for this event * @param controller controller information * @param query query string. Can be empty to indicate any suggested media * @param extras optional extra bundle * @see #COMMAND_CODE_PREPARE_FROM_SEARCH */ - public void onPrepareFromSearch(@NonNull ControllerInfo controller, - @NonNull String query, @Nullable Bundle extras) { } + public void onPrepareFromSearch(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull String query, + @Nullable Bundle extras) { } /** * Called when a controller requested to prepare a specific media item represented by a URI @@ -656,13 +673,14 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * Override {@link #onPlayFromUri} to handle requests for starting playback without * preparation. * + * @param session the session for this event * @param controller controller information * @param uri uri * @param extras optional extra bundle * @see #COMMAND_CODE_PREPARE_FROM_URI */ - public void onPrepareFromUri(@NonNull ControllerInfo controller, - @NonNull Uri uri, @Nullable Bundle extras) { } + public void onPrepareFromUri(@NonNull MediaSession2 session, + @NonNull ControllerInfo controller, @NonNull Uri uri, @Nullable Bundle extras) { } }; /** @@ -1252,7 +1270,7 @@ public class MediaSession2 implements AutoCloseable, MediaPlaylistController { * expanded row: layout[5] layout[6] layout[7] layout[8] layout[9] * main row: layout[3] layout[1] layout[0] layout[2] layout[4] * <p> - * This API can be called in the {@link SessionCallback#onConnect(ControllerInfo)}. + * This API can be called in the {@link SessionCallback#onConnect(MediaSession2, ControllerInfo)}. * * @param controller controller to specify layout. * @param layout oredered list of layout. diff --git a/media/java/android/media/MediaSessionService2.java b/media/java/android/media/MediaSessionService2.java index 56e8e5d00924..9032e0ed8215 100644 --- a/media/java/android/media/MediaSessionService2.java +++ b/media/java/android/media/MediaSessionService2.java @@ -85,7 +85,8 @@ import android.os.IBinder; * session service, the controller binds to the session service. {@link #onCreateSession(String)} * may be called after the {@link #onCreate} if the service hasn't created yet. * <p> - * After the binding, session's {@link MediaSession2.SessionCallback#onConnect(ControllerInfo)} + * After the binding, session's {@link MediaSession2.SessionCallback#onConnect(MediaSession2, ControllerInfo)} + * * will be called to accept or reject connection request from a controller. If the connection is * rejected, the controller will unbind. If it's accepted, the controller will be available to use * and keep binding. @@ -99,7 +100,7 @@ import android.os.IBinder; * <p> * Any app can bind to the session service with controller, but the controller can be used only if * the session service accepted the connection request through - * {@link MediaSession2.SessionCallback#onConnect(ControllerInfo)}. + * {@link MediaSession2.SessionCallback#onConnect(MediaSession2, ControllerInfo)}. */ public abstract class MediaSessionService2 extends Service { private final MediaSessionService2Provider mProvider; diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index 84c889cc3de5..c6701d589663 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -2028,7 +2028,7 @@ public class MediaSessionService extends SystemService implements Monitor { } @Override - public void onDisconnected() { + public void onDisconnected(MediaController2 controller) { destroySession2Internal(mToken); } }; |