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

Commit 9649f25a authored by Hyundo Moon's avatar Hyundo Moon Committed by Jaewan Kim
Browse files

MediaBrowser2: Fix naming inconsistencies

This CL modifies following APIs:

1. getLibraryRoot() related
 - onGetRoot => onGetLibraryRoot
 - onGetRootResult => onGetLibraryRootDone

2. getItem() related
 - onLoadItem => onGetItem
   - Also renamed argument: itemId => mediaId
 - onItemLoaded => onGetItemDone

3. getChildren() related
 - notifyChildrenChanged/onChildrenChanged
   - Renamed argument: childCount => itemCount
 - onLoadChildren => onGetChildren
 - onChildrenLoaded => onGetChildrenDone

4. getSearchResult() related
 - onLoadSearchResult => onGetSearchResult
 - onSearchResultLoaded => onGetSearchResultDone

Bug: 73711101
Test: Passed MediaBrowser2Test
Change-Id: Ic8d6530d3913d9becdaada32283e9fe1f7e534a9
parent 17bc6993
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public class MediaBrowser2 extends MediaController2 {
         * @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 onGetRootResult(Bundle rootHints, @Nullable String rootMediaId,
        public void onGetLibraryRootDone(Bundle rootHints, @Nullable String rootMediaId,
                @Nullable Bundle rootExtra) { }

        /**
@@ -62,11 +62,11 @@ public class MediaBrowser2 extends MediaController2 {
         * {@link MediaLibrarySession#notifyChildrenChanged(String, int, Bundle)} for the parent.
         *
         * @param parentId parent id that you've specified with {@link #subscribe(String, Bundle)}
         * @param childCount number of children
         * @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 childCount,
        public void onChildrenChanged(@NonNull String parentId, int itemCount,
                @Nullable Bundle extras) { }

        /**
@@ -81,7 +81,7 @@ public class MediaBrowser2 extends MediaController2 {
         * @param result result. Can be {@code null}
         * @param extras extra bundle from the library service
         */
        public void onChildrenLoaded(@NonNull String parentId, int page, int pageSize,
        public void onGetChildrenDone(@NonNull String parentId, int page, int pageSize,
                @Nullable List<MediaItem2> result, @Nullable Bundle extras) { }

        /**
@@ -93,7 +93,7 @@ public class MediaBrowser2 extends MediaController2 {
         * @param mediaId media id
         * @param result result. Can be {@code null}
         */
        public void onItemLoaded(@NonNull String mediaId, @Nullable MediaItem2 result) { }
        public void onGetItemDone(@NonNull String mediaId, @Nullable MediaItem2 result) { }

        /**
         * Called when there's change in the search result requested by the previous
@@ -121,7 +121,7 @@ public class MediaBrowser2 extends MediaController2 {
         * @param result result. Can be {@code null}.
         * @param extras extra bundle from the library service
         */
        public void onSearchResultLoaded(@NonNull String query, int page, int pageSize,
        public void onGetSearchResultDone(@NonNull String query, int page, int pageSize,
                @Nullable List<MediaItem2> result, @Nullable Bundle extras) { }
    }

@@ -140,10 +140,10 @@ public class MediaBrowser2 extends MediaController2 {

    /**
     * Get the library root. Result would be sent back asynchronously with the
     * {@link BrowserCallback#onGetRootResult(Bundle, String, Bundle)}.
     * {@link BrowserCallback#onGetLibraryRootDone(Bundle, String, Bundle)}.
     *
     * @param rootHints hint for the root
     * @see BrowserCallback#onGetRootResult(Bundle, String, Bundle)
     * @see BrowserCallback#onGetLibraryRootDone(Bundle, String, Bundle)
     */
    public void getLibraryRoot(Bundle rootHints) {
        mProvider.getLibraryRoot_impl(rootHints);
@@ -177,7 +177,7 @@ public class MediaBrowser2 extends MediaController2 {

    /**
     * Get list of children under the parent. Result would be sent back asynchronously with the
     * {@link BrowserCallback#onChildrenLoaded(String, int, int, List, Bundle)}.
     * {@link BrowserCallback#onGetChildrenDone(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}
@@ -190,7 +190,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#onItemLoaded(String, MediaItem2)}.
     * {@link BrowserCallback#onGetItemDone(String, MediaItem2)}.
     *
     * @param mediaId media id for specifying the item
     */
@@ -212,7 +212,7 @@ public class MediaBrowser2 extends MediaController2 {

    /**
     * Get the search result from lhe library service. Result would be sent back asynchronously with
     * the {@link BrowserCallback#onSearchResultLoaded(String, int, int, List, Bundle)}.
     * the {@link BrowserCallback#onGetSearchResultDone(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}
+24 −21
Original line number Diff line number Diff line
@@ -87,12 +87,12 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
         *
         * @param controller controller to notify
         * @param parentId parent id with changes in its children
         * @param childCount number of children.
         * @param itemCount number of children.
         * @param extras extra information from session to controller
         */
        public void notifyChildrenChanged(@NonNull ControllerInfo controller,
                @NonNull String parentId, int childCount, @Nullable Bundle extras) {
            mProvider.notifyChildrenChanged_impl(controller, parentId, childCount, extras);
                @NonNull String parentId, int itemCount, @Nullable Bundle extras) {
            mProvider.notifyChildrenChanged_impl(controller, parentId, itemCount, extras);
        }

        /**
@@ -101,13 +101,13 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
         * {@link MediaBrowser2#subscribe(String, Bundle)}.
         *
         * @param parentId parent id
         * @param childCount number of children
         * @param itemCount number of children
         * @param extras extra information from session to controller
         */
        // This is for the backward compatibility.
        public void notifyChildrenChanged(@NonNull String parentId, int childCount,
        public void notifyChildrenChanged(@NonNull String parentId, int itemCount,
                @Nullable Bundle extras) {
            mProvider.notifyChildrenChanged_impl(parentId, childCount, extras);
            mProvider.notifyChildrenChanged_impl(parentId, itemCount, extras);
        }

        /**
@@ -151,7 +151,7 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
         * @see LibraryRoot#EXTRA_OFFLINE
         * @see LibraryRoot#EXTRA_SUGGESTED
         */
        public @Nullable LibraryRoot onGetRoot(@NonNull ControllerInfo controllerInfo,
        public @Nullable LibraryRoot onGetLibraryRoot(@NonNull ControllerInfo controllerInfo,
                @Nullable Bundle rootHints) {
            return null;
        }
@@ -161,11 +161,11 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
         * <p>
         * Return {@code null} for no result or error.
         *
         * @param itemId item id to get media item.
         * @param mediaId item id to get media item.
         * @return a media item. {@code null} for no result or error.
         */
        public @Nullable MediaItem2 onLoadItem(@NonNull ControllerInfo controllerInfo,
                @NonNull String itemId) {
        public @Nullable MediaItem2 onGetItem(@NonNull ControllerInfo controllerInfo,
                @NonNull String mediaId) {
            return null;
        }

@@ -180,33 +180,33 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
         * @param extras extra bundle
         * @return list of children. Can be {@code null}.
         */
        public @Nullable List<MediaItem2> onLoadChildren(@NonNull ControllerInfo controller,
        public @Nullable List<MediaItem2> onGetChildren(@NonNull ControllerInfo controller,
                @NonNull String parentId, int page, int pageSize, @Nullable Bundle extras) {
            return null;
        }

        /**
         * Called when a controller subscribed to the parent.
         * Called when a controller subscribes to the parent.
         * <p>
         * It's your responsibility to keep subscriptions by your own and call
         * {@link MediaLibrarySession#notifyChildrenChanged(ControllerInfo, String, Bundle)} when
         * the parent is changed.
         * {@link MediaLibrarySession#notifyChildrenChanged(ControllerInfo, String, int, Bundle)}
         * when the parent is changed.
         *
         * @param controller controller
         * @param parentId parent id
         * @param extras extra bundle
         */
        public void onSubscribed(@NonNull ControllerInfo controller, @NonNull String parentId,
        public void onSubscribe(@NonNull ControllerInfo controller, @NonNull String parentId,
                @Nullable Bundle extras) {
        }

        /**
         * Called when a controller unsubscribed to the parent.
         * Called when a controller unsubscribes to the parent.
         *
         * @param controller controller
         * @param parentId parent id
         */
        public void onUnsubscribed(@NonNull ControllerInfo controller, @NonNull String parentId) {
        public void onUnsubscribe(@NonNull ControllerInfo controller, @NonNull String parentId) {
        }

        /**
@@ -234,7 +234,7 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
         * @param extras The bundle of service-specific arguments sent from the media browser.
         * @return search result. {@code null} for error.
         */
        public @Nullable List<MediaItem2> onLoadSearchResult(@NonNull ControllerInfo controllerInfo,
        public @Nullable List<MediaItem2> onGetSearchResult(@NonNull ControllerInfo controllerInfo,
                @NonNull String query, int page, int pageSize, @Nullable Bundle extras) {
            return null;
        }
@@ -322,7 +322,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#onGetRoot(ControllerInfo, Bundle)} is called back.
         * {@link MediaLibrarySessionCallback#onGetLibraryRoot(ControllerInfo, Bundle)} is called
         * back.
         *
         * <p>The root hint may contain multiple keys.
         *
@@ -340,7 +341,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#onGetRoot(ControllerInfo, Bundle)} is called back.
         * {@link MediaLibrarySessionCallback#onGetLibraryRoot(ControllerInfo, Bundle)} is called
         * back.
         *
         * <p>The root hint may contain multiple keys.
         *
@@ -359,7 +361,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#onGetRoot(ControllerInfo, Bundle)} is called back.
         * {@link MediaLibrarySessionCallback#onGetLibraryRoot(ControllerInfo, Bundle)} is called
         * back.
         *
         * <p>The root hint may contain multiple keys.
         *
+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ public interface MediaLibraryService2Provider extends MediaSessionService2Provid

    interface MediaLibrarySessionProvider extends MediaSession2Provider {
        void notifyChildrenChanged_impl(ControllerInfo controller, String parentId,
                int childCount, Bundle extras);
        void notifyChildrenChanged_impl(String parentId, int childCount, Bundle extras);
                int itemCount, Bundle extras);
        void notifyChildrenChanged_impl(String parentId, int itemCount, Bundle extras);
        void notifySearchResultChanged_impl(ControllerInfo controller, String query, int itemCount,
                Bundle extras);
    }