diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index 39f3b317d2100..e8a59603c02c7 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -1010,7 +1010,8 @@ public class AudioSystem (1 << STREAM_RING) | (1 << STREAM_NOTIFICATION) | (1 << STREAM_SYSTEM) | - (1 << STREAM_VOICE_CALL); + (1 << STREAM_VOICE_CALL) | + (1 << STREAM_BLUETOOTH_SCO); /** * Event posted by AudioTrack and AudioRecord JNI (JNIDeviceCallback) when routing changes. diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 6cc0e6153a33d..455a3e302480e 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -1163,11 +1163,13 @@ public class AudioService extends IAudioService.Stub private void checkMuteAffectedStreams() { // any stream with a min level > 0 is not muteable by definition - // STREAM_VOICE_CALL can be muted by applications that has the the MODIFY_PHONE_STATE permission. + // STREAM_VOICE_CALL and STREAM_BLUETOOTH_SCO can be muted by applications + // that has the the MODIFY_PHONE_STATE permission. for (int i = 0; i < mStreamStates.length; i++) { final VolumeStreamState vss = mStreamStates[i]; if (vss.mIndexMin > 0 && - vss.mStreamType != AudioSystem.STREAM_VOICE_CALL) { + (vss.mStreamType != AudioSystem.STREAM_VOICE_CALL && + vss.mStreamType != AudioSystem.STREAM_BLUETOOTH_SCO)) { mMuteAffectedStreams &= ~(1 << vss.mStreamType); } } @@ -1617,10 +1619,11 @@ public class AudioService extends IAudioService.Stub return; } - // If adjust is mute and the stream is STREAM_VOICE_CALL, make sure + // If adjust is mute and the stream is STREAM_VOICE_CALL or STREAM_BLUETOOTH_SCO, make sure // that the calling app have the MODIFY_PHONE_STATE permission. if (isMuteAdjust && - streamType == AudioSystem.STREAM_VOICE_CALL && + (streamType == AudioSystem.STREAM_VOICE_CALL || + streamType == AudioSystem.STREAM_BLUETOOTH_SCO) && mContext.checkCallingOrSelfPermission( android.Manifest.permission.MODIFY_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { @@ -1937,12 +1940,14 @@ public class AudioService extends IAudioService.Stub + " CHANGE_ACCESSIBILITY_VOLUME callingPackage=" + callingPackage); return; } - if ((streamType == AudioManager.STREAM_VOICE_CALL) && + if ((streamType == AudioManager.STREAM_VOICE_CALL || + streamType == AudioManager.STREAM_BLUETOOTH_SCO) && (index == 0) && (mContext.checkCallingOrSelfPermission( android.Manifest.permission.MODIFY_PHONE_STATE) != PackageManager.PERMISSION_GRANTED)) { - Log.w(TAG, "Trying to call setStreamVolume() for STREAM_VOICE_CALL and index 0 without" + Log.w(TAG, "Trying to call setStreamVolume() for STREAM_VOICE_CALL or" + + " STREAM_BLUETOOTH_SCO and index 0 without" + " MODIFY_PHONE_STATE callingPackage=" + callingPackage); return; }