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

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

Merge "MediaSession2: Remove initialization in library session impl constructor"

parents 248c4892 bd396d85
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -66,15 +66,17 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement

    public static class MediaLibrarySessionImpl extends MediaSession2Impl
            implements MediaLibrarySessionProvider {
        private final MediaLibrarySessionCallback mCallback;

        public MediaLibrarySessionImpl(Context context,
                MediaPlayerInterface player, String id, VolumeProvider2 volumeProvider,
                int ratingType, PendingIntent sessionActivity, Executor callbackExecutor,
                MediaLibrarySessionCallback callback) {
            super(context, player, id, volumeProvider, ratingType, sessionActivity,
                    callbackExecutor, callback);
            mCallback = callback;
            // Don't put any extra initialization here. Here's the reason.
            // System service will recognize this session inside of the super constructor and would
            // connect to this session assuming that initialization is finished. However, if any
            // initialization logic is here, calls from the server would fail.
            // see: MediaSession2Stub#connect()
        }

        @Override
@@ -89,8 +91,7 @@ public class MediaLibraryService2Impl extends MediaSessionService2Impl implement

        @Override
        MediaLibrarySessionCallback getCallback() {
            // Equivalent to the (MediaLibrarySessionCallback) super.getCallback().
            return mCallback;
            return (MediaLibrarySessionCallback) super.getCallback();
        }

        @Override