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
diff --git a/media/java/android/media/session/ISessionCallback.aidl b/media/java/android/media/session/ISessionCallback.aidl
index a294088d..30db8f0 100644
--- a/media/java/android/media/session/ISessionCallback.aidl
+++ b/media/java/android/media/session/ISessionCallback.aidl
@@ -17,7 +17,6 @@
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 @@
* @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);
}
diff --git a/media/java/android/media/session/ISessionController.aidl b/media/java/android/media/session/ISessionController.aidl
index e1039fd..183c7c3 100644
--- a/media/java/android/media/session/ISessionController.aidl
+++ b/media/java/android/media/session/ISessionController.aidl
@@ -36,10 +36,8 @@
* @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 @@
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();
diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java
index 646fc06..1812d9c 100644
--- a/media/java/android/media/session/MediaController.java
+++ b/media/java/android/media/session/MediaController.java
@@ -131,7 +131,7 @@
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 @@
// 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 @@
// 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 @@
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 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 @@
"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 @@
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 @@
"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 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 @@
"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 @@
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 @@
"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 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 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 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 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 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 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 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 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 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 @@
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 @@
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);
}
diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java
index 5db4e8c..3adee59 100644
--- a/media/java/android/media/session/MediaSession.java
+++ b/media/java/android/media/session/MediaSession.java
@@ -1159,8 +1159,8 @@
}
@Override
- public void onCommand(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String command, Bundle args, ResultReceiver cb) {
+ public void onCommand(String packageName, int pid, int uid, String command, Bundle args,
+ ResultReceiver cb) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchCommand(createRemoteUserInfo(packageName, pid, uid),
@@ -1186,7 +1186,7 @@
@Override
public void onMediaButtonFromController(String packageName, int pid, int uid,
- ISessionControllerCallback caller, Intent mediaButtonIntent) {
+ Intent mediaButtonIntent) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchMediaButton(createRemoteUserInfo(packageName, pid, uid),
@@ -1195,8 +1195,7 @@
}
@Override
- public void onPrepare(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onPrepare(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchPrepare(createRemoteUserInfo(packageName, pid, uid));
@@ -1204,8 +1203,7 @@
}
@Override
- public void onPrepareFromMediaId(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String mediaId,
+ public void onPrepareFromMediaId(String packageName, int pid, int uid, String mediaId,
Bundle extras) {
MediaSession session = mMediaSession.get();
if (session != null) {
@@ -1215,8 +1213,7 @@
}
@Override
- public void onPrepareFromSearch(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String query,
+ public void onPrepareFromSearch(String packageName, int pid, int uid, String query,
Bundle extras) {
MediaSession session = mMediaSession.get();
if (session != null) {
@@ -1226,8 +1223,7 @@
}
@Override
- public void onPrepareFromUri(String packageName, int pid, int uid,
- ISessionControllerCallback caller, Uri uri, Bundle extras) {
+ public void onPrepareFromUri(String packageName, int pid, int uid, Uri uri, Bundle extras) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchPrepareFromUri(createRemoteUserInfo(packageName, pid, uid),
@@ -1236,8 +1232,7 @@
}
@Override
- public void onPlay(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onPlay(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchPlay(createRemoteUserInfo(packageName, pid, uid));
@@ -1245,8 +1240,7 @@
}
@Override
- public void onPlayFromMediaId(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String mediaId,
+ public void onPlayFromMediaId(String packageName, int pid, int uid, String mediaId,
Bundle extras) {
MediaSession session = mMediaSession.get();
if (session != null) {
@@ -1256,8 +1250,7 @@
}
@Override
- public void onPlayFromSearch(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String query,
+ public void onPlayFromSearch(String packageName, int pid, int uid, String query,
Bundle extras) {
MediaSession session = mMediaSession.get();
if (session != null) {
@@ -1267,8 +1260,7 @@
}
@Override
- public void onPlayFromUri(String packageName, int pid, int uid,
- ISessionControllerCallback caller, Uri uri, Bundle extras) {
+ public void onPlayFromUri(String packageName, int pid, int uid, Uri uri, Bundle extras) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchPlayFromUri(createRemoteUserInfo(packageName, pid, uid),
@@ -1277,8 +1269,7 @@
}
@Override
- public void onSkipToTrack(String packageName, int pid, int uid,
- ISessionControllerCallback caller, long id) {
+ public void onSkipToTrack(String packageName, int pid, int uid, long id) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchSkipToItem(createRemoteUserInfo(packageName, pid, uid), id);
@@ -1286,8 +1277,7 @@
}
@Override
- public void onPause(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onPause(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchPause(createRemoteUserInfo(packageName, pid, uid));
@@ -1295,8 +1285,7 @@
}
@Override
- public void onStop(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onStop(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchStop(createRemoteUserInfo(packageName, pid, uid));
@@ -1304,8 +1293,7 @@
}
@Override
- public void onNext(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onNext(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchNext(createRemoteUserInfo(packageName, pid, uid));
@@ -1313,8 +1301,7 @@
}
@Override
- public void onPrevious(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onPrevious(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchPrevious(createRemoteUserInfo(packageName, pid, uid));
@@ -1322,8 +1309,7 @@
}
@Override
- public void onFastForward(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onFastForward(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchFastForward(createRemoteUserInfo(packageName, pid, uid));
@@ -1331,8 +1317,7 @@
}
@Override
- public void onRewind(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void onRewind(String packageName, int pid, int uid) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchRewind(createRemoteUserInfo(packageName, pid, uid));
@@ -1340,8 +1325,7 @@
}
@Override
- public void onSeekTo(String packageName, int pid, int uid,
- ISessionControllerCallback caller, long pos) {
+ public void onSeekTo(String packageName, int pid, int uid, long pos) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchSeekTo(createRemoteUserInfo(packageName, pid, uid), pos);
@@ -1349,8 +1333,7 @@
}
@Override
- public void onRate(String packageName, int pid, int uid, ISessionControllerCallback caller,
- Rating rating) {
+ public void onRate(String packageName, int pid, int uid, Rating rating) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchRate(createRemoteUserInfo(packageName, pid, uid), rating);
@@ -1358,8 +1341,7 @@
}
@Override
- public void onSetPlaybackSpeed(String packageName, int pid, int uid,
- ISessionControllerCallback caller, float speed) {
+ public void onSetPlaybackSpeed(String packageName, int pid, int uid, float speed) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchSetPlaybackSpeed(
@@ -1368,8 +1350,8 @@
}
@Override
- public void onCustomAction(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String action, Bundle args) {
+ public void onCustomAction(String packageName, int pid, int uid, String action,
+ Bundle args) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchCustomAction(createRemoteUserInfo(packageName, pid, uid),
@@ -1378,8 +1360,7 @@
}
@Override
- public void onAdjustVolume(String packageName, int pid, int uid,
- ISessionControllerCallback caller, int direction) {
+ public void onAdjustVolume(String packageName, int pid, int uid, int direction) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchAdjustVolume(createRemoteUserInfo(packageName, pid, uid),
@@ -1388,8 +1369,7 @@
}
@Override
- public void onSetVolumeTo(String packageName, int pid, int uid,
- ISessionControllerCallback caller, int value) {
+ public void onSetVolumeTo(String packageName, int pid, int uid, int value) {
MediaSession session = mMediaSession.get();
if (session != null) {
session.dispatchSetVolumeTo(createRemoteUserInfo(packageName, pid, uid),
diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java
index 0aee850..efc7d6f 100644
--- a/services/core/java/com/android/server/media/MediaSessionRecord.java
+++ b/services/core/java/com/android/server/media/MediaSessionRecord.java
@@ -265,8 +265,7 @@
* @param useSuggested True to use adjustSuggestedStreamVolume instead of
*/
public void adjustVolume(String packageName, String opPackageName, int pid, int uid,
- ISessionControllerCallback caller, boolean asSystemService, int direction, int flags,
- boolean useSuggested) {
+ boolean asSystemService, int direction, int flags, boolean useSuggested) {
int previousFlagPlaySound = flags & AudioManager.FLAG_PLAY_SOUND;
if (isPlaybackActive() || hasFlag(MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY)) {
flags &= ~AudioManager.FLAG_PLAY_SOUND;
@@ -291,7 +290,7 @@
Log.w(TAG, "adjusting volume, pkg=" + packageName + ", asSystemService="
+ asSystemService + ", dir=" + direction);
}
- mSessionCb.adjustVolume(packageName, pid, uid, caller, asSystemService, direction);
+ mSessionCb.adjustVolume(packageName, pid, uid, asSystemService, direction);
int volumeBefore = (mOptimisticVolume < 0 ? mCurrentVolume : mOptimisticVolume);
mOptimisticVolume = volumeBefore + direction;
@@ -310,8 +309,8 @@
}
}
- private void setVolumeTo(String packageName, String opPackageName, int pid, int uid,
- ISessionControllerCallback caller, int value, int flags) {
+ private void setVolumeTo(String packageName, String opPackageName, int pid, int uid, int value,
+ int flags) {
if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_LOCAL) {
int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs);
final int volumeValue = value;
@@ -333,7 +332,7 @@
return;
}
value = Math.max(0, Math.min(value, mMaxVolume));
- mSessionCb.setVolumeTo(packageName, pid, uid, caller, value);
+ mSessionCb.setVolumeTo(packageName, pid, uid, value);
int volumeBefore = (mOptimisticVolume < 0 ? mCurrentVolume : mOptimisticVolume);
mOptimisticVolume = Math.max(0, Math.min(value, mMaxVolume));
@@ -1009,14 +1008,13 @@
}
public boolean sendMediaButton(String packageName, int pid, int uid,
- ISessionControllerCallback caller, boolean asSystemService,
- KeyEvent keyEvent) {
+ boolean asSystemService, KeyEvent keyEvent) {
try {
if (asSystemService) {
mCb.onMediaButton(mContext.getPackageName(), Process.myPid(),
Process.SYSTEM_UID, createMediaButtonIntent(keyEvent), 0, null);
} else {
- mCb.onMediaButtonFromController(packageName, pid, uid, caller,
+ mCb.onMediaButtonFromController(packageName, pid, uid,
createMediaButtonIntent(keyEvent));
}
return true;
@@ -1026,201 +1024,189 @@
return false;
}
- public void sendCommand(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String command, Bundle args, ResultReceiver cb) {
+ public void sendCommand(String packageName, int pid, int uid, String command, Bundle args,
+ ResultReceiver cb) {
try {
- mCb.onCommand(packageName, pid, uid, caller, command, args, cb);
+ mCb.onCommand(packageName, pid, uid, command, args, cb);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in sendCommand.", e);
}
}
- public void sendCustomAction(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String action,
+ public void sendCustomAction(String packageName, int pid, int uid, String action,
Bundle args) {
try {
- mCb.onCustomAction(packageName, pid, uid, caller, action, args);
+ mCb.onCustomAction(packageName, pid, uid, action, args);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in sendCustomAction.", e);
}
}
- public void prepare(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void prepare(String packageName, int pid, int uid) {
try {
- mCb.onPrepare(packageName, pid, uid, caller);
+ mCb.onPrepare(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in prepare.", e);
}
}
- public void prepareFromMediaId(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String mediaId, Bundle extras) {
+ public void prepareFromMediaId(String packageName, int pid, int uid, String mediaId,
+ Bundle extras) {
try {
- mCb.onPrepareFromMediaId(packageName, pid, uid, caller, mediaId, extras);
+ mCb.onPrepareFromMediaId(packageName, pid, uid, mediaId, extras);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in prepareFromMediaId.", e);
}
}
- public void prepareFromSearch(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String query, Bundle extras) {
+ public void prepareFromSearch(String packageName, int pid, int uid, String query,
+ Bundle extras) {
try {
- mCb.onPrepareFromSearch(packageName, pid, uid, caller, query, extras);
+ mCb.onPrepareFromSearch(packageName, pid, uid, query, extras);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in prepareFromSearch.", e);
}
}
- public void prepareFromUri(String packageName, int pid, int uid,
- ISessionControllerCallback caller, Uri uri, Bundle extras) {
+ public void prepareFromUri(String packageName, int pid, int uid, Uri uri, Bundle extras) {
try {
- mCb.onPrepareFromUri(packageName, pid, uid, caller, uri, extras);
+ mCb.onPrepareFromUri(packageName, pid, uid, uri, extras);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in prepareFromUri.", e);
}
}
- public void play(String packageName, int pid, int uid, ISessionControllerCallback caller) {
+ public void play(String packageName, int pid, int uid) {
try {
- mCb.onPlay(packageName, pid, uid, caller);
+ mCb.onPlay(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in play.", e);
}
}
- public void playFromMediaId(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String mediaId, Bundle extras) {
+ public void playFromMediaId(String packageName, int pid, int uid, String mediaId,
+ Bundle extras) {
try {
- mCb.onPlayFromMediaId(packageName, pid, uid, caller, mediaId, extras);
+ mCb.onPlayFromMediaId(packageName, pid, uid, mediaId, extras);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in playFromMediaId.", e);
}
}
- public void playFromSearch(String packageName, int pid, int uid,
- ISessionControllerCallback caller, String query, Bundle extras) {
+ public void playFromSearch(String packageName, int pid, int uid, String query,
+ Bundle extras) {
try {
- mCb.onPlayFromSearch(packageName, pid, uid, caller, query, extras);
+ mCb.onPlayFromSearch(packageName, pid, uid, query, extras);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in playFromSearch.", e);
}
}
- public void playFromUri(String packageName, int pid, int uid,
- ISessionControllerCallback caller, Uri uri, Bundle extras) {
+ public void playFromUri(String packageName, int pid, int uid, Uri uri, Bundle extras) {
try {
- mCb.onPlayFromUri(packageName, pid, uid, caller, uri, extras);
+ mCb.onPlayFromUri(packageName, pid, uid, uri, extras);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in playFromUri.", e);
}
}
- public void skipToTrack(String packageName, int pid, int uid,
- ISessionControllerCallback caller, long id) {
+ public void skipToTrack(String packageName, int pid, int uid, long id) {
try {
- mCb.onSkipToTrack(packageName, pid, uid, caller, id);
+ mCb.onSkipToTrack(packageName, pid, uid, id);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in skipToTrack", e);
}
}
- public void pause(String packageName, int pid, int uid, ISessionControllerCallback caller) {
+ public void pause(String packageName, int pid, int uid) {
try {
- mCb.onPause(packageName, pid, uid, caller);
+ mCb.onPause(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in pause.", e);
}
}
- public void stop(String packageName, int pid, int uid, ISessionControllerCallback caller) {
+ public void stop(String packageName, int pid, int uid) {
try {
- mCb.onStop(packageName, pid, uid, caller);
+ mCb.onStop(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in stop.", e);
}
}
- public void next(String packageName, int pid, int uid, ISessionControllerCallback caller) {
+ public void next(String packageName, int pid, int uid) {
try {
- mCb.onNext(packageName, pid, uid, caller);
+ mCb.onNext(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in next.", e);
}
}
- public void previous(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void previous(String packageName, int pid, int uid) {
try {
- mCb.onPrevious(packageName, pid, uid, caller);
+ mCb.onPrevious(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in previous.", e);
}
}
- public void fastForward(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void fastForward(String packageName, int pid, int uid) {
try {
- mCb.onFastForward(packageName, pid, uid, caller);
+ mCb.onFastForward(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in fastForward.", e);
}
}
- public void rewind(String packageName, int pid, int uid,
- ISessionControllerCallback caller) {
+ public void rewind(String packageName, int pid, int uid) {
try {
- mCb.onRewind(packageName, pid, uid, caller);
+ mCb.onRewind(packageName, pid, uid);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in rewind.", e);
}
}
- public void seekTo(String packageName, int pid, int uid, ISessionControllerCallback caller,
- long pos) {
+ public void seekTo(String packageName, int pid, int uid, long pos) {
try {
- mCb.onSeekTo(packageName, pid, uid, caller, pos);
+ mCb.onSeekTo(packageName, pid, uid, pos);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in seekTo.", e);
}
}
- public void rate(String packageName, int pid, int uid, ISessionControllerCallback caller,
- Rating rating) {
+ public void rate(String packageName, int pid, int uid, Rating rating) {
try {
- mCb.onRate(packageName, pid, uid, caller, rating);
+ mCb.onRate(packageName, pid, uid, rating);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in rate.", e);
}
}
- public void setPlaybackSpeed(String packageName, int pid, int uid,
- ISessionControllerCallback caller, float speed) {
+ public void setPlaybackSpeed(String packageName, int pid, int uid, float speed) {
try {
- mCb.onSetPlaybackSpeed(packageName, pid, uid, caller, speed);
+ mCb.onSetPlaybackSpeed(packageName, pid, uid, speed);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in setPlaybackSpeed.", e);
}
}
- public void adjustVolume(String packageName, int pid, int uid,
- ISessionControllerCallback caller, boolean asSystemService, int direction) {
+ public void adjustVolume(String packageName, int pid, int uid, boolean asSystemService,
+ int direction) {
try {
if (asSystemService) {
mCb.onAdjustVolume(mContext.getPackageName(), Process.myPid(),
- Process.SYSTEM_UID, null, direction);
+ Process.SYSTEM_UID, direction);
} else {
- mCb.onAdjustVolume(packageName, pid, uid, caller, direction);
+ mCb.onAdjustVolume(packageName, pid, uid, direction);
}
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in adjustVolume.", e);
}
}
- public void setVolumeTo(String packageName, int pid, int uid,
- ISessionControllerCallback caller, int value) {
+ public void setVolumeTo(String packageName, int pid, int uid, int value) {
try {
- mCb.onSetVolumeTo(packageName, pid, uid, caller, value);
+ mCb.onSetVolumeTo(packageName, pid, uid, value);
} catch (RemoteException e) {
Slog.e(TAG, "Remote failure in setVolumeTo.", e);
}
@@ -1235,17 +1221,16 @@
class ControllerStub extends ISessionController.Stub {
@Override
- public void sendCommand(String packageName, ISessionControllerCallback caller,
- String command, Bundle args, ResultReceiver cb) {
+ public void sendCommand(String packageName, String command, Bundle args,
+ ResultReceiver cb) {
mSessionCb.sendCommand(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, command, args, cb);
+ command, args, cb);
}
@Override
- public boolean sendMediaButton(String packageName, ISessionControllerCallback cb,
- KeyEvent keyEvent) {
+ public boolean sendMediaButton(String packageName, KeyEvent keyEvent) {
return mSessionCb.sendMediaButton(packageName, Binder.getCallingPid(),
- Binder.getCallingUid(), cb, false, keyEvent);
+ Binder.getCallingUid(), false, keyEvent);
}
@Override
@@ -1316,13 +1301,13 @@
}
@Override
- public void adjustVolume(String packageName, String opPackageName,
- ISessionControllerCallback caller, int direction, int flags) {
+ public void adjustVolume(String packageName, String opPackageName, int direction,
+ int flags) {
int pid = Binder.getCallingPid();
int uid = Binder.getCallingUid();
final long token = Binder.clearCallingIdentity();
try {
- MediaSessionRecord.this.adjustVolume(packageName, opPackageName, pid, uid, caller,
+ MediaSessionRecord.this.adjustVolume(packageName, opPackageName, pid, uid,
false, direction, flags, false /* useSuggested */);
} finally {
Binder.restoreCallingIdentity(token);
@@ -1330,134 +1315,120 @@
}
@Override
- public void setVolumeTo(String packageName, String opPackageName,
- ISessionControllerCallback caller, int value, int flags) {
+ public void setVolumeTo(String packageName, String opPackageName, int value, int flags) {
int pid = Binder.getCallingPid();
int uid = Binder.getCallingUid();
final long token = Binder.clearCallingIdentity();
try {
- MediaSessionRecord.this.setVolumeTo(packageName, opPackageName, pid, uid, caller,
- value, flags);
+ MediaSessionRecord.this.setVolumeTo(packageName, opPackageName, pid, uid, value,
+ flags);
} finally {
Binder.restoreCallingIdentity(token);
}
}
@Override
- public void prepare(String packageName, ISessionControllerCallback caller) {
- mSessionCb.prepare(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
+ public void prepare(String packageName) {
+ mSessionCb.prepare(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void prepareFromMediaId(String packageName, ISessionControllerCallback caller,
- String mediaId, Bundle extras) {
+ public void prepareFromMediaId(String packageName, String mediaId, Bundle extras) {
mSessionCb.prepareFromMediaId(packageName, Binder.getCallingPid(),
- Binder.getCallingUid(), caller, mediaId, extras);
+ Binder.getCallingUid(), mediaId, extras);
}
@Override
- public void prepareFromSearch(String packageName, ISessionControllerCallback caller,
- String query, Bundle extras) {
+ public void prepareFromSearch(String packageName, String query, Bundle extras) {
mSessionCb.prepareFromSearch(packageName, Binder.getCallingPid(),
- Binder.getCallingUid(), caller, query, extras);
+ Binder.getCallingUid(), query, extras);
}
@Override
- public void prepareFromUri(String packageName, ISessionControllerCallback caller,
- Uri uri, Bundle extras) {
+ public void prepareFromUri(String packageName, Uri uri, Bundle extras) {
mSessionCb.prepareFromUri(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, uri, extras);
+ uri, extras);
}
@Override
- public void play(String packageName, ISessionControllerCallback caller) {
- mSessionCb.play(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
+ public void play(String packageName) {
+ mSessionCb.play(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void playFromMediaId(String packageName, ISessionControllerCallback caller,
- String mediaId, Bundle extras) {
+ public void playFromMediaId(String packageName, String mediaId, Bundle extras) {
mSessionCb.playFromMediaId(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, mediaId, extras);
+ mediaId, extras);
}
@Override
- public void playFromSearch(String packageName, ISessionControllerCallback caller,
- String query, Bundle extras) {
+ public void playFromSearch(String packageName, String query, Bundle extras) {
mSessionCb.playFromSearch(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, query, extras);
+ query, extras);
}
@Override
- public void playFromUri(String packageName, ISessionControllerCallback caller,
- Uri uri, Bundle extras) {
+ public void playFromUri(String packageName, Uri uri, Bundle extras) {
mSessionCb.playFromUri(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, uri, extras);
+ uri, extras);
}
@Override
- public void skipToQueueItem(String packageName, ISessionControllerCallback caller,
- long id) {
- mSessionCb.skipToTrack(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, id);
+ public void skipToQueueItem(String packageName, long id) {
+ mSessionCb.skipToTrack(packageName, Binder.getCallingPid(), Binder.getCallingUid(), id);
}
@Override
- public void pause(String packageName, ISessionControllerCallback caller) {
- mSessionCb.pause(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
+ public void pause(String packageName) {
+ mSessionCb.pause(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void stop(String packageName, ISessionControllerCallback caller) {
- mSessionCb.stop(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
+ public void stop(String packageName) {
+ mSessionCb.stop(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void next(String packageName, ISessionControllerCallback caller) {
- mSessionCb.next(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
+ public void next(String packageName) {
+ mSessionCb.next(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void previous(String packageName, ISessionControllerCallback caller) {
- mSessionCb.previous(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller);
+ public void previous(String packageName) {
+ mSessionCb.previous(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void fastForward(String packageName, ISessionControllerCallback caller) {
- mSessionCb.fastForward(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller);
+ public void fastForward(String packageName) {
+ mSessionCb.fastForward(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void rewind(String packageName, ISessionControllerCallback caller) {
- mSessionCb.rewind(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
+ public void rewind(String packageName) {
+ mSessionCb.rewind(packageName, Binder.getCallingPid(), Binder.getCallingUid());
}
@Override
- public void seekTo(String packageName, ISessionControllerCallback caller, long pos) {
- mSessionCb.seekTo(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller,
- pos);
+ public void seekTo(String packageName, long pos) {
+ mSessionCb.seekTo(packageName, Binder.getCallingPid(), Binder.getCallingUid(), pos);
}
@Override
- public void rate(String packageName, ISessionControllerCallback caller, Rating rating) {
- mSessionCb.rate(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller,
- rating);
+ public void rate(String packageName, Rating rating) {
+ mSessionCb.rate(packageName, Binder.getCallingPid(), Binder.getCallingUid(), rating);
}
@Override
- public void setPlaybackSpeed(String packageName, ISessionControllerCallback caller,
+ public void setPlaybackSpeed(String packageName,
float speed) {
mSessionCb.setPlaybackSpeed(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, speed);
+ speed);
}
@Override
- public void sendCustomAction(String packageName, ISessionControllerCallback caller,
- String action, Bundle args) {
+ public void sendCustomAction(String packageName, String action, Bundle args) {
mSessionCb.sendCustomAction(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
- caller, action, args);
+ action, args);
}
@Override
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index 99fdf6b..2986dee 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -1836,7 +1836,7 @@
break;
}
record.adjustVolume(packageName, opPackageName, pid, uid,
- null /* caller */, true /* asSystemService */, direction,
+ true /* asSystemService */, direction,
AudioManager.FLAG_SHOW_UI, false /* useSuggested */);
break;
}
@@ -1846,8 +1846,7 @@
AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_VIBRATE
| AudioManager.FLAG_FROM_KEY;
record.adjustVolume(packageName, opPackageName, pid, uid,
- null /* caller */, true /* asSystemService */, 0,
- flags, false /* useSuggested */);
+ true /* asSystemService */, 0, flags, false /* useSuggested */);
}
}
}
@@ -2081,7 +2080,7 @@
+ flags + ", suggestedStream=" + suggestedStream
+ ", preferSuggestedStream=" + preferSuggestedStream);
}
- session.adjustVolume(packageName, opPackageName, pid, uid, null, asSystemService,
+ session.adjustVolume(packageName, opPackageName, pid, uid, asSystemService,
direction, flags, true);
}
}