diff options
author | RoboErik <epastern@google.com> | 2014-08-11 16:50:18 -0700 |
---|---|---|
committer | RoboErik <epastern@google.com> | 2014-08-11 16:50:18 -0700 |
commit | 4d26598677095e74e30fc12f46a769cac800f946 (patch) | |
tree | ddc9a7099da9574d8208260bd885436de912c92b /services/core/java/com/android/server/media | |
parent | 3afd00e9f2b55a21ca378d6e520d24283dbb62e0 (diff) | |
download | frameworks_base-4d26598677095e74e30fc12f46a769cac800f946.zip frameworks_base-4d26598677095e74e30fc12f46a769cac800f946.tar.gz frameworks_base-4d26598677095e74e30fc12f46a769cac800f946.tar.bz2 |
Fix registering global priority sessions
We were never setting a global priority session due to a change in
the way sessions were registered. This makes sure a global session
gets set correctly.
bug:16930866
Change-Id: I859846c9265e98bb1a37ff9d22808137e787ce18
Diffstat (limited to 'services/core/java/com/android/server/media')
-rw-r--r-- | services/core/java/com/android/server/media/MediaSessionService.java | 20 | ||||
-rw-r--r-- | services/core/java/com/android/server/media/MediaSessionStack.java | 7 |
2 files changed, 4 insertions, 23 deletions
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index 92644ce..209123f 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -87,7 +87,6 @@ public class MediaSessionService extends SystemService implements Monitor { private IAudioService mAudioService; private ContentResolver mContentResolver; - private MediaSessionRecord mPrioritySession; private int mCurrentUserId = -1; // Used to notify system UI when remote volume was changed. TODO find a @@ -125,18 +124,6 @@ public class MediaSessionService extends SystemService implements Monitor { return; } mPriorityStack.onSessionStateChange(record); - if (record.isSystemPriority()) { - if (record.isActive()) { - if (mPrioritySession != null) { - Log.w(TAG, "Replacing existing priority session with a new session"); - } - mPrioritySession = record; - } else { - if (mPrioritySession == record) { - mPrioritySession = null; - } - } - } } mHandler.post(MessageHandler.MSG_SESSIONS_CHANGED, record.getUserId(), 0); } @@ -258,9 +245,6 @@ public class MediaSessionService extends SystemService implements Monitor { mPriorityStack.removeSession(session); mAllSessions.remove(session); - if (session == mPrioritySession) { - mPrioritySession = null; - } try { session.getCallback().asBinder().unlinkToDeath(session, 0); @@ -716,10 +700,6 @@ public class MediaSessionService extends SystemService implements Monitor { pw.println(); synchronized (mLock) { - pw.println("Session for calls:" + mPrioritySession); - if (mPrioritySession != null) { - mPrioritySession.dump(pw, ""); - } int count = mAllSessions.size(); pw.println(count + " Sessions:"); for (int i = 0; i < count; i++) { diff --git a/services/core/java/com/android/server/media/MediaSessionStack.java b/services/core/java/com/android/server/media/MediaSessionStack.java index 3d1ecb3..fec11fb 100644 --- a/services/core/java/com/android/server/media/MediaSessionStack.java +++ b/services/core/java/com/android/server/media/MediaSessionStack.java @@ -63,9 +63,6 @@ public class MediaSessionStack { */ public void addSession(MediaSessionRecord record) { mSessions.add(record); - if ((record.getFlags() & MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY) != 0) { - mGlobalPrioritySession = record; - } clearCache(); } @@ -110,6 +107,9 @@ public class MediaSessionStack { * @param record The record that changed. */ public void onSessionStateChange(MediaSessionRecord record) { + if ((record.getFlags() & MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY) != 0) { + mGlobalPrioritySession = record; + } // For now just clear the cache. Eventually we'll selectively clear // depending on what changed. clearCache(); @@ -220,6 +220,7 @@ public class MediaSessionStack { ArrayList<MediaSessionRecord> sortedSessions = getPriorityListLocked(false, 0, UserHandle.USER_ALL); int count = sortedSessions.size(); + pw.println(prefix + "Global priority session is " + mGlobalPrioritySession); pw.println(prefix + "Sessions Stack - have " + count + " sessions:"); String indent = prefix + " "; for (int i = 0; i < count; i++) { |