/**@class android.service.media.MediaBrowserService @extends android.app.Service Base class for media browser services. <p> Media browser services enable applications to browse media content provided by an application and ask the application to start playing it. They may also be used to control content that is already playing by way of a {@link MediaSession}. </p> To extend this class, you must declare the service in your manifest file with an intent filter with the {@link #SERVICE_INTERFACE} action. For example: </p><pre> <service android:name=".MyMediaBrowserService" android:label="@string/service_name" > <intent-filter> <action android:name="android.media.browse.MediaBrowserService" /> </intent-filter> </service> </pre> */ var MediaBrowserService = { /** The {@link Intent} that must be declared as handled by the service. */ SERVICE_INTERFACE : "android.media.browse.MediaBrowserService", /** A key for passing the MediaItem to the ResultReceiver in getItem. @hide */ KEY_MEDIA_ITEM : "media_item", /** */ onCreate : function( ) {}, /** */ onBind : function( ) {}, /** */ dump : function( ) {}, /**Called to get the root information for browsing by a particular client. <p> The implementation should verify that the client package has permission to access browse media information before returning the root id; it should return null if the client is not allowed to access this information. </p> @param {String} clientPackageName The package name of the application which is requesting access to browse media. @param {Number} clientUid The uid of the application which is requesting access to browse media. @param {Object {Bundle}} rootHints An optional bundle of service-specific arguments to send to the media browser service when connecting and retrieving the root id for browsing, or null if none. The contents of this bundle may affect the information returned when browsing. @return {Object {android.service.media.MediaBrowserService.BrowserRoot}} The {@link BrowserRoot} for accessing this app's content or null. @see BrowserRoot#EXTRA_RECENT @see BrowserRoot#EXTRA_OFFLINE @see BrowserRoot#EXTRA_SUGGESTED */ onGetRoot : function( ) {}, /**Called to get information about the children of a media item. <p> Implementations must call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} with the list of children. If loading the children will be an expensive operation that should be performed on another thread, {@link android.service.media.MediaBrowserService.Result#detach result.detach} may be called before returning from this function, and then {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} called when the loading is complete. </p><p> In case the media item does not have any children, call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result} with an empty list. When the given {@code parentId} is invalid, implementations must call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} with {@code null}, which will invoke {@link MediaBrowser.SubscriptionCallback#onError}. </p> @param {String} parentId The id of the parent media item whose children are to be queried. @param {Object {android.service.media.MediaBrowserService.Result}} result The Result to send the list of children to. */ onLoadChildren : function( ) {}, /**Called to get information about the children of a media item. <p> Implementations must call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} with the list of children. If loading the children will be an expensive operation that should be performed on another thread, {@link android.service.media.MediaBrowserService.Result#detach result.detach} may be called before returning from this function, and then {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} called when the loading is complete. </p><p> In case the media item does not have any children, call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result} with an empty list. When the given {@code parentId} is invalid, implementations must call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} with {@code null}, which will invoke {@link MediaBrowser.SubscriptionCallback#onError}. </p> @param {String} parentId The id of the parent media item whose children are to be queried. @param {Object {android.service.media.MediaBrowserService.Result}} result The Result to send the list of children to. @param {Object {Bundle}} options The bundle of service-specific arguments sent from the media browser. The information returned through the result should be affected by the contents of this bundle. */ onLoadChildren : function( ) {}, /**Called to get information about a specific media item. <p> Implementations must call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result}. If loading the item will be an expensive operation {@link android.service.media.MediaBrowserService.Result#detach result.detach} may be called before returning from this function, and then {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} called when the item has been loaded. </p><p> When the given {@code itemId} is invalid, implementations must call {@link android.service.media.MediaBrowserService.Result#sendandroid.service.media.MediaBrowserService.Result result.sendandroid.service.media.MediaBrowserService.Result} with {@code null}. </p><p> The default implementation will invoke {@link MediaBrowser.ItemCallback#onError}. </p> @param {String} itemId The id for the specific {@link android.media.browse.MediaBrowser.MediaItem}. @param {Object {android.service.media.MediaBrowserService.Result}} result The Result to send the item to. */ onLoadItem : function( ) {}, /**Call to set the media session. <p> This should be called as soon as possible during the service's startup. It may only be called once. @param {Object {MediaSession.Token}} token The token for the service's {@link MediaSession}. */ setSessionToken : function( ) {}, /**Gets the session token, or null if it has not yet been created or if it has been destroyed. */ getSessionToken : function( ) {}, /**Gets the root hints sent from the currently connected {@link MediaBrowser}. The root hints are service-specific arguments included in an optional bundle sent to the media browser service when connecting and retrieving the root id for browsing, or null if none. The contents of this bundle may affect the information returned when browsing. @throws IllegalStateException If this method is called outside of {@link #onGetRoot} or {@link #onLoadChildren} or {@link #onLoadItem}. @see MediaBrowserService.BrowserRoot#EXTRA_RECENT @see MediaBrowserService.BrowserRoot#EXTRA_OFFLINE @see MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED */ getBrowserRootHints : function( ) {}, /**Gets the browser information who sent the current request. @throws IllegalStateException If this method is called outside of {@link #onGetRoot} or {@link #onLoadChildren} or {@link #onLoadItem}. @see MediaSessionManager#isTrustedForMediaControl(RemoteUserInfo) */ getCurrentBrowserInfo : function( ) {}, /**Notifies all connected media browsers that the children of the specified parent id have changed in some way. This will cause browsers to fetch subscribed content again. @param {String} parentId The id of the parent media item whose children changed. */ notifyChildrenChanged : function( ) {}, /**Notifies all connected media browsers that the children of the specified parent id have changed in some way. This will cause browsers to fetch subscribed content again. @param {String} parentId The id of the parent media item whose children changed. @param {Object {Bundle}} options The bundle of service-specific arguments to send to the media browser. The contents of this bundle may contain the information about the change. */ notifyChildrenChanged : function( ) {}, };