use of android.media.session.MediaController.PlaybackInfo in project android_frameworks_base by DirtyUnicorns.
the class MediaSessions method onActiveSessionsUpdatedH.
protected void onActiveSessionsUpdatedH(List<MediaController> controllers) {
if (D.BUG)
Log.d(TAG, "onActiveSessionsUpdatedH n=" + controllers.size());
final Set<Token> toRemove = new HashSet<Token>(mRecords.keySet());
for (MediaController controller : controllers) {
final Token token = controller.getSessionToken();
final PlaybackInfo pi = controller.getPlaybackInfo();
toRemove.remove(token);
if (!mRecords.containsKey(token)) {
final MediaControllerRecord r = new MediaControllerRecord(controller);
r.name = getControllerName(controller);
mRecords.put(token, r);
controller.registerCallback(r, mHandler);
}
final MediaControllerRecord r = mRecords.get(token);
final boolean remote = isRemote(pi);
if (remote) {
updateRemoteH(token, r.name, pi);
r.sentRemote = true;
}
}
for (Token t : toRemove) {
final MediaControllerRecord r = mRecords.get(t);
r.controller.unregisterCallback(r);
mRecords.remove(t);
if (D.BUG)
Log.d(TAG, "Removing " + r.name + " sentRemote=" + r.sentRemote);
if (r.sentRemote) {
mCallbacks.onRemoteRemoved(t);
r.sentRemote = false;
}
}
}
use of android.media.session.MediaController.PlaybackInfo in project android_frameworks_base by DirtyUnicorns.
the class MediaSessions method dump.
private static void dump(int n, PrintWriter writer, MediaController c) {
writer.println(" Controller " + n + ": " + c.getPackageName());
final Bundle extras = c.getExtras();
final long flags = c.getFlags();
final MediaMetadata mm = c.getMetadata();
final PlaybackInfo pi = c.getPlaybackInfo();
final PlaybackState playbackState = c.getPlaybackState();
final List<QueueItem> queue = c.getQueue();
final CharSequence queueTitle = c.getQueueTitle();
final int ratingType = c.getRatingType();
final PendingIntent sessionActivity = c.getSessionActivity();
writer.println(" PlaybackState: " + Util.playbackStateToString(playbackState));
writer.println(" PlaybackInfo: " + Util.playbackInfoToString(pi));
if (mm != null) {
writer.println(" MediaMetadata.desc=" + mm.getDescription());
}
writer.println(" RatingType: " + ratingType);
writer.println(" Flags: " + flags);
if (extras != null) {
writer.println(" Extras:");
for (String key : extras.keySet()) {
writer.println(" " + key + "=" + extras.get(key));
}
}
if (queueTitle != null) {
writer.println(" QueueTitle: " + queueTitle);
}
if (queue != null && !queue.isEmpty()) {
writer.println(" Queue:");
for (QueueItem qi : queue) {
writer.println(" " + qi);
}
}
if (pi != null) {
writer.println(" sessionActivity: " + sessionActivity);
}
}
use of android.media.session.MediaController.PlaybackInfo in project android_frameworks_base by ResurrectionRemix.
the class MediaSessions method onActiveSessionsUpdatedH.
protected void onActiveSessionsUpdatedH(List<MediaController> controllers) {
if (D.BUG)
Log.d(TAG, "onActiveSessionsUpdatedH n=" + controllers.size());
final Set<Token> toRemove = new HashSet<Token>(mRecords.keySet());
for (MediaController controller : controllers) {
final Token token = controller.getSessionToken();
final PlaybackInfo pi = controller.getPlaybackInfo();
toRemove.remove(token);
if (!mRecords.containsKey(token)) {
final MediaControllerRecord r = new MediaControllerRecord(controller);
r.name = getControllerName(controller);
mRecords.put(token, r);
controller.registerCallback(r, mHandler);
}
final MediaControllerRecord r = mRecords.get(token);
final boolean remote = isRemote(pi);
if (remote) {
updateRemoteH(token, r.name, pi);
r.sentRemote = true;
}
}
for (Token t : toRemove) {
final MediaControllerRecord r = mRecords.get(t);
r.controller.unregisterCallback(r);
mRecords.remove(t);
if (D.BUG)
Log.d(TAG, "Removing " + r.name + " sentRemote=" + r.sentRemote);
if (r.sentRemote) {
mCallbacks.onRemoteRemoved(t);
r.sentRemote = false;
}
}
}
use of android.media.session.MediaController.PlaybackInfo in project android_frameworks_base by ResurrectionRemix.
the class MediaSessions method dump.
private static void dump(int n, PrintWriter writer, MediaController c) {
writer.println(" Controller " + n + ": " + c.getPackageName());
final Bundle extras = c.getExtras();
final long flags = c.getFlags();
final MediaMetadata mm = c.getMetadata();
final PlaybackInfo pi = c.getPlaybackInfo();
final PlaybackState playbackState = c.getPlaybackState();
final List<QueueItem> queue = c.getQueue();
final CharSequence queueTitle = c.getQueueTitle();
final int ratingType = c.getRatingType();
final PendingIntent sessionActivity = c.getSessionActivity();
writer.println(" PlaybackState: " + Util.playbackStateToString(playbackState));
writer.println(" PlaybackInfo: " + Util.playbackInfoToString(pi));
if (mm != null) {
writer.println(" MediaMetadata.desc=" + mm.getDescription());
}
writer.println(" RatingType: " + ratingType);
writer.println(" Flags: " + flags);
if (extras != null) {
writer.println(" Extras:");
for (String key : extras.keySet()) {
writer.println(" " + key + "=" + extras.get(key));
}
}
if (queueTitle != null) {
writer.println(" QueueTitle: " + queueTitle);
}
if (queue != null && !queue.isEmpty()) {
writer.println(" Queue:");
for (QueueItem qi : queue) {
writer.println(" " + qi);
}
}
if (pi != null) {
writer.println(" sessionActivity: " + sessionActivity);
}
}
use of android.media.session.MediaController.PlaybackInfo in project android_frameworks_base by crdroidandroid.
the class MediaSessions method onActiveSessionsUpdatedH.
protected void onActiveSessionsUpdatedH(List<MediaController> controllers) {
if (D.BUG)
Log.d(TAG, "onActiveSessionsUpdatedH n=" + controllers.size());
final Set<Token> toRemove = new HashSet<Token>(mRecords.keySet());
for (MediaController controller : controllers) {
final Token token = controller.getSessionToken();
final PlaybackInfo pi = controller.getPlaybackInfo();
toRemove.remove(token);
if (!mRecords.containsKey(token)) {
final MediaControllerRecord r = new MediaControllerRecord(controller);
r.name = getControllerName(controller);
mRecords.put(token, r);
controller.registerCallback(r, mHandler);
}
final MediaControllerRecord r = mRecords.get(token);
final boolean remote = isRemote(pi);
if (remote) {
updateRemoteH(token, r.name, pi);
r.sentRemote = true;
}
}
for (Token t : toRemove) {
final MediaControllerRecord r = mRecords.get(t);
r.controller.unregisterCallback(r);
mRecords.remove(t);
if (D.BUG)
Log.d(TAG, "Removing " + r.name + " sentRemote=" + r.sentRemote);
if (r.sentRemote) {
mCallbacks.onRemoteRemoved(t);
r.sentRemote = false;
}
}
}
Aggregations