VolumePrototypes: Allow current controller to access sessions.
Allow the currently blessed volume controller delegate to access media session manager to support multiple remote sessions. Bug: 19260237 Change-Id: I53120f0852c69a7ea08b7b4a9f61902b961dbc70
This commit is contained in:
@@ -338,6 +338,7 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
*/
|
||||
private void enforceMediaPermissions(ComponentName compName, int pid, int uid,
|
||||
int resolvedUserId) {
|
||||
if (isCurrentVolumeController(uid)) return;
|
||||
if (getContext()
|
||||
.checkPermission(android.Manifest.permission.MEDIA_CONTENT_CONTROL, pid, uid)
|
||||
!= PackageManager.PERMISSION_GRANTED
|
||||
@@ -347,13 +348,18 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
}
|
||||
}
|
||||
|
||||
private void enforceSystemUiPermission(String action, int pid, int uid) {
|
||||
private boolean isCurrentVolumeController(int uid) {
|
||||
if (mAudioManagerInternal != null) {
|
||||
final int vcuid = mAudioManagerInternal.getVolumeControllerUid();
|
||||
if (vcuid > 0 && uid == vcuid) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void enforceSystemUiPermission(String action, int pid, int uid) {
|
||||
if (isCurrentVolumeController(uid)) return;
|
||||
if (getContext().checkPermission(android.Manifest.permission.STATUS_BAR_SERVICE,
|
||||
pid, uid) != PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException("Only system ui may " + action);
|
||||
|
||||
Reference in New Issue
Block a user