diff --git a/api/current.txt b/api/current.txt index 5634837a2a4a4..dd9b5a1ef284f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -34369,6 +34369,9 @@ package android.service.media { ctor public MediaBrowserService.BrowserRoot(java.lang.String, android.os.Bundle); method public android.os.Bundle getExtras(); method public java.lang.String getRootId(); + field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE"; + field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT"; + field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED"; } public class MediaBrowserService.Result { diff --git a/api/system-current.txt b/api/system-current.txt index c2b09b1bb1e61..ef4841e8fb4e1 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -36779,6 +36779,9 @@ package android.service.media { ctor public MediaBrowserService.BrowserRoot(java.lang.String, android.os.Bundle); method public android.os.Bundle getExtras(); method public java.lang.String getRootId(); + field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE"; + field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT"; + field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED"; } public class MediaBrowserService.Result { diff --git a/api/test-current.txt b/api/test-current.txt index 9986be8025292..80d82c3d84ffa 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -34384,6 +34384,9 @@ package android.service.media { ctor public MediaBrowserService.BrowserRoot(java.lang.String, android.os.Bundle); method public android.os.Bundle getExtras(); method public java.lang.String getRootId(); + field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE"; + field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT"; + field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED"; } public class MediaBrowserService.Result { diff --git a/media/java/android/media/browse/MediaBrowser.java b/media/java/android/media/browse/MediaBrowser.java index 80b3ffc23e318..56b25144d9480 100644 --- a/media/java/android/media/browse/MediaBrowser.java +++ b/media/java/android/media/browse/MediaBrowser.java @@ -117,6 +117,9 @@ public final class MediaBrowser { * to the media browse 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. + * @see android.service.media.MediaBrowserService.BrowserRoot#EXTRA_RECENT + * @see android.service.media.MediaBrowserService.BrowserRoot#EXTRA_OFFLINE + * @see android.service.media.MediaBrowserService.BrowserRoot#EXTRA_SUGGESTED */ public MediaBrowser(Context context, ComponentName serviceComponent, ConnectionCallback callback, Bundle rootHints) { diff --git a/media/java/android/service/media/MediaBrowserService.java b/media/java/android/service/media/MediaBrowserService.java index 0393c943784d5..3372524d138cc 100644 --- a/media/java/android/service/media/MediaBrowserService.java +++ b/media/java/android/service/media/MediaBrowserService.java @@ -351,6 +351,9 @@ public abstract class MediaBrowserService extends Service { * root id for browsing, or null if none. The contents of this * bundle may affect the information returned when browsing. * @return The {@link BrowserRoot} for accessing this app's content or null. + * @see BrowserRoot#EXTRA_RECENT + * @see BrowserRoot#EXTRA_OFFLINE + * @see BrowserRoot#EXTRA_SUGGESTED */ public abstract @Nullable BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, @Nullable Bundle rootHints); @@ -667,6 +670,57 @@ public abstract class MediaBrowserService extends Service { * when first connected. */ public static final class BrowserRoot { + /** + * The lookup key for a boolean that indicates whether the browser service should return a + * browser root for recently played media items. + * + *
When creating a media browser for a given media browser service, this key can be + * supplied as a root hint for retrieving media items that are recently played. + * If the media browser service can provide such media items, the implementation must return + * the key in the root hint when {@link #onGetRoot(String, int, Bundle)} is called back. + * + *
The root hint may contain multiple keys. + * + * @see #EXTRA_OFFLINE + * @see #EXTRA_SUGGESTED + */ + public static final String EXTRA_RECENT = "android.service.media.extra.RECENT"; + + /** + * The lookup key for a boolean that indicates whether the browser service should return a + * browser root for offline media items. + * + *
When creating a media browser for a given media browser service, this key can be + * supplied as a root hint for retrieving media items that are can be played without an + * internet connection. + * If the media browser service can provide such media items, the implementation must return + * the key in the root hint when {@link #onGetRoot(String, int, Bundle)} is called back. + * + *
The root hint may contain multiple keys. + * + * @see #EXTRA_RECENT + * @see #EXTRA_SUGGESTED + */ + public static final String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE"; + + /** + * The lookup key for a boolean that indicates whether the browser service should return a + * browser root for suggested media items. + * + *
When creating a media browser for a given media browser service, this key can be + * supplied as a root hint for retrieving the media items suggested by the media browser + * service. The list of media items passed in {@link android.media.browse.MediaBrowser.SubscriptionCallback#onChildrenLoaded(String, List)} + * is considered ordered by relevance, first being the top suggestion. + * If the media browser service can provide such media items, the implementation must return + * the key in the root hint when {@link #onGetRoot(String, int, Bundle)} is called back. + * + *
The root hint may contain multiple keys. + * + * @see #EXTRA_RECENT + * @see #EXTRA_OFFLINE + */ + public static final String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED"; + final private String mRootId; final private Bundle mExtras;