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

Commit 61234d54 authored by Hyundo Moon's avatar Hyundo Moon Committed by Android (Google) Code Review
Browse files

Merge "Throw IllegalStateException in MediaBrowser.search()"

parents 097ee43b b0b21201
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ public final class MediaBrowser {
     * @param extras The bundle of service-specific arguments to send to the media browser
     *            service. The contents of this bundle may affect the search result.
     * @param callback The callback to receive the search result.
     * @throws IllegalStateException if the browser is not connected to the media browser service.
     */
    public void search(@NonNull final String query, final Bundle extras, SearchCallback callback) {
        if (TextUtils.isEmpty(query)) {
@@ -480,14 +481,8 @@ public final class MediaBrowser {
            throw new IllegalArgumentException("callback cannot be null.");
        }
        if (mState != CONNECT_STATE_CONNECTED) {
            Log.i(TAG, "Not connected, unable to search.");
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    callback.onError(query, extras);
                }
            });
            return;
            throw new IllegalStateException("search() called while not connected (state="
                    + getStateLabel(mState) + ")");
        }
        ResultReceiver receiver = new ResultReceiver(mHandler) {
            @Override