import android.media.MediaMetadata;
import android.media.Rating;
import android.media.session.ISessionControllerCallback;
+import android.media.session.MediaSessionInfo;
import android.media.session.PlaybackState;
import android.os.Bundle;
import android.os.ResultReceiver;
void unregisterCallbackListener(in ISessionControllerCallback cb);
boolean isTransportControlEnabled();
void showRoutePicker();
+ MediaSessionInfo getSessionInfo();
// These commands are for the TransportController
void play();
}
}
+ /**
+ * Get the info for the session this controller is connected to.
+ *
+ * @return The session info for the connected session.
+ * @hide
+ */
+ public MediaSessionInfo getSessionInfo() {
+ try {
+ return mSessionBinder.getSessionInfo();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error in getSessionInfo.", e);
+ }
+ return null;
+ }
+
/*
* @hide
*/
--- /dev/null
+/* Copyright 2014, 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 MediaSessionInfo;
public final class MediaSessionInfo implements Parcelable {
private final String mId;
private final String mPackageName;
+ private final int mPid;
/**
* @hide
*/
- public MediaSessionInfo(String id, String packageName) {
+ public MediaSessionInfo(String id, String packageName, int pid) {
mId = id;
mPackageName = packageName;
+ mPid = pid;
}
private MediaSessionInfo(Parcel in) {
mId = in.readString();
mPackageName = in.readString();
+ mPid = in.readInt();
}
/**
return mId;
}
+ public int getPid() {
+ return mPid;
+ }
+
@Override
public String toString() {
- return "SessionInfo {id=" + mId + ", pkg=" + mPackageName + "}";
+ return "SessionInfo {id=" + mId + ", pkg=" + mPackageName + ", pid=" + mPid + "}";
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mId);
dest.writeString(mPackageName);
+ dest.writeInt(mPid);
}
public static final Parcelable.Creator<MediaSessionInfo> CREATOR
mOwnerPid = ownerPid;
mOwnerUid = ownerUid;
mUserId = userId;
- mSessionInfo = new MediaSessionInfo(UUID.randomUUID().toString(), ownerPackageName);
+ mSessionInfo = new MediaSessionInfo(UUID.randomUUID().toString(), ownerPackageName,
+ ownerPid);
mTag = tag;
mController = new ControllerStub();
mSession = new SessionStub();
}
@Override
+ public MediaSessionInfo getSessionInfo() {
+ return mSessionInfo;
+ }
+
+ @Override
public void play() throws RemoteException {
mSessionCb.play();
}