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

Commit 437680c4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaLibrarySession: Add notifySearchResultChanged"

parents d38599b8 e08c97a3
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -88,14 +88,15 @@ public class MediaBrowser2 extends MediaController2 {
        public void onItemLoaded(@NonNull String mediaId, @Nullable MediaItem2 result) { }

        /**
         * Called when there's change in the search result.
         * Called when there's change in the search result requested by the previous
         * {@link MediaBrowser2#search(String, Bundle)}.
         *
         * @param query search query that you've specified with {@link #search(String, Bundle)}
         * @param extras extra bundle that you've specified with {@link #search(String, Bundle)}
         * @param totalItemCount The total item count for the search result
         * @param extras extra bundle
         * @param itemCount The item count for the search result
         */
        public void onSearchResultChanged(@NonNull String query, @Nullable Bundle extras,
                int totalItemCount) { }
                int itemCount) { }

        /**
         * Called when the search result has been returned by the library service for the previous
@@ -189,10 +190,9 @@ public class MediaBrowser2 extends MediaController2 {
    }

    /**
     * Send a search request to the library service. When there's a change,
     * {@link BrowserCallback#onSearchResultChanged(String, Bundle, int)} will be called with the
     * bundle that you've specified. You should call
     * {@link #getSearchResult(String, int, int, Bundle)} to get the actual search result.
     * Send a search request to the library service. When the search result is changed,
     * {@link BrowserCallback#onSearchResultChanged(String, Bundle, int)} 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
+13 −0
Original line number Diff line number Diff line
@@ -99,6 +99,19 @@ public abstract class MediaLibraryService2 extends MediaSessionService2 {
        public void notifyChildrenChanged(@NonNull String parentId, @Nullable Bundle extras) {
            mProvider.notifyChildrenChanged_impl(parentId, extras);
        }

        /**
         * Notify controller about change in the search result.
         *
         * @param controller controller to notify
         * @param query previously sent search query from the controller.
         * @param extras extra bundle
         * @param itemCount the number of items that have been found in the search.
         */
        public void notifySearchResultChanged(@NonNull ControllerInfo controller,
                @NonNull String query, @NonNull Bundle extras, int itemCount) {
            mProvider.notifySearchResultChanged_impl(controller, query, extras, itemCount);
        }
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -24,11 +24,11 @@ import android.os.Bundle;
public interface MediaBrowser2Provider extends MediaController2Provider {
    void getLibraryRoot_impl(Bundle rootHints);

    void subscribe_impl(String parentId, Bundle options);
    void unsubscribe_impl(String parentId, Bundle options);
    void subscribe_impl(String parentId, Bundle extras);
    void unsubscribe_impl(String parentId, Bundle extras);

    void getItem_impl(String mediaId);
    void getChildren_impl(String parentId, int page, int pageSize, Bundle extras);
    void search_impl(String query, Bundle options);
    void search_impl(String query, Bundle extras);
    void getSearchResult_impl(String query, int page, int pageSize, Bundle extras);
}
+4 −2
Original line number Diff line number Diff line
@@ -30,8 +30,10 @@ public interface MediaLibraryService2Provider extends MediaSessionService2Provid
    // Nothing new for now

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

    interface LibraryRootProvider {