Loading services/core/java/com/android/server/media/MediaSessionStack.java +8 −15 Original line number Original line Diff line number Diff line Loading @@ -21,11 +21,11 @@ import static com.android.server.media.MediaSessionPolicyProvider.SESSION_POLICY import android.media.Session2Token; import android.media.Session2Token; import android.media.session.MediaSession; import android.media.session.MediaSession; import android.os.UserHandle; import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.util.SparseArray; import com.android.server.utils.EventLogger; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import java.util.List; Loading Loading @@ -61,8 +61,6 @@ class MediaSessionStack { private final AudioPlayerStateMonitor mAudioPlayerStateMonitor; private final AudioPlayerStateMonitor mAudioPlayerStateMonitor; private final OnMediaButtonSessionChangedListener mOnMediaButtonSessionChangedListener; private final OnMediaButtonSessionChangedListener mOnMediaButtonSessionChangedListener; private final EventLogger mEventLogger = new EventLogger(DUMP_EVENTS_MAX_COUNT, TAG); /** /** * The media button session which receives media key events. * The media button session which receives media key events. * It could be null if the previous media button session is released. * It could be null if the previous media button session is released. Loading @@ -86,9 +84,8 @@ class MediaSessionStack { * @param record The record to add. * @param record The record to add. */ */ public void addSession(MediaSessionRecordImpl record) { public void addSession(MediaSessionRecordImpl record) { mEventLogger.enqueue(EventLogger.StringEvent.from( Slog.i(TAG, TextUtils.formatSimple( "addSession() (to bottom of stack)", "addSession to bottom of stack | record: %s", "record: %s", record record )); )); mSessions.add(record); mSessions.add(record); Loading @@ -106,9 +103,8 @@ class MediaSessionStack { * @param record The record to remove. * @param record The record to remove. */ */ public void removeSession(MediaSessionRecordImpl record) { public void removeSession(MediaSessionRecordImpl record) { mEventLogger.enqueue(EventLogger.StringEvent.from( Slog.i(TAG, TextUtils.formatSimple( "removeSession()", "removeSession | record: %s", "record: %s", record record )); )); mSessions.remove(record); mSessions.remove(record); Loading Loading @@ -156,9 +152,8 @@ class MediaSessionStack { public void onPlaybackStateChanged( public void onPlaybackStateChanged( MediaSessionRecordImpl record, boolean shouldUpdatePriority) { MediaSessionRecordImpl record, boolean shouldUpdatePriority) { if (shouldUpdatePriority) { if (shouldUpdatePriority) { mEventLogger.enqueue(EventLogger.StringEvent.from( Slog.i(TAG, TextUtils.formatSimple( "onPlaybackStateChanged() - Pushing session to top", "onPlaybackStateChanged - Pushing session to top | record: %s", "record: %s", record record )); )); mSessions.remove(record); mSessions.remove(record); Loading Loading @@ -365,8 +360,6 @@ class MediaSessionStack { for (MediaSessionRecordImpl record : mSessions) { for (MediaSessionRecordImpl record : mSessions) { record.dump(pw, indent); record.dump(pw, indent); } } pw.println(prefix + "Session stack events:"); mEventLogger.dump(pw, indent); } } /** /** Loading Loading
services/core/java/com/android/server/media/MediaSessionStack.java +8 −15 Original line number Original line Diff line number Diff line Loading @@ -21,11 +21,11 @@ import static com.android.server.media.MediaSessionPolicyProvider.SESSION_POLICY import android.media.Session2Token; import android.media.Session2Token; import android.media.session.MediaSession; import android.media.session.MediaSession; import android.os.UserHandle; import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.util.SparseArray; import com.android.server.utils.EventLogger; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import java.util.List; Loading Loading @@ -61,8 +61,6 @@ class MediaSessionStack { private final AudioPlayerStateMonitor mAudioPlayerStateMonitor; private final AudioPlayerStateMonitor mAudioPlayerStateMonitor; private final OnMediaButtonSessionChangedListener mOnMediaButtonSessionChangedListener; private final OnMediaButtonSessionChangedListener mOnMediaButtonSessionChangedListener; private final EventLogger mEventLogger = new EventLogger(DUMP_EVENTS_MAX_COUNT, TAG); /** /** * The media button session which receives media key events. * The media button session which receives media key events. * It could be null if the previous media button session is released. * It could be null if the previous media button session is released. Loading @@ -86,9 +84,8 @@ class MediaSessionStack { * @param record The record to add. * @param record The record to add. */ */ public void addSession(MediaSessionRecordImpl record) { public void addSession(MediaSessionRecordImpl record) { mEventLogger.enqueue(EventLogger.StringEvent.from( Slog.i(TAG, TextUtils.formatSimple( "addSession() (to bottom of stack)", "addSession to bottom of stack | record: %s", "record: %s", record record )); )); mSessions.add(record); mSessions.add(record); Loading @@ -106,9 +103,8 @@ class MediaSessionStack { * @param record The record to remove. * @param record The record to remove. */ */ public void removeSession(MediaSessionRecordImpl record) { public void removeSession(MediaSessionRecordImpl record) { mEventLogger.enqueue(EventLogger.StringEvent.from( Slog.i(TAG, TextUtils.formatSimple( "removeSession()", "removeSession | record: %s", "record: %s", record record )); )); mSessions.remove(record); mSessions.remove(record); Loading Loading @@ -156,9 +152,8 @@ class MediaSessionStack { public void onPlaybackStateChanged( public void onPlaybackStateChanged( MediaSessionRecordImpl record, boolean shouldUpdatePriority) { MediaSessionRecordImpl record, boolean shouldUpdatePriority) { if (shouldUpdatePriority) { if (shouldUpdatePriority) { mEventLogger.enqueue(EventLogger.StringEvent.from( Slog.i(TAG, TextUtils.formatSimple( "onPlaybackStateChanged() - Pushing session to top", "onPlaybackStateChanged - Pushing session to top | record: %s", "record: %s", record record )); )); mSessions.remove(record); mSessions.remove(record); Loading Loading @@ -365,8 +360,6 @@ class MediaSessionStack { for (MediaSessionRecordImpl record : mSessions) { for (MediaSessionRecordImpl record : mSessions) { record.dump(pw, indent); record.dump(pw, indent); } } pw.println(prefix + "Session stack events:"); mEventLogger.dump(pw, indent); } } /** /** Loading