AudioPolicy: enable apps to mute BLUETOOTH_SCO

This change enables an app that has the MODIFY_PHONE_STATE
permission to mute the BULETOOTH_SCO stream.
The change adds specific handling in AudioPolicyManager
for the case in which volume index is 0 and stream type is
BLUETOOTH_SCO.
The permission check is done in the AudioService Java code for the
calling process.

Bug: 111195322
Test: Tested manually
Change-Id: I5085826a7287dfbc2cfb17a9bd2d3ca1af66ea4a
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 23cc02e..15e2c36 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -2255,10 +2255,11 @@
                                                   audio_devices_t device)
 {
 
-    // VOICE_CALL stream has minVolumeIndex > 0  but can be muted directly by an
-    // app that has MODIFY_PHONE_STATE permission.
+    // VOICE_CALL and BLUETOOTH_SCO stream have minVolumeIndex > 0 but
+    // can be muted directly by an app that has MODIFY_PHONE_STATE permission.
     if (((index < mVolumeCurves->getVolumeIndexMin(stream)) &&
-            !(stream == AUDIO_STREAM_VOICE_CALL && index == 0)) ||
+            !((stream == AUDIO_STREAM_VOICE_CALL || stream == AUDIO_STREAM_BLUETOOTH_SCO) &&
+            index == 0)) ||
             (index > mVolumeCurves->getVolumeIndexMax(stream))) {
         return BAD_VALUE;
     }