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

Commit 36033858 authored by Jaewan Kim's avatar Jaewan Kim
Browse files

Clean up unused codes around the RemoteUserInfo

RemoteUserInfo doesn't require IBinder for finer grained identification
among MediaControllers in the same process/package. So extra information
don't need to be shared across the processes.

Bug: 146815343
Test: Build
Change-Id: I6935c9c43b5fdfa0c608c753779e17b6cf0d341e
parent a25fbaad
Loading
Loading
Loading
Loading
+25 −38
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package android.media.session;

import android.content.Intent;
import android.media.Rating;
import android.media.session.ISessionControllerCallback;
import android.net.Uri;
import android.os.Bundle;
import android.os.ResultReceiver;
@@ -26,48 +25,36 @@ import android.os.ResultReceiver;
 * @hide
 */
oneway interface ISessionCallback {
    void onCommand(String packageName, int pid, int uid, ISessionControllerCallback caller,
            String command, in Bundle args, in ResultReceiver cb);
    void onCommand(String packageName, int pid, int uid, String command, in Bundle args,
            in ResultReceiver cb);
    void onMediaButton(String packageName, int pid, int uid, in Intent mediaButtonIntent,
            int sequenceNumber, in ResultReceiver cb);
    void onMediaButtonFromController(String packageName, int pid, int uid,
            ISessionControllerCallback caller, in Intent mediaButtonIntent);
            in Intent mediaButtonIntent);

    // These callbacks are for the TransportControls
    void onPrepare(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onPrepareFromMediaId(String packageName, int pid, int uid,
            ISessionControllerCallback caller, String mediaId, in Bundle extras);
    void onPrepareFromSearch(String packageName, int pid, int uid,
            ISessionControllerCallback caller, String query, in Bundle extras);
    void onPrepareFromUri(String packageName, int pid, int uid,
            ISessionControllerCallback caller, in Uri uri, in Bundle extras);
    void onPlay(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onPlayFromMediaId(String packageName, int pid, int uid,
            ISessionControllerCallback caller, String mediaId, in Bundle extras);
    void onPlayFromSearch(String packageName, int pid, int uid,
            ISessionControllerCallback caller, String query, in Bundle extras);
    void onPlayFromUri(String packageName, int pid, int uid, ISessionControllerCallback caller,
            in Uri uri, in Bundle extras);
    void onSkipToTrack(String packageName, int pid, int uid, ISessionControllerCallback caller,
            long id);
    void onPause(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onStop(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onNext(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onPrevious(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onFastForward(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onRewind(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onSeekTo(String packageName, int pid, int uid, ISessionControllerCallback caller,
            long pos);
    void onRate(String packageName, int pid, int uid, ISessionControllerCallback caller,
            in Rating rating);
    void onSetPlaybackSpeed(String packageName, int pid, int uid,
            ISessionControllerCallback caller, float speed);
    void onCustomAction(String packageName, int pid, int uid, ISessionControllerCallback caller,
            String action, in Bundle args);
    void onPrepare(String packageName, int pid, int uid);
    void onPrepareFromMediaId(String packageName, int pid, int uid, String mediaId,
            in Bundle extras);
    void onPrepareFromSearch(String packageName, int pid, int uid, String query, in Bundle extras);
    void onPrepareFromUri(String packageName, int pid, int uid, in Uri uri, in Bundle extras);
    void onPlay(String packageName, int pid, int uid);
    void onPlayFromMediaId(String packageName, int pid, int uid, String mediaId, in Bundle extras);
    void onPlayFromSearch(String packageName, int pid, int uid, String query, in Bundle extras);
    void onPlayFromUri(String packageName, int pid, int uid, in Uri uri, in Bundle extras);
    void onSkipToTrack(String packageName, int pid, int uid, long id);
    void onPause(String packageName, int pid, int uid);
    void onStop(String packageName, int pid, int uid);
    void onNext(String packageName, int pid, int uid);
    void onPrevious(String packageName, int pid, int uid);
    void onFastForward(String packageName, int pid, int uid);
    void onRewind(String packageName, int pid, int uid);
    void onSeekTo(String packageName, int pid, int uid, long pos);
    void onRate(String packageName, int pid, int uid, in Rating rating);
    void onSetPlaybackSpeed(String packageName, int pid, int uid, float speed);
    void onCustomAction(String packageName, int pid, int uid, String action, in Bundle args);

    // These callbacks are for volume handling
    void onAdjustVolume(String packageName, int pid, int uid, ISessionControllerCallback caller,
            int direction);
    void onSetVolumeTo(String packageName, int pid, int uid,
            ISessionControllerCallback caller, int value);
    void onAdjustVolume(String packageName, int pid, int uid, int direction);
    void onSetVolumeTo(String packageName, int pid, int uid, int value);
}
+23 −34
Original line number Diff line number Diff line
@@ -36,10 +36,8 @@ import java.util.List;
 * @hide
 */
interface ISessionController {
    void sendCommand(String packageName, in ISessionControllerCallback caller,
            String command, in Bundle args, in ResultReceiver cb);
    boolean sendMediaButton(String packageName, in ISessionControllerCallback caller,
            in KeyEvent mediaButton);
    void sendCommand(String packageName, String command, in Bundle args, in ResultReceiver cb);
    boolean sendMediaButton(String packageName, in KeyEvent mediaButton);
    void registerCallback(String packageName, in ISessionControllerCallback cb);
    void unregisterCallback(in ISessionControllerCallback cb);
    String getPackageName();
@@ -48,38 +46,29 @@ interface ISessionController {
    PendingIntent getLaunchPendingIntent();
    long getFlags();
    MediaController.PlaybackInfo getVolumeAttributes();
    void adjustVolume(String packageName, String opPackageName,
            in ISessionControllerCallback caller, int direction, int flags);
    void setVolumeTo(String packageName, String opPackageName, in ISessionControllerCallback caller,
            int value, int flags);
    void adjustVolume(String packageName, String opPackageName, int direction, int flags);
    void setVolumeTo(String packageName, String opPackageName, int value, int flags);

    // These commands are for the TransportControls
    void prepare(String packageName, in ISessionControllerCallback caller);
    void prepareFromMediaId(String packageName, in ISessionControllerCallback caller,
            String mediaId, in Bundle extras);
    void prepareFromSearch(String packageName, in ISessionControllerCallback caller,
            String string, in Bundle extras);
    void prepareFromUri(String packageName, in ISessionControllerCallback caller,
            in Uri uri, in Bundle extras);
    void play(String packageName, in ISessionControllerCallback caller);
    void playFromMediaId(String packageName, in ISessionControllerCallback caller,
            String mediaId, in Bundle extras);
    void playFromSearch(String packageName, in ISessionControllerCallback caller,
            String string, in Bundle extras);
    void playFromUri(String packageName, in ISessionControllerCallback caller,
            in Uri uri, in Bundle extras);
    void skipToQueueItem(String packageName, in ISessionControllerCallback caller, long id);
    void pause(String packageName, in ISessionControllerCallback caller);
    void stop(String packageName, in ISessionControllerCallback caller);
    void next(String packageName, in ISessionControllerCallback caller);
    void previous(String packageName, in ISessionControllerCallback caller);
    void fastForward(String packageName, in ISessionControllerCallback caller);
    void rewind(String packageName, in ISessionControllerCallback caller);
    void seekTo(String packageName, in ISessionControllerCallback caller, long pos);
    void rate(String packageName, in ISessionControllerCallback caller, in Rating rating);
    void setPlaybackSpeed(String packageName, in ISessionControllerCallback caller, float speed);
    void sendCustomAction(String packageName, in ISessionControllerCallback caller,
            String action, in Bundle args);
    void prepare(String packageName);
    void prepareFromMediaId(String packageName, String mediaId, in Bundle extras);
    void prepareFromSearch(String packageName, String string, in Bundle extras);
    void prepareFromUri(String packageName, in Uri uri, in Bundle extras);
    void play(String packageName);
    void playFromMediaId(String packageName, String mediaId, in Bundle extras);
    void playFromSearch(String packageName, String string, in Bundle extras);
    void playFromUri(String packageName, in Uri uri, in Bundle extras);
    void skipToQueueItem(String packageName, long id);
    void pause(String packageName);
    void stop(String packageName);
    void next(String packageName);
    void previous(String packageName);
    void fastForward(String packageName);
    void rewind(String packageName);
    void seekTo(String packageName, long pos);
    void rate(String packageName, in Rating rating);
    void setPlaybackSpeed(String packageName, float speed);
    void sendCustomAction(String packageName, String action, in Bundle args);
    MediaMetadata getMetadata();
    PlaybackState getPlaybackState();
    ParceledListSlice getQueue();
+23 −26
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ public final class MediaController {
            return false;
        }
        try {
            return mSessionBinder.sendMediaButton(mContext.getPackageName(), mCbStub, keyEvent);
            return mSessionBinder.sendMediaButton(mContext.getPackageName(), keyEvent);
        } catch (RemoteException e) {
            // System is dead. =(
        }
@@ -298,7 +298,7 @@ public final class MediaController {
            //       RemoteUserInfo, and OP package name is used for AudioService's internal
            //       AppOpsManager usages.
            mSessionBinder.setVolumeTo(mContext.getPackageName(), mContext.getOpPackageName(),
                    mCbStub, value, flags);
                    value, flags);
        } catch (RemoteException e) {
            Log.wtf(TAG, "Error calling setVolumeTo.", e);
        }
@@ -323,7 +323,7 @@ public final class MediaController {
            //       RemoteUserInfo, and OP package name is used for AudioService's internal
            //       AppOpsManager usages.
            mSessionBinder.adjustVolume(mContext.getPackageName(), mContext.getOpPackageName(),
                    mCbStub, direction, flags);
                    direction, flags);
        } catch (RemoteException e) {
            Log.wtf(TAG, "Error calling adjustVolumeBy.", e);
        }
@@ -389,7 +389,7 @@ public final class MediaController {
            throw new IllegalArgumentException("command cannot be null or empty");
        }
        try {
            mSessionBinder.sendCommand(mContext.getPackageName(), mCbStub, command, args, cb);
            mSessionBinder.sendCommand(mContext.getPackageName(), command, args, cb);
        } catch (RemoteException e) {
            Log.d(TAG, "Dead object in sendCommand.", e);
        }
@@ -630,7 +630,7 @@ public final class MediaController {
         */
        public void prepare() {
            try {
                mSessionBinder.prepare(mContext.getPackageName(), mCbStub);
                mSessionBinder.prepare(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare.", e);
            }
@@ -654,8 +654,7 @@ public final class MediaController {
                        "You must specify a non-empty String for prepareFromMediaId.");
            }
            try {
                mSessionBinder.prepareFromMediaId(mContext.getPackageName(), mCbStub, mediaId,
                        extras);
                mSessionBinder.prepareFromMediaId(mContext.getPackageName(), mediaId, extras);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare(" + mediaId + ").", e);
            }
@@ -681,8 +680,7 @@ public final class MediaController {
                query = "";
            }
            try {
                mSessionBinder.prepareFromSearch(mContext.getPackageName(), mCbStub, query,
                        extras);
                mSessionBinder.prepareFromSearch(mContext.getPackageName(), query, extras);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare(" + query + ").", e);
            }
@@ -706,7 +704,7 @@ public final class MediaController {
                        "You must specify a non-empty Uri for prepareFromUri.");
            }
            try {
                mSessionBinder.prepareFromUri(mContext.getPackageName(), mCbStub, uri, extras);
                mSessionBinder.prepareFromUri(mContext.getPackageName(), uri, extras);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare(" + uri + ").", e);
            }
@@ -717,7 +715,7 @@ public final class MediaController {
         */
        public void play() {
            try {
                mSessionBinder.play(mContext.getPackageName(), mCbStub);
                mSessionBinder.play(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play.", e);
            }
@@ -736,8 +734,7 @@ public final class MediaController {
                        "You must specify a non-empty String for playFromMediaId.");
            }
            try {
                mSessionBinder.playFromMediaId(mContext.getPackageName(), mCbStub, mediaId,
                        extras);
                mSessionBinder.playFromMediaId(mContext.getPackageName(), mediaId, extras);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play(" + mediaId + ").", e);
            }
@@ -759,7 +756,7 @@ public final class MediaController {
                query = "";
            }
            try {
                mSessionBinder.playFromSearch(mContext.getPackageName(), mCbStub, query, extras);
                mSessionBinder.playFromSearch(mContext.getPackageName(), query, extras);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play(" + query + ").", e);
            }
@@ -778,7 +775,7 @@ public final class MediaController {
                        "You must specify a non-empty Uri for playFromUri.");
            }
            try {
                mSessionBinder.playFromUri(mContext.getPackageName(), mCbStub, uri, extras);
                mSessionBinder.playFromUri(mContext.getPackageName(), uri, extras);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play(" + uri + ").", e);
            }
@@ -790,7 +787,7 @@ public final class MediaController {
         */
        public void skipToQueueItem(long id) {
            try {
                mSessionBinder.skipToQueueItem(mContext.getPackageName(), mCbStub, id);
                mSessionBinder.skipToQueueItem(mContext.getPackageName(), id);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling skipToItem(" + id + ").", e);
            }
@@ -802,7 +799,7 @@ public final class MediaController {
         */
        public void pause() {
            try {
                mSessionBinder.pause(mContext.getPackageName(), mCbStub);
                mSessionBinder.pause(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling pause.", e);
            }
@@ -814,7 +811,7 @@ public final class MediaController {
         */
        public void stop() {
            try {
                mSessionBinder.stop(mContext.getPackageName(), mCbStub);
                mSessionBinder.stop(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling stop.", e);
            }
@@ -827,7 +824,7 @@ public final class MediaController {
         */
        public void seekTo(long pos) {
            try {
                mSessionBinder.seekTo(mContext.getPackageName(), mCbStub, pos);
                mSessionBinder.seekTo(mContext.getPackageName(), pos);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling seekTo.", e);
            }
@@ -839,7 +836,7 @@ public final class MediaController {
         */
        public void fastForward() {
            try {
                mSessionBinder.fastForward(mContext.getPackageName(), mCbStub);
                mSessionBinder.fastForward(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling fastForward.", e);
            }
@@ -850,7 +847,7 @@ public final class MediaController {
         */
        public void skipToNext() {
            try {
                mSessionBinder.next(mContext.getPackageName(), mCbStub);
                mSessionBinder.next(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling next.", e);
            }
@@ -862,7 +859,7 @@ public final class MediaController {
         */
        public void rewind() {
            try {
                mSessionBinder.rewind(mContext.getPackageName(), mCbStub);
                mSessionBinder.rewind(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling rewind.", e);
            }
@@ -873,7 +870,7 @@ public final class MediaController {
         */
        public void skipToPrevious() {
            try {
                mSessionBinder.previous(mContext.getPackageName(), mCbStub);
                mSessionBinder.previous(mContext.getPackageName());
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling previous.", e);
            }
@@ -888,7 +885,7 @@ public final class MediaController {
         */
        public void setRating(Rating rating) {
            try {
                mSessionBinder.rate(mContext.getPackageName(), mCbStub, rating);
                mSessionBinder.rate(mContext.getPackageName(), rating);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling rate.", e);
            }
@@ -906,7 +903,7 @@ public final class MediaController {
                throw new IllegalArgumentException("speed must not be zero");
            }
            try {
                mSessionBinder.setPlaybackSpeed(mContext.getPackageName(), mCbStub, speed);
                mSessionBinder.setPlaybackSpeed(mContext.getPackageName(), speed);
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling setPlaybackSpeed.", e);
            }
@@ -941,7 +938,7 @@ public final class MediaController {
                throw new IllegalArgumentException("CustomAction cannot be null.");
            }
            try {
                mSessionBinder.sendCustomAction(mContext.getPackageName(), mCbStub, action, args);
                mSessionBinder.sendCustomAction(mContext.getPackageName(), action, args);
            } catch (RemoteException e) {
                Log.d(TAG, "Dead object in sendCustomAction.", e);
            }
+25 −45

File changed.

Preview size limit exceeded, changes collapsed.

+107 −136

File changed.

Preview size limit exceeded, changes collapsed.

Loading