AudioPolicy: enable phone apps to mute VOICE_CALL stream

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

Bug: 71017199
Fixes: 71017199
Test: Tested manually
Change-Id: Ibbf3b6948a4384a963d00347ebd04ccf6d56ebd5
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 68730a5..33f31e0 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -2123,7 +2123,10 @@
                                                   audio_devices_t device)
 {
 
-    if ((index < mVolumeCurves->getVolumeIndexMin(stream)) ||
+    // VOICE_CALL stream has 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)) ||
             (index > mVolumeCurves->getVolumeIndexMax(stream))) {
         return BAD_VALUE;
     }