Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c605f65 authored by Nadav Bar's avatar Nadav Bar
Browse files

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
parent 49f36ba3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2123,7 +2123,10 @@ status_t AudioPolicyManager::setStreamVolumeIndex(audio_stream_type_t stream,
                                                  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;
    }