Remove ControllerCallbackLink
Bug: 129323028
Test: atest CtsMediaTestCases:android.media.cts.MediaSessionTest;
atest CtsMediaTestCases:android.media.cts.MediaControllerTest;
atest CtsMediaTestCases:android.media.cts.MediaBrowserTest;
atest CtsMediaTestCases:android.media.cts.MediaSessionManagerTest;
Change-Id: I5b1fedc70cee7311364925562ad253a68b2bfe6e
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.media.session;
|
||||
|
||||
parcelable ControllerCallbackLink;
|
||||
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.media.session;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.MediaMetadata;
|
||||
import android.media.MediaParceledListSlice;
|
||||
import android.media.session.MediaController.PlaybackInfo;
|
||||
import android.media.session.MediaSession.QueueItem;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles incoming commands to {@link MediaController.Callback}.
|
||||
* @hide
|
||||
*/
|
||||
public final class ControllerCallbackLink implements Parcelable {
|
||||
final Context mContext;
|
||||
final CallbackStub mCallbackStub;
|
||||
final ISessionControllerCallback mIControllerCallback;
|
||||
|
||||
/**
|
||||
* Constructor for stub (Callee)
|
||||
*/
|
||||
public ControllerCallbackLink(@NonNull Context context, @NonNull CallbackStub callbackStub) {
|
||||
mContext = context;
|
||||
mCallbackStub = callbackStub;
|
||||
mIControllerCallback = new CallbackStubProxy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for interface (Caller)
|
||||
*/
|
||||
public ControllerCallbackLink(IBinder binder) {
|
||||
mContext = null;
|
||||
mCallbackStub = null;
|
||||
mIControllerCallback = ISessionControllerCallback.Stub.asInterface(binder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the connected session is destroyed.
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifySessionDestroyed() {
|
||||
try {
|
||||
mIControllerCallback.notifySessionDestroyed();
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the connected session sends an event.
|
||||
*
|
||||
* @param event the name of the event
|
||||
* @param extras the extras included with the event
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyEvent(@NonNull String event, @Nullable Bundle extras) {
|
||||
try {
|
||||
mIControllerCallback.notifyEvent(event, extras);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the current playback state is changed.
|
||||
*
|
||||
* @param state the new playback state
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyPlaybackStateChanged(@Nullable PlaybackState state) {
|
||||
try {
|
||||
mIControllerCallback.notifyPlaybackStateChanged(state);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the current metadata is changed.
|
||||
*
|
||||
* @param metadata the new metadata
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyMetadataChanged(@Nullable MediaMetadata metadata) {
|
||||
try {
|
||||
mIControllerCallback.notifyMetadataChanged(metadata);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the current queue is changed.
|
||||
*
|
||||
* @param queue the new queue
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyQueueChanged(@Nullable List<QueueItem> queue) {
|
||||
try {
|
||||
mIControllerCallback.notifyQueueChanged(queue == null ? null :
|
||||
new MediaParceledListSlice(queue));
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the current queue title is changed.
|
||||
*
|
||||
* @param title the new queue title
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyQueueTitleChanged(@Nullable CharSequence title) {
|
||||
try {
|
||||
mIControllerCallback.notifyQueueTitleChanged(title);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the extras are changed.
|
||||
*
|
||||
* @param extras the new extras
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyExtrasChanged(@Nullable Bundle extras) {
|
||||
try {
|
||||
mIControllerCallback.notifyExtrasChanged(extras);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify controller that the playback info is changed.
|
||||
*
|
||||
* @param info the new playback info
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
public void notifyVolumeInfoChanged(@NonNull PlaybackInfo info) {
|
||||
try {
|
||||
mIControllerCallback.notifyVolumeInfoChanged(info);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets the binder */
|
||||
@NonNull
|
||||
public IBinder getBinder() {
|
||||
return mIControllerCallback.asBinder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeStrongBinder(mIControllerCallback.asBinder());
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<ControllerCallbackLink> CREATOR =
|
||||
new Parcelable.Creator<ControllerCallbackLink>() {
|
||||
@Override
|
||||
public ControllerCallbackLink createFromParcel(Parcel in) {
|
||||
return new ControllerCallbackLink(in.readStrongBinder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ControllerCallbackLink[] newArray(int size) {
|
||||
return new ControllerCallbackLink[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Class for Stub implementation
|
||||
*/
|
||||
public abstract static class CallbackStub {
|
||||
/** Stub method for ISessionControllerCallback.notifySessionDestroyed */
|
||||
public void onSessionDestroyed() {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyEvent */
|
||||
public void onEvent(@NonNull String event, @Nullable Bundle extras) {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyPlaybackStateChanged */
|
||||
public void onPlaybackStateChanged(@Nullable PlaybackState state) {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyMetadataChanged */
|
||||
public void onMetadataChanged(@Nullable MediaMetadata metadata) {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyQueueChanged */
|
||||
public void onQueueChanged(@Nullable List<QueueItem> queue) {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyQueueTitleChanged */
|
||||
public void onQueueTitleChanged(@Nullable CharSequence title) {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyExtrasChanged */
|
||||
public void onExtrasChanged(@Nullable Bundle extras) {
|
||||
}
|
||||
|
||||
/** Stub method for ISessionControllerCallback.notifyVolumeInfoChanged */
|
||||
public void onVolumeInfoChanged(@NonNull PlaybackInfo info) {
|
||||
}
|
||||
}
|
||||
|
||||
private class CallbackStubProxy extends ISessionControllerCallback.Stub {
|
||||
@Override
|
||||
public void notifyEvent(String event, Bundle extras) {
|
||||
mCallbackStub.onEvent(event, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifySessionDestroyed() {
|
||||
mCallbackStub.onSessionDestroyed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPlaybackStateChanged(PlaybackState state) {
|
||||
ensureMediaControlPermission();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mCallbackStub.onPlaybackStateChanged(state);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyMetadataChanged(MediaMetadata metadata) {
|
||||
ensureMediaControlPermission();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mCallbackStub.onMetadataChanged(metadata);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyQueueChanged(MediaParceledListSlice queue) {
|
||||
ensureMediaControlPermission();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mCallbackStub.onQueueChanged(queue == null ? null : queue.getList());
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyQueueTitleChanged(CharSequence title) {
|
||||
ensureMediaControlPermission();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mCallbackStub.onQueueTitleChanged(title);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyExtrasChanged(Bundle extras) {
|
||||
mCallbackStub.onExtrasChanged(extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyVolumeInfoChanged(PlaybackInfo info) {
|
||||
ensureMediaControlPermission();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mCallbackStub.onVolumeInfoChanged(info);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureMediaControlPermission() {
|
||||
// Check if it's system server or has MEDIA_CONTENT_CONTROL.
|
||||
// Note that system server doesn't have MEDIA_CONTENT_CONTROL, so we need extra
|
||||
// check here.
|
||||
if (getCallingUid() == Process.SYSTEM_UID || mContext.checkCallingPermission(
|
||||
android.Manifest.permission.MEDIA_CONTENT_CONTROL)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
throw new SecurityException("Must hold the MEDIA_CONTENT_CONTROL permission.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ package android.media.session;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.media.Rating;
|
||||
import android.media.session.ControllerCallbackLink;
|
||||
import android.media.session.ISessionControllerCallback;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
@@ -26,48 +26,48 @@ import android.os.ResultReceiver;
|
||||
* @hide
|
||||
*/
|
||||
oneway interface ISessionCallback {
|
||||
void onCommand(String packageName, int pid, int uid, in ControllerCallbackLink caller,
|
||||
void onCommand(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
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,
|
||||
in ControllerCallbackLink caller, in Intent mediaButtonIntent);
|
||||
ISessionControllerCallback caller, in Intent mediaButtonIntent);
|
||||
|
||||
// These callbacks are for the TransportControls
|
||||
void onPrepare(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onPrepare(String packageName, int pid, int uid, ISessionControllerCallback caller);
|
||||
void onPrepareFromMediaId(String packageName, int pid, int uid,
|
||||
in ControllerCallbackLink caller, String mediaId, in Bundle extras);
|
||||
ISessionControllerCallback caller, String mediaId, in Bundle extras);
|
||||
void onPrepareFromSearch(String packageName, int pid, int uid,
|
||||
in ControllerCallbackLink caller, String query, in Bundle extras);
|
||||
ISessionControllerCallback caller, String query, in Bundle extras);
|
||||
void onPrepareFromUri(String packageName, int pid, int uid,
|
||||
in ControllerCallbackLink caller, in Uri uri, in Bundle extras);
|
||||
void onPlay(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
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,
|
||||
in ControllerCallbackLink caller, String mediaId, in Bundle extras);
|
||||
ISessionControllerCallback caller, String mediaId, in Bundle extras);
|
||||
void onPlayFromSearch(String packageName, int pid, int uid,
|
||||
in ControllerCallbackLink caller, String query, in Bundle extras);
|
||||
void onPlayFromUri(String packageName, int pid, int uid, in ControllerCallbackLink caller,
|
||||
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, in ControllerCallbackLink caller,
|
||||
void onSkipToTrack(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
long id);
|
||||
void onPause(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onStop(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onNext(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onPrevious(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onFastForward(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onRewind(String packageName, int pid, int uid, in ControllerCallbackLink caller);
|
||||
void onSeekTo(String packageName, int pid, int uid, in ControllerCallbackLink caller,
|
||||
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, in ControllerCallbackLink caller,
|
||||
void onRate(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
in Rating rating);
|
||||
void onSetPlaybackSpeed(String packageName, int pid, int uid,
|
||||
in ControllerCallbackLink caller, float speed);
|
||||
void onCustomAction(String packageName, int pid, int uid, in ControllerCallbackLink caller,
|
||||
ISessionControllerCallback caller, float speed);
|
||||
void onCustomAction(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
String action, in Bundle args);
|
||||
|
||||
// These callbacks are for volume handling
|
||||
void onAdjustVolume(String packageName, int pid, int uid, in ControllerCallbackLink caller,
|
||||
void onAdjustVolume(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
int direction);
|
||||
void onSetVolumeTo(String packageName, int pid, int uid,
|
||||
in ControllerCallbackLink caller, int value);
|
||||
ISessionControllerCallback caller, int value);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Intent;
|
||||
import android.media.MediaMetadata;
|
||||
import android.media.MediaParceledListSlice;
|
||||
import android.media.Rating;
|
||||
import android.media.session.ControllerCallbackLink;
|
||||
import android.media.session.ISessionControllerCallback;
|
||||
import android.media.session.MediaController;
|
||||
import android.media.session.MediaSession;
|
||||
import android.media.session.PlaybackState;
|
||||
@@ -36,12 +36,12 @@ import java.util.List;
|
||||
* @hide
|
||||
*/
|
||||
interface ISessionController {
|
||||
void sendCommand(String packageName, in ControllerCallbackLink caller,
|
||||
void sendCommand(String packageName, in ISessionControllerCallback caller,
|
||||
String command, in Bundle args, in ResultReceiver cb);
|
||||
boolean sendMediaButton(String packageName, in ControllerCallbackLink caller,
|
||||
boolean sendMediaButton(String packageName, in ISessionControllerCallback caller,
|
||||
in KeyEvent mediaButton);
|
||||
void registerCallback(String packageName, in ControllerCallbackLink cb);
|
||||
void unregisterCallback(in ControllerCallbackLink cb);
|
||||
void registerCallback(String packageName, in ISessionControllerCallback cb);
|
||||
void unregisterCallback(in ISessionControllerCallback cb);
|
||||
String getPackageName();
|
||||
String getTag();
|
||||
Bundle getSessionInfo();
|
||||
@@ -49,36 +49,36 @@ interface ISessionController {
|
||||
long getFlags();
|
||||
MediaController.PlaybackInfo getVolumeAttributes();
|
||||
void adjustVolume(String packageName, String opPackageName,
|
||||
in ControllerCallbackLink caller, int direction, int flags);
|
||||
void setVolumeTo(String packageName, String opPackageName, in ControllerCallbackLink caller,
|
||||
in ISessionControllerCallback caller, int direction, int flags);
|
||||
void setVolumeTo(String packageName, String opPackageName, in ISessionControllerCallback caller,
|
||||
int value, int flags);
|
||||
|
||||
// These commands are for the TransportControls
|
||||
void prepare(String packageName, in ControllerCallbackLink caller);
|
||||
void prepareFromMediaId(String packageName, in ControllerCallbackLink caller,
|
||||
void prepare(String packageName, in ISessionControllerCallback caller);
|
||||
void prepareFromMediaId(String packageName, in ISessionControllerCallback caller,
|
||||
String mediaId, in Bundle extras);
|
||||
void prepareFromSearch(String packageName, in ControllerCallbackLink caller,
|
||||
void prepareFromSearch(String packageName, in ISessionControllerCallback caller,
|
||||
String string, in Bundle extras);
|
||||
void prepareFromUri(String packageName, in ControllerCallbackLink caller,
|
||||
void prepareFromUri(String packageName, in ISessionControllerCallback caller,
|
||||
in Uri uri, in Bundle extras);
|
||||
void play(String packageName, in ControllerCallbackLink caller);
|
||||
void playFromMediaId(String packageName, in ControllerCallbackLink caller,
|
||||
void play(String packageName, in ISessionControllerCallback caller);
|
||||
void playFromMediaId(String packageName, in ISessionControllerCallback caller,
|
||||
String mediaId, in Bundle extras);
|
||||
void playFromSearch(String packageName, in ControllerCallbackLink caller,
|
||||
void playFromSearch(String packageName, in ISessionControllerCallback caller,
|
||||
String string, in Bundle extras);
|
||||
void playFromUri(String packageName, in ControllerCallbackLink caller,
|
||||
void playFromUri(String packageName, in ISessionControllerCallback caller,
|
||||
in Uri uri, in Bundle extras);
|
||||
void skipToQueueItem(String packageName, in ControllerCallbackLink caller, long id);
|
||||
void pause(String packageName, in ControllerCallbackLink caller);
|
||||
void stop(String packageName, in ControllerCallbackLink caller);
|
||||
void next(String packageName, in ControllerCallbackLink caller);
|
||||
void previous(String packageName, in ControllerCallbackLink caller);
|
||||
void fastForward(String packageName, in ControllerCallbackLink caller);
|
||||
void rewind(String packageName, in ControllerCallbackLink caller);
|
||||
void seekTo(String packageName, in ControllerCallbackLink caller, long pos);
|
||||
void rate(String packageName, in ControllerCallbackLink caller, in Rating rating);
|
||||
void setPlaybackSpeed(String packageName, in ControllerCallbackLink caller, float speed);
|
||||
void sendCustomAction(String packageName, in ControllerCallbackLink caller,
|
||||
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);
|
||||
MediaMetadata getMetadata();
|
||||
PlaybackState getPlaybackState();
|
||||
|
||||
@@ -25,14 +25,14 @@ import android.os.Bundle;
|
||||
* @hide
|
||||
*/
|
||||
oneway interface ISessionControllerCallback {
|
||||
void notifyEvent(String event, in Bundle extras);
|
||||
void notifySessionDestroyed();
|
||||
void onEvent(String event, in Bundle extras);
|
||||
void onSessionDestroyed();
|
||||
|
||||
// These callbacks are for the TransportController
|
||||
void notifyPlaybackStateChanged(in PlaybackState state);
|
||||
void notifyMetadataChanged(in MediaMetadata metadata);
|
||||
void notifyQueueChanged(in MediaParceledListSlice queue);
|
||||
void notifyQueueTitleChanged(CharSequence title);
|
||||
void notifyExtrasChanged(in Bundle extras);
|
||||
void notifyVolumeInfoChanged(in MediaController.PlaybackInfo info);
|
||||
void onPlaybackStateChanged(in PlaybackState state);
|
||||
void onMetadataChanged(in MediaMetadata metadata);
|
||||
void onQueueChanged(in MediaParceledListSlice queue);
|
||||
void onQueueTitleChanged(CharSequence title);
|
||||
void onExtrasChanged(in Bundle extras);
|
||||
void onVolumeInfoChanged(in MediaController.PlaybackInfo info);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public final class MediaController {
|
||||
|
||||
private final MediaSession.Token mToken;
|
||||
private final Context mContext;
|
||||
private final ControllerCallbackLink mCbStub;
|
||||
private final CallbackStub mCbStub = new CallbackStub(this);
|
||||
private final ArrayList<MessageHandler> mCallbacks = new ArrayList<MessageHandler>();
|
||||
private final Object mLock = new Object();
|
||||
|
||||
@@ -104,7 +104,6 @@ public final class MediaController {
|
||||
mTransportControls = new TransportControls();
|
||||
mToken = token;
|
||||
mContext = context;
|
||||
mCbStub = new ControllerCallbackLink(context, new CallbackStub(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1065,7 +1064,7 @@ public final class MediaController {
|
||||
};
|
||||
}
|
||||
|
||||
private static final class CallbackStub extends ControllerCallbackLink.CallbackStub {
|
||||
private static final class CallbackStub extends ISessionControllerCallback.Stub {
|
||||
private final WeakReference<MediaController> mController;
|
||||
|
||||
CallbackStub(MediaController controller) {
|
||||
@@ -1105,7 +1104,7 @@ public final class MediaController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueueChanged(List<QueueItem> queue) {
|
||||
public void onQueueChanged(MediaParceledListSlice queue) {
|
||||
MediaController controller = mController.get();
|
||||
if (controller != null) {
|
||||
controller.postMessage(MSG_UPDATE_QUEUE, queue, null);
|
||||
@@ -1162,7 +1161,8 @@ public final class MediaController {
|
||||
mCallback.onMetadataChanged((MediaMetadata) msg.obj);
|
||||
break;
|
||||
case MSG_UPDATE_QUEUE:
|
||||
mCallback.onQueueChanged((List<MediaSession.QueueItem>) msg.obj);
|
||||
mCallback.onQueueChanged(msg.obj == null ? null :
|
||||
(List<QueueItem>) ((MediaParceledListSlice) msg.obj).getList());
|
||||
break;
|
||||
case MSG_UPDATE_QUEUE_TITLE:
|
||||
mCallback.onQueueTitleChanged((CharSequence) msg.obj);
|
||||
|
||||
@@ -1120,7 +1120,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onCommand(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String command, Bundle args, ResultReceiver cb) {
|
||||
ISessionControllerCallback caller, String command, Bundle args, ResultReceiver cb) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchCommand(createRemoteUserInfo(packageName, pid, uid),
|
||||
@@ -1146,7 +1146,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onMediaButtonFromController(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, Intent mediaButtonIntent) {
|
||||
ISessionControllerCallback caller, Intent mediaButtonIntent) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchMediaButton(createRemoteUserInfo(packageName, pid, uid),
|
||||
@@ -1156,7 +1156,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPrepare(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchPrepare(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1165,7 +1165,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPrepareFromMediaId(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String mediaId,
|
||||
ISessionControllerCallback caller, String mediaId,
|
||||
Bundle extras) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
@@ -1176,7 +1176,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPrepareFromSearch(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String query,
|
||||
ISessionControllerCallback caller, String query,
|
||||
Bundle extras) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
@@ -1187,7 +1187,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPrepareFromUri(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, Uri uri, Bundle extras) {
|
||||
ISessionControllerCallback caller, Uri uri, Bundle extras) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchPrepareFromUri(createRemoteUserInfo(packageName, pid, uid),
|
||||
@@ -1197,7 +1197,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPlay(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchPlay(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1206,7 +1206,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPlayFromMediaId(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String mediaId,
|
||||
ISessionControllerCallback caller, String mediaId,
|
||||
Bundle extras) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
@@ -1217,7 +1217,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPlayFromSearch(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String query,
|
||||
ISessionControllerCallback caller, String query,
|
||||
Bundle extras) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
@@ -1228,7 +1228,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPlayFromUri(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, Uri uri, Bundle extras) {
|
||||
ISessionControllerCallback caller, Uri uri, Bundle extras) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchPlayFromUri(createRemoteUserInfo(packageName, pid, uid),
|
||||
@@ -1238,7 +1238,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onSkipToTrack(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, long id) {
|
||||
ISessionControllerCallback caller, long id) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchSkipToItem(createRemoteUserInfo(packageName, pid, uid), id);
|
||||
@@ -1247,7 +1247,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPause(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchPause(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1256,7 +1256,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onStop(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchStop(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1265,7 +1265,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onNext(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchNext(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1274,7 +1274,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onPrevious(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchPrevious(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1283,7 +1283,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onFastForward(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchFastForward(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1292,7 +1292,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onRewind(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchRewind(createRemoteUserInfo(packageName, pid, uid));
|
||||
@@ -1301,7 +1301,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onSeekTo(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, long pos) {
|
||||
ISessionControllerCallback caller, long pos) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchSeekTo(createRemoteUserInfo(packageName, pid, uid), pos);
|
||||
@@ -1309,7 +1309,7 @@ public final class MediaSession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRate(String packageName, int pid, int uid, ControllerCallbackLink caller,
|
||||
public void onRate(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
Rating rating) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
@@ -1319,7 +1319,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onSetPlaybackSpeed(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, float speed) {
|
||||
ISessionControllerCallback caller, float speed) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchSetPlaybackSpeed(
|
||||
@@ -1329,7 +1329,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onCustomAction(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String action, Bundle args) {
|
||||
ISessionControllerCallback caller, String action, Bundle args) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchCustomAction(createRemoteUserInfo(packageName, pid, uid),
|
||||
@@ -1339,7 +1339,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onAdjustVolume(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, int direction) {
|
||||
ISessionControllerCallback caller, int direction) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchAdjustVolume(createRemoteUserInfo(packageName, pid, uid),
|
||||
@@ -1349,7 +1349,7 @@ public final class MediaSession {
|
||||
|
||||
@Override
|
||||
public void onSetVolumeTo(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, int value) {
|
||||
ISessionControllerCallback caller, int value) {
|
||||
MediaSession session = mMediaSession.get();
|
||||
if (session != null) {
|
||||
session.dispatchSetVolumeTo(createRemoteUserInfo(packageName, pid, uid),
|
||||
|
||||
@@ -27,10 +27,10 @@ import android.media.MediaMetadata;
|
||||
import android.media.MediaParceledListSlice;
|
||||
import android.media.Rating;
|
||||
import android.media.VolumeProvider;
|
||||
import android.media.session.ControllerCallbackLink;
|
||||
import android.media.session.ISession;
|
||||
import android.media.session.ISessionCallback;
|
||||
import android.media.session.ISessionController;
|
||||
import android.media.session.ISessionControllerCallback;
|
||||
import android.media.session.MediaController;
|
||||
import android.media.session.MediaController.PlaybackInfo;
|
||||
import android.media.session.MediaSession;
|
||||
@@ -88,7 +88,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
private final Context mContext;
|
||||
|
||||
private final Object mLock = new Object();
|
||||
private final ArrayList<ControllerCallbackLinkHolder> mControllerCallbackHolders =
|
||||
private final ArrayList<ISessionControllerCallbackHolder> mControllerCallbackHolders =
|
||||
new ArrayList<>();
|
||||
|
||||
private long mFlags;
|
||||
@@ -265,7 +265,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
* @param useSuggested True to use adjustSuggestedStreamVolume instead of
|
||||
*/
|
||||
public void adjustVolume(String packageName, String opPackageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, boolean asSystemService, int direction, int flags,
|
||||
ISessionControllerCallback caller, boolean asSystemService, int direction, int flags,
|
||||
boolean useSuggested) {
|
||||
int previousFlagPlaySound = flags & AudioManager.FLAG_PLAY_SOUND;
|
||||
if (isPlaybackActive() || hasFlag(MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY)) {
|
||||
@@ -311,7 +311,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
private void setVolumeTo(String packageName, String opPackageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, int value, int flags) {
|
||||
ISessionControllerCallback caller, int value, int flags) {
|
||||
if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_LOCAL) {
|
||||
int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs);
|
||||
final int volumeValue = value;
|
||||
@@ -558,7 +558,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
private void logCallbackException(
|
||||
String msg, ControllerCallbackLinkHolder holder, Exception e) {
|
||||
String msg, ISessionControllerCallbackHolder holder, Exception e) {
|
||||
Log.v(TAG, msg + ", this=" + this + ", callback package=" + holder.mPackageName
|
||||
+ ", exception=" + e);
|
||||
}
|
||||
@@ -569,18 +569,16 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyPlaybackStateChanged(mPlaybackState);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushPlaybackStateUpdate",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushPlaybackStateUpdate",
|
||||
holder, e);
|
||||
}
|
||||
holder.mCallback.onPlaybackStateChanged(mPlaybackState);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushPlaybackStateUpdate",
|
||||
holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushPlaybackStateUpdate",
|
||||
holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -592,18 +590,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyMetadataChanged(mMetadata);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushMetadataUpdate",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushMetadataUpdate",
|
||||
holder, e);
|
||||
}
|
||||
holder.mCallback.onMetadataChanged(mMetadata);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushMetadataUpdate", holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushMetadataUpdate", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -615,17 +609,15 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyQueueChanged(mQueue);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushQueueUpdate",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushQueueUpdate", holder, e);
|
||||
}
|
||||
holder.mCallback.onQueueChanged(mQueue == null ? null :
|
||||
new MediaParceledListSlice<>(mQueue));
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushQueueUpdate", holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushQueueUpdate", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -637,18 +629,15 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyQueueTitleChanged(mQueueTitle);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushQueueTitleUpdate",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushQueueTitleUpdate",
|
||||
holder, e);
|
||||
}
|
||||
holder.mCallback.onQueueTitleChanged(mQueueTitle);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushQueueTitleUpdate",
|
||||
holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushQueueTitleUpdate", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -660,17 +649,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyExtrasChanged(mExtras);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushExtrasUpdate",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushExtrasUpdate", holder, e);
|
||||
}
|
||||
holder.mCallback.onExtrasChanged(mExtras);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushExtrasUpdate", holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushExtrasUpdate", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -683,17 +669,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
PlaybackInfo info = getVolumeAttributes();
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyVolumeInfoChanged(info);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushVolumeUpdate",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushVolumeUpdate", holder, e);
|
||||
}
|
||||
holder.mCallback.onVolumeInfoChanged(info);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushVolumeUpdate", holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushVolumeUpdate", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,16 +688,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifyEvent(event, data);
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushEvent", holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushEvent", holder, e);
|
||||
}
|
||||
holder.mCallback.onEvent(event, data);
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushEvent", holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushEvent", holder, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -728,18 +709,15 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
ControllerCallbackLinkHolder holder = mControllerCallbackHolders.get(i);
|
||||
ISessionControllerCallbackHolder holder = mControllerCallbackHolders.get(i);
|
||||
try {
|
||||
holder.mCallback.notifySessionDestroyed();
|
||||
} catch (RuntimeException e) {
|
||||
if (e.getCause() instanceof DeadObjectException) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushSessionDestroyed",
|
||||
holder, e);
|
||||
} else {
|
||||
logCallbackException("unexpected exception in pushSessionDestroyed",
|
||||
holder, e);
|
||||
}
|
||||
holder.mCallback.onSessionDestroyed();
|
||||
} catch (DeadObjectException e) {
|
||||
mControllerCallbackHolders.remove(i);
|
||||
logCallbackException("Removing dead callback in pushSessionDestroyed",
|
||||
holder, e);
|
||||
} catch (RemoteException e) {
|
||||
logCallbackException("unexpected exception in pushSessionDestroyed", holder, e);
|
||||
}
|
||||
}
|
||||
// After notifying clear all listeners
|
||||
@@ -779,10 +757,10 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
return result == null ? state : result;
|
||||
}
|
||||
|
||||
private int getControllerHolderIndexForCb(ControllerCallbackLink cb) {
|
||||
IBinder binder = cb.getBinder();
|
||||
private int getControllerHolderIndexForCb(ISessionControllerCallback cb) {
|
||||
IBinder binder = cb.asBinder();
|
||||
for (int i = mControllerCallbackHolders.size() - 1; i >= 0; i--) {
|
||||
if (binder.equals(mControllerCallbackHolders.get(i).mCallback.getBinder())) {
|
||||
if (binder.equals(mControllerCallbackHolders.get(i).mCallback.asBinder())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1027,7 +1005,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public boolean sendMediaButton(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, boolean asSystemService,
|
||||
ISessionControllerCallback caller, boolean asSystemService,
|
||||
KeyEvent keyEvent) {
|
||||
try {
|
||||
if (asSystemService) {
|
||||
@@ -1045,7 +1023,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void sendCommand(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String command, Bundle args, ResultReceiver cb) {
|
||||
ISessionControllerCallback caller, String command, Bundle args, ResultReceiver cb) {
|
||||
try {
|
||||
mCb.onCommand(packageName, pid, uid, caller, command, args, cb);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1054,7 +1032,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void sendCustomAction(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String action,
|
||||
ISessionControllerCallback caller, String action,
|
||||
Bundle args) {
|
||||
try {
|
||||
mCb.onCustomAction(packageName, pid, uid, caller, action, args);
|
||||
@@ -1064,7 +1042,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void prepare(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onPrepare(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1073,7 +1051,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void prepareFromMediaId(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String mediaId, Bundle extras) {
|
||||
ISessionControllerCallback caller, String mediaId, Bundle extras) {
|
||||
try {
|
||||
mCb.onPrepareFromMediaId(packageName, pid, uid, caller, mediaId, extras);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1082,7 +1060,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void prepareFromSearch(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String query, Bundle extras) {
|
||||
ISessionControllerCallback caller, String query, Bundle extras) {
|
||||
try {
|
||||
mCb.onPrepareFromSearch(packageName, pid, uid, caller, query, extras);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1091,7 +1069,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void prepareFromUri(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, Uri uri, Bundle extras) {
|
||||
ISessionControllerCallback caller, Uri uri, Bundle extras) {
|
||||
try {
|
||||
mCb.onPrepareFromUri(packageName, pid, uid, caller, uri, extras);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1099,7 +1077,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void play(String packageName, int pid, int uid, ControllerCallbackLink caller) {
|
||||
public void play(String packageName, int pid, int uid, ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onPlay(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1108,7 +1086,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void playFromMediaId(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String mediaId, Bundle extras) {
|
||||
ISessionControllerCallback caller, String mediaId, Bundle extras) {
|
||||
try {
|
||||
mCb.onPlayFromMediaId(packageName, pid, uid, caller, mediaId, extras);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1117,7 +1095,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void playFromSearch(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, String query, Bundle extras) {
|
||||
ISessionControllerCallback caller, String query, Bundle extras) {
|
||||
try {
|
||||
mCb.onPlayFromSearch(packageName, pid, uid, caller, query, extras);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1126,7 +1104,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void playFromUri(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, Uri uri, Bundle extras) {
|
||||
ISessionControllerCallback caller, Uri uri, Bundle extras) {
|
||||
try {
|
||||
mCb.onPlayFromUri(packageName, pid, uid, caller, uri, extras);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1135,7 +1113,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void skipToTrack(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, long id) {
|
||||
ISessionControllerCallback caller, long id) {
|
||||
try {
|
||||
mCb.onSkipToTrack(packageName, pid, uid, caller, id);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1143,7 +1121,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void pause(String packageName, int pid, int uid, ControllerCallbackLink caller) {
|
||||
public void pause(String packageName, int pid, int uid, ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onPause(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1151,7 +1129,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void stop(String packageName, int pid, int uid, ControllerCallbackLink caller) {
|
||||
public void stop(String packageName, int pid, int uid, ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onStop(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1159,7 +1137,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void next(String packageName, int pid, int uid, ControllerCallbackLink caller) {
|
||||
public void next(String packageName, int pid, int uid, ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onNext(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1168,7 +1146,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void previous(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onPrevious(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1177,7 +1155,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void fastForward(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onFastForward(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1186,7 +1164,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void rewind(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller) {
|
||||
ISessionControllerCallback caller) {
|
||||
try {
|
||||
mCb.onRewind(packageName, pid, uid, caller);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1194,7 +1172,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void seekTo(String packageName, int pid, int uid, ControllerCallbackLink caller,
|
||||
public void seekTo(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
long pos) {
|
||||
try {
|
||||
mCb.onSeekTo(packageName, pid, uid, caller, pos);
|
||||
@@ -1203,7 +1181,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
public void rate(String packageName, int pid, int uid, ControllerCallbackLink caller,
|
||||
public void rate(String packageName, int pid, int uid, ISessionControllerCallback caller,
|
||||
Rating rating) {
|
||||
try {
|
||||
mCb.onRate(packageName, pid, uid, caller, rating);
|
||||
@@ -1213,7 +1191,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void setPlaybackSpeed(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, float speed) {
|
||||
ISessionControllerCallback caller, float speed) {
|
||||
try {
|
||||
mCb.onSetPlaybackSpeed(packageName, pid, uid, caller, speed);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1222,7 +1200,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void adjustVolume(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, boolean asSystemService, int direction) {
|
||||
ISessionControllerCallback caller, boolean asSystemService, int direction) {
|
||||
try {
|
||||
if (asSystemService) {
|
||||
mCb.onAdjustVolume(mContext.getPackageName(), Process.myPid(),
|
||||
@@ -1236,7 +1214,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
public void setVolumeTo(String packageName, int pid, int uid,
|
||||
ControllerCallbackLink caller, int value) {
|
||||
ISessionControllerCallback caller, int value) {
|
||||
try {
|
||||
mCb.onSetVolumeTo(packageName, pid, uid, caller, value);
|
||||
} catch (RemoteException e) {
|
||||
@@ -1253,34 +1231,34 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
|
||||
class ControllerStub extends ISessionController.Stub {
|
||||
@Override
|
||||
public void sendCommand(String packageName, ControllerCallbackLink caller,
|
||||
public void sendCommand(String packageName, ISessionControllerCallback caller,
|
||||
String command, Bundle args, ResultReceiver cb) {
|
||||
mSessionCb.sendCommand(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, command, args, cb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendMediaButton(String packageName, ControllerCallbackLink cb,
|
||||
public boolean sendMediaButton(String packageName, ISessionControllerCallback cb,
|
||||
KeyEvent keyEvent) {
|
||||
return mSessionCb.sendMediaButton(packageName, Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), cb, false, keyEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCallback(String packageName, ControllerCallbackLink cb) {
|
||||
public void registerCallback(String packageName, ISessionControllerCallback cb) {
|
||||
synchronized (mLock) {
|
||||
// If this session is already destroyed tell the caller and
|
||||
// don't add them.
|
||||
if (mDestroyed) {
|
||||
try {
|
||||
cb.notifySessionDestroyed();
|
||||
cb.onSessionDestroyed();
|
||||
} catch (Exception e) {
|
||||
// ignored
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (getControllerHolderIndexForCb(cb) < 0) {
|
||||
mControllerCallbackHolders.add(new ControllerCallbackLinkHolder(cb,
|
||||
mControllerCallbackHolders.add(new ISessionControllerCallbackHolder(cb,
|
||||
packageName, Binder.getCallingUid()));
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "registering controller callback " + cb + " from controller"
|
||||
@@ -1291,14 +1269,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterCallback(ControllerCallbackLink cb) {
|
||||
public void unregisterCallback(ISessionControllerCallback cb) {
|
||||
synchronized (mLock) {
|
||||
int index = getControllerHolderIndexForCb(cb);
|
||||
if (index != -1) {
|
||||
mControllerCallbackHolders.remove(index);
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "unregistering callback " + cb.getBinder());
|
||||
Log.d(TAG, "unregistering callback " + cb.asBinder());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1335,7 +1313,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
|
||||
@Override
|
||||
public void adjustVolume(String packageName, String opPackageName,
|
||||
ControllerCallbackLink caller, int direction, int flags) {
|
||||
ISessionControllerCallback caller, int direction, int flags) {
|
||||
int pid = Binder.getCallingPid();
|
||||
int uid = Binder.getCallingUid();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
@@ -1349,7 +1327,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
|
||||
@Override
|
||||
public void setVolumeTo(String packageName, String opPackageName,
|
||||
ControllerCallbackLink caller, int value, int flags) {
|
||||
ISessionControllerCallback caller, int value, int flags) {
|
||||
int pid = Binder.getCallingPid();
|
||||
int uid = Binder.getCallingUid();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
@@ -1362,117 +1340,117 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(String packageName, ControllerCallbackLink caller) {
|
||||
public void prepare(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.prepare(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareFromMediaId(String packageName, ControllerCallbackLink caller,
|
||||
public void prepareFromMediaId(String packageName, ISessionControllerCallback caller,
|
||||
String mediaId, Bundle extras) {
|
||||
mSessionCb.prepareFromMediaId(packageName, Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), caller, mediaId, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareFromSearch(String packageName, ControllerCallbackLink caller,
|
||||
public void prepareFromSearch(String packageName, ISessionControllerCallback caller,
|
||||
String query, Bundle extras) {
|
||||
mSessionCb.prepareFromSearch(packageName, Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), caller, query, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareFromUri(String packageName, ControllerCallbackLink caller,
|
||||
public void prepareFromUri(String packageName, ISessionControllerCallback caller,
|
||||
Uri uri, Bundle extras) {
|
||||
mSessionCb.prepareFromUri(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, uri, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(String packageName, ControllerCallbackLink caller) {
|
||||
public void play(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.play(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFromMediaId(String packageName, ControllerCallbackLink caller,
|
||||
public void playFromMediaId(String packageName, ISessionControllerCallback caller,
|
||||
String mediaId, Bundle extras) {
|
||||
mSessionCb.playFromMediaId(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, mediaId, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFromSearch(String packageName, ControllerCallbackLink caller,
|
||||
public void playFromSearch(String packageName, ISessionControllerCallback caller,
|
||||
String query, Bundle extras) {
|
||||
mSessionCb.playFromSearch(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, query, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFromUri(String packageName, ControllerCallbackLink caller,
|
||||
public void playFromUri(String packageName, ISessionControllerCallback caller,
|
||||
Uri uri, Bundle extras) {
|
||||
mSessionCb.playFromUri(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, uri, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void skipToQueueItem(String packageName, ControllerCallbackLink caller,
|
||||
public void skipToQueueItem(String packageName, ISessionControllerCallback caller,
|
||||
long id) {
|
||||
mSessionCb.skipToTrack(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause(String packageName, ControllerCallbackLink caller) {
|
||||
public void pause(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.pause(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(String packageName, ControllerCallbackLink caller) {
|
||||
public void stop(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.stop(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void next(String packageName, ControllerCallbackLink caller) {
|
||||
public void next(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.next(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void previous(String packageName, ControllerCallbackLink caller) {
|
||||
public void previous(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.previous(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fastForward(String packageName, ControllerCallbackLink caller) {
|
||||
public void fastForward(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.fastForward(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewind(String packageName, ControllerCallbackLink caller) {
|
||||
public void rewind(String packageName, ISessionControllerCallback caller) {
|
||||
mSessionCb.rewind(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seekTo(String packageName, ControllerCallbackLink caller, long pos) {
|
||||
public void seekTo(String packageName, ISessionControllerCallback caller, long pos) {
|
||||
mSessionCb.seekTo(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller,
|
||||
pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rate(String packageName, ControllerCallbackLink caller, Rating rating) {
|
||||
public void rate(String packageName, ISessionControllerCallback caller, Rating rating) {
|
||||
mSessionCb.rate(packageName, Binder.getCallingPid(), Binder.getCallingUid(), caller,
|
||||
rating);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlaybackSpeed(String packageName, ControllerCallbackLink caller,
|
||||
public void setPlaybackSpeed(String packageName, ISessionControllerCallback caller,
|
||||
float speed) {
|
||||
mSessionCb.setPlaybackSpeed(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCustomAction(String packageName, ControllerCallbackLink caller,
|
||||
public void sendCustomAction(String packageName, ISessionControllerCallback caller,
|
||||
String action, Bundle args) {
|
||||
mSessionCb.sendCustomAction(packageName, Binder.getCallingPid(), Binder.getCallingUid(),
|
||||
caller, action, args);
|
||||
@@ -1515,12 +1493,12 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
private class ControllerCallbackLinkHolder {
|
||||
private final ControllerCallbackLink mCallback;
|
||||
private class ISessionControllerCallbackHolder {
|
||||
private final ISessionControllerCallback mCallback;
|
||||
private final String mPackageName;
|
||||
private final int mUid;
|
||||
|
||||
ControllerCallbackLinkHolder(ControllerCallbackLink callback, String packageName,
|
||||
ISessionControllerCallbackHolder(ISessionControllerCallback callback, String packageName,
|
||||
int uid) {
|
||||
mCallback = callback;
|
||||
mPackageName = packageName;
|
||||
|
||||
Reference in New Issue
Block a user