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();
}
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);
}
}
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);
}
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);
}
}
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();
}
Aggregations