use of android.media.session.MediaSessionManager in project android_frameworks_base by AOSPA.
the class MediaSessions method dumpMediaSessions.
public static void dumpMediaSessions(Context context) {
final MediaSessionManager mgr = (MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE);
try {
final List<MediaController> controllers = mgr.getActiveSessions(null);
final int N = controllers.size();
if (D.BUG)
Log.d(TAG, N + " controllers");
for (int i = 0; i < N; i++) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw, true);
dump(i + 1, pw, controllers.get(i));
if (D.BUG)
Log.d(TAG, sw.toString());
}
} catch (SecurityException e) {
Log.w(TAG, "Not allowed to get sessions", e);
}
}
use of android.media.session.MediaSessionManager in project android_frameworks_base by DirtyUnicorns.
the class PlayerSession method createSession.
public void createSession() {
releaseSession();
MediaSessionManager man = (MediaSessionManager) mContext.getSystemService(Context.MEDIA_SESSION_SERVICE);
Log.d(TAG, "Creating session for package " + mContext.getBasePackageName());
mSession = new MediaSession(mContext, "OneMedia");
mSession.setCallback(mCallback);
mSession.setPlaybackState(mPlaybackState);
mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS | MediaSession.FLAG_HANDLES_MEDIA_BUTTONS);
mSession.setActive(true);
updateMetadata();
}
use of android.media.session.MediaSessionManager in project android_frameworks_base by ResurrectionRemix.
the class PlayerSession method createSession.
public void createSession() {
releaseSession();
MediaSessionManager man = (MediaSessionManager) mContext.getSystemService(Context.MEDIA_SESSION_SERVICE);
Log.d(TAG, "Creating session for package " + mContext.getBasePackageName());
mSession = new MediaSession(mContext, "OneMedia");
mSession.setCallback(mCallback);
mSession.setPlaybackState(mPlaybackState);
mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS | MediaSession.FLAG_HANDLES_MEDIA_BUTTONS);
mSession.setActive(true);
updateMetadata();
}
use of android.media.session.MediaSessionManager in project android_frameworks_base by crdroidandroid.
the class PlayerSession method createSession.
public void createSession() {
releaseSession();
MediaSessionManager man = (MediaSessionManager) mContext.getSystemService(Context.MEDIA_SESSION_SERVICE);
Log.d(TAG, "Creating session for package " + mContext.getBasePackageName());
mSession = new MediaSession(mContext, "OneMedia");
mSession.setCallback(mCallback);
mSession.setPlaybackState(mPlaybackState);
mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS | MediaSession.FLAG_HANDLES_MEDIA_BUTTONS);
mSession.setActive(true);
updateMetadata();
}
Aggregations