summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--media/java/android/media/session/MediaMetadata.java9
-rw-r--r--media/java/android/media/session/PlaybackState.java14
-rw-r--r--services/core/java/com/android/server/media/MediaSessionRecord.java9
4 files changed, 33 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 3f6b297..b7c5380 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -15203,6 +15203,7 @@ package android.media.session {
method public long getLong(java.lang.String);
method public android.media.Rating getRating(java.lang.String);
method public java.lang.String getString(java.lang.String);
+ method public int size();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
field public static final java.lang.String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
diff --git a/media/java/android/media/session/MediaMetadata.java b/media/java/android/media/session/MediaMetadata.java
index 56bdf68..8a8af45 100644
--- a/media/java/android/media/session/MediaMetadata.java
+++ b/media/java/android/media/session/MediaMetadata.java
@@ -295,6 +295,15 @@ public final class MediaMetadata implements Parcelable {
}
/**
+ * Get the number of fields in this metadata.
+ *
+ * @return The number of fields in the metadata.
+ */
+ public int size() {
+ return mBundle.size();
+ }
+
+ /**
* Helper for getting the String key used by {@link MediaMetadata} from the
* integer key that {@link MediaMetadataEditor} uses.
*
diff --git a/media/java/android/media/session/PlaybackState.java b/media/java/android/media/session/PlaybackState.java
index 26eb9c4..3254e5d 100644
--- a/media/java/android/media/session/PlaybackState.java
+++ b/media/java/android/media/session/PlaybackState.java
@@ -225,6 +225,20 @@ public final class PlaybackState implements Parcelable {
}
@Override
+ public String toString() {
+ StringBuilder bob = new StringBuilder("PlaybackState {");
+ bob.append("state=").append(mState);
+ bob.append(", position=").append(mPosition);
+ bob.append(", buffered position=").append(mBufferPosition);
+ bob.append(", rate=").append(mRate);
+ bob.append(", updated=").append(mUpdateTime);
+ bob.append(", actions=").append(mActions);
+ bob.append(", error=").append(mErrorMessage);
+ bob.append("}");
+ return bob.toString();
+ }
+
+ @Override
public int describeContents() {
return 0;
}
diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java
index ab2a723..3dc17fc 100644
--- a/services/core/java/com/android/server/media/MediaSessionRecord.java
+++ b/services/core/java/com/android/server/media/MediaSessionRecord.java
@@ -238,6 +238,8 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
pw.println(indent + "transport controls enabled=" + mTransportPerformerEnabled);
pw.println(indent + "rating type=" + mRatingType);
pw.println(indent + "controllers: " + mControllerCallbacks.size());
+ pw.println(indent + "state=" + mPlaybackState.toString());
+ pw.println(indent + "metadata:" + getShortMetadataString());
pw.println(indent + "route requests {");
int size = mRequests.size();
for (int i = 0; i < size; i++) {
@@ -249,6 +251,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
pw.println(indent + "params=" + (mRequest == null ? null : mRequest.toString()));
}
+ private String getShortMetadataString() {
+ int fields = mMetadata == null ? 0 : mMetadata.size();
+ String title = mMetadata == null ? null : mMetadata
+ .getString(MediaMetadata.METADATA_KEY_TITLE);
+ return "size=" + fields + ", title=" + title;
+ }
+
private void onDestroy() {
mService.destroySession(this);
}