Search in sources :

Example 16 with MediaController

use of android.media.session.MediaController in project android_frameworks_base by DirtyUnicorns.

the class MediaSessions method onUpdateRemoteControllerH.

private void onUpdateRemoteControllerH(ISessionController session) {
    final MediaController controller = session != null ? new MediaController(mContext, session) : null;
    final String pkg = controller != null ? controller.getPackageName() : null;
    if (D.BUG)
        Log.d(TAG, "updateRemoteControllerH " + pkg);
    // this may be our only indication that a remote session is changed, refresh
    postUpdateSessions();
}
Also used : MediaController(android.media.session.MediaController)

Example 17 with MediaController

use of android.media.session.MediaController in project android_frameworks_base by DirtyUnicorns.

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);
    }
}
Also used : MediaController(android.media.session.MediaController) StringWriter(java.io.StringWriter) MediaSessionManager(android.media.session.MediaSessionManager) PrintWriter(java.io.PrintWriter)

Example 18 with MediaController

use of android.media.session.MediaController in project platform_frameworks_base by android.

the class MediaSessions method onRemoteVolumeChangedH.

private void onRemoteVolumeChangedH(ISessionController session, int flags) {
    final MediaController controller = new MediaController(mContext, session);
    if (D.BUG)
        Log.d(TAG, "remoteVolumeChangedH " + controller.getPackageName() + " " + Util.audioManagerFlagsToString(flags));
    final Token token = controller.getSessionToken();
    mCallbacks.onRemoteVolumeChanged(token, flags);
}
Also used : MediaController(android.media.session.MediaController) Token(android.media.session.MediaSession.Token)

Example 19 with MediaController

use of android.media.session.MediaController in project platform_frameworks_base by android.

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);
    }
}
Also used : MediaController(android.media.session.MediaController) StringWriter(java.io.StringWriter) MediaSessionManager(android.media.session.MediaSessionManager) PrintWriter(java.io.PrintWriter)

Example 20 with MediaController

use of android.media.session.MediaController in project platform_frameworks_base by android.

the class MediaSessions method onUpdateRemoteControllerH.

private void onUpdateRemoteControllerH(ISessionController session) {
    final MediaController controller = session != null ? new MediaController(mContext, session) : null;
    final String pkg = controller != null ? controller.getPackageName() : null;
    if (D.BUG)
        Log.d(TAG, "updateRemoteControllerH " + pkg);
    // this may be our only indication that a remote session is changed, refresh
    postUpdateSessions();
}
Also used : MediaController(android.media.session.MediaController)

Aggregations

MediaController (android.media.session.MediaController)31 Token (android.media.session.MediaSession.Token)10 StatusBarManager.windowStateToString (android.app.StatusBarManager.windowStateToString)5 Point (android.graphics.Point)5 PlaybackInfo (android.media.session.MediaController.PlaybackInfo)5 MediaSession (android.media.session.MediaSession)5 MediaSessionManager (android.media.session.MediaSessionManager)5 Entry (com.android.systemui.statusbar.NotificationData.Entry)5 PrintWriter (java.io.PrintWriter)5 StringWriter (java.io.StringWriter)5 HashSet (java.util.HashSet)5 MediaExpandableNotificationRow (com.android.systemui.statusbar.MediaExpandableNotificationRow)2 MediaMetadata (android.media.MediaMetadata)1 PlaybackState (android.media.session.PlaybackState)1 Bundle (android.os.Bundle)1 SpannableString (android.text.SpannableString)1 MusicSpec (nodomain.freeyourgadget.gadgetbridge.model.MusicSpec)1 MusicStateSpec (nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec)1