Loading services/core/java/com/android/server/media/MediaSessionRecord.java +8 −0 Original line number Diff line number Diff line Loading @@ -784,6 +784,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { mService.enforcePhoneStatePermission(pid, uid); } mFlags = flags; if ((flags & MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY) != 0) { final long token = Binder.clearCallingIdentity(); try { mService.setGlobalPrioritySession(MediaSessionRecord.this); } finally { Binder.restoreCallingIdentity(token); } } mHandler.post(MessageHandler.MSG_UPDATE_SESSION_STATE); } Loading services/core/java/com/android/server/media/MediaSessionService.java +18 −11 Original line number Diff line number Diff line Loading @@ -178,17 +178,6 @@ public class MediaSessionService extends SystemService implements Monitor { return; } if ((record.getFlags() & MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY) != 0) { if (mGlobalPrioritySession != record) { Log.d(TAG, "Global priority session is changed from " + mGlobalPrioritySession + " to " + record); mGlobalPrioritySession = record; if (user != null && user.mPriorityStack.contains(record)) { // Handle the global priority session separately. // Otherwise, it will be the media button session even after it becomes // inactive because it has been the lastly played media app. user.mPriorityStack.removeSession(record); } } if (DEBUG_KEY_EVENT) { Log.d(TAG, "Global priority session is updated, active=" + record.isActive()); } Loading @@ -204,6 +193,24 @@ public class MediaSessionService extends SystemService implements Monitor { } } public void setGlobalPrioritySession(MediaSessionRecord record) { synchronized (mLock) { FullUserRecord user = getFullUserRecordLocked(record.getUserId()); if (mGlobalPrioritySession != record) { Log.d(TAG, "Global priority session is changed from " + mGlobalPrioritySession + " to " + record); mGlobalPrioritySession = record; if (user != null && user.mPriorityStack.contains(record)) { // Handle the global priority session separately. // Otherwise, it can be the media button session regardless of the active state // because it or other system components might have been the lastly played media // app. user.mPriorityStack.removeSession(record); } } } } private List<MediaSessionRecord> getActiveSessionsLocked(int userId) { List<MediaSessionRecord> records = new ArrayList<>(); if (userId == UserHandle.USER_ALL) { Loading Loading
services/core/java/com/android/server/media/MediaSessionRecord.java +8 −0 Original line number Diff line number Diff line Loading @@ -784,6 +784,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { mService.enforcePhoneStatePermission(pid, uid); } mFlags = flags; if ((flags & MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY) != 0) { final long token = Binder.clearCallingIdentity(); try { mService.setGlobalPrioritySession(MediaSessionRecord.this); } finally { Binder.restoreCallingIdentity(token); } } mHandler.post(MessageHandler.MSG_UPDATE_SESSION_STATE); } Loading
services/core/java/com/android/server/media/MediaSessionService.java +18 −11 Original line number Diff line number Diff line Loading @@ -178,17 +178,6 @@ public class MediaSessionService extends SystemService implements Monitor { return; } if ((record.getFlags() & MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY) != 0) { if (mGlobalPrioritySession != record) { Log.d(TAG, "Global priority session is changed from " + mGlobalPrioritySession + " to " + record); mGlobalPrioritySession = record; if (user != null && user.mPriorityStack.contains(record)) { // Handle the global priority session separately. // Otherwise, it will be the media button session even after it becomes // inactive because it has been the lastly played media app. user.mPriorityStack.removeSession(record); } } if (DEBUG_KEY_EVENT) { Log.d(TAG, "Global priority session is updated, active=" + record.isActive()); } Loading @@ -204,6 +193,24 @@ public class MediaSessionService extends SystemService implements Monitor { } } public void setGlobalPrioritySession(MediaSessionRecord record) { synchronized (mLock) { FullUserRecord user = getFullUserRecordLocked(record.getUserId()); if (mGlobalPrioritySession != record) { Log.d(TAG, "Global priority session is changed from " + mGlobalPrioritySession + " to " + record); mGlobalPrioritySession = record; if (user != null && user.mPriorityStack.contains(record)) { // Handle the global priority session separately. // Otherwise, it can be the media button session regardless of the active state // because it or other system components might have been the lastly played media // app. user.mPriorityStack.removeSession(record); } } } } private List<MediaSessionRecord> getActiveSessionsLocked(int userId) { List<MediaSessionRecord> records = new ArrayList<>(); if (userId == UserHandle.USER_ALL) { Loading