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

Commit 048fdab0 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

MediaBrowser2: Rearrange API arguments in relevant order

Test: Passed MediaBrowser2Test
Change-Id: I466f17c33a89c483ae3f3ff28a03984e516b5868
parent 73ad28c7
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -49,9 +49,9 @@ oneway interface IMediaSession2Callback {
    //////////////////////////////////////////////////////////////////////////////////////////////
    void onGetRootResult(in Bundle rootHints, String rootMediaId, in Bundle rootExtra);
    void onItemLoaded(String mediaId, in Bundle result);
    void onChildrenLoaded(String parentId, int page, int pageSize, in Bundle extras,
            in List<Bundle> result);
    void onSearchResultChanged(String query, in Bundle extras, int itemCount);
    void onSearchResultLoaded(String query, int page, int pageSize, in Bundle extras,
            in List<Bundle> result);
    void onChildrenLoaded(String parentId, int page, int pageSize, in List<Bundle> result,
            in Bundle extras);
    void onSearchResultChanged(String query, int itemCount, in Bundle extras);
    void onSearchResultLoaded(String query, int page, int pageSize, in List<Bundle> result,
            in Bundle extras);
}
+8 −8
Original line number Diff line number Diff line
@@ -169,23 +169,23 @@ public class MediaBrowser2Impl extends MediaController2Impl implements MediaBrow
        });
    }

    public void onChildrenLoaded(String parentId, int page, int pageSize, Bundle extras,
            List<MediaItem2> result) {
    public void onChildrenLoaded(String parentId, int page, int pageSize, List<MediaItem2> result,
            Bundle extras) {
        getCallbackExecutor().execute(() -> {
            mCallback.onChildrenLoaded(parentId, page, pageSize, extras, result);
            mCallback.onChildrenLoaded(parentId, page, pageSize, result, extras);
        });
    }

    public void onSearchResultChanged(String query, Bundle extras, int itemCount) {
    public void onSearchResultChanged(String query, int itemCount, Bundle extras) {
        getCallbackExecutor().execute(() -> {
            mCallback.onSearchResultChanged(query, extras, itemCount);
            mCallback.onSearchResultChanged(query, itemCount, extras);
        });
    }

    public void onSearchResultLoaded(String query, int page, int pageSize, Bundle extras,
            List<MediaItem2> result) {
    public void onSearchResultLoaded(String query, int page, int pageSize, List<MediaItem2> result,
            Bundle extras) {
        getCallbackExecutor().execute(() -> {
            mCallback.onSearchResultLoaded(query, page, pageSize, extras, result);
            mCallback.onSearchResultLoaded(query, page, pageSize, result, extras);
        });
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement

        @Override
        public void notifySearchResultChanged_impl(ControllerInfo controller, String query,
                Bundle extras, int itemCount) {
                int itemCount, Bundle extras) {
            ensureCallingThread();
            if (controller == null) {
                throw new IllegalArgumentException("controller shouldn't be null");
@@ -115,7 +115,7 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement
            if (TextUtils.isEmpty(query)) {
                throw new IllegalArgumentException("query shouldn't be empty");
            }
            getSessionStub().notifySearchResultChanged(controller, query, extras, itemCount);
            getSessionStub().notifySearchResultChanged(controller, query, itemCount, extras);
        }
    }

+8 −8
Original line number Diff line number Diff line
@@ -244,8 +244,8 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub {
    }

    @Override
    public void onChildrenLoaded(String parentId, int page, int pageSize, Bundle extras,
            List<Bundle> itemBundleList) throws RuntimeException {
    public void onChildrenLoaded(String parentId, int page, int pageSize,
            List<Bundle> itemBundleList, Bundle extras) throws RuntimeException {
        final MediaBrowser2Impl browser;
        try {
            browser = getBrowser();
@@ -265,11 +265,11 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub {
                result.add(MediaItem2.fromBundle(browser.getContext(), bundle));
            }
        }
        browser.onChildrenLoaded(parentId, page, pageSize, extras, result);
        browser.onChildrenLoaded(parentId, page, pageSize, result, extras);
    }

    @Override
    public void onSearchResultChanged(String query, Bundle extras, int itemCount)
    public void onSearchResultChanged(String query, int itemCount, Bundle extras)
            throws RuntimeException {
        final MediaBrowser2Impl browser;
        try {
@@ -282,12 +282,12 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub {
            // TODO(jaewan): Revisit here. Could be a bug
            return;
        }
        browser.onSearchResultChanged(query, extras, itemCount);
        browser.onSearchResultChanged(query, itemCount, extras);
    }

    @Override
    public void onSearchResultLoaded(String query, int page, int pageSize, Bundle extras,
            List<Bundle> itemBundleList) throws RuntimeException {
    public void onSearchResultLoaded(String query, int page, int pageSize,
            List<Bundle> itemBundleList, Bundle extras) throws RuntimeException {
        final MediaBrowser2Impl browser;
        try {
            browser = getBrowser();
@@ -307,6 +307,6 @@ public class MediaSession2CallbackStub extends IMediaSession2Callback.Stub {
                result.add(MediaItem2.fromBundle(browser.getContext(), bundle));
            }
        }
        browser.onSearchResultLoaded(query, page, pageSize, extras, result);
        browser.onSearchResultLoaded(query, page, pageSize, result, extras);
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -643,7 +643,7 @@ public class MediaSession2Stub extends IMediaSession2.Stub {

            try {
                controllerImpl.getControllerBinder().onChildrenLoaded(
                        parentId, page, pageSize, extras, bundleList);
                        parentId, page, pageSize, bundleList, extras);
            } catch (RemoteException e) {
                // Controller may be died prematurely.
                // TODO(jaewan): Handle this.
@@ -726,7 +726,7 @@ public class MediaSession2Stub extends IMediaSession2.Stub {

            try {
                controllerImpl.getControllerBinder().onSearchResultLoaded(
                        query, page, pageSize, extras, bundleList);
                        query, page, pageSize, bundleList, extras);
            } catch (RemoteException e) {
                // Controller may be died prematurely.
                // TODO(jaewan): Handle this.
@@ -884,12 +884,12 @@ public class MediaSession2Stub extends IMediaSession2.Stub {
    // APIs for MediaLibrarySessionImpl
    //////////////////////////////////////////////////////////////////////////////////////////////

    public void notifySearchResultChanged(ControllerInfo controller, String query, Bundle extras,
            int itemCount) {
    public void notifySearchResultChanged(ControllerInfo controller, String query, int itemCount,
            Bundle extras) {
        final IMediaSession2Callback callbackBinder =
                ControllerInfoImpl.from(controller).getControllerBinder();
        try {
            callbackBinder.onSearchResultChanged(query, extras, itemCount);
            callbackBinder.onSearchResultChanged(query, itemCount, extras);
        } catch (RemoteException e) {
            Log.w(TAG, "Controller is gone", e);
            // TODO(jaewan): What to do when the controller is gone?
Loading