diff options
author | myfluxi <myfluxi@users.noreply.github.com> | 2020-04-16 12:53:23 +0000 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2021-09-03 22:15:17 +0200 |
commit | d6357492605501092ebf0c13082088fa4b5f1ac8 (patch) | |
tree | 85c1eac8a3acc1fc066c5787e0a2b5a6aef6890c | |
parent | 9009eefddc99692e691697ea9e75f7768234e053 (diff) |
audioflinger: Fix audio for WifiDisplay
AudioFlinger is not able to determine the correct
pid/tid for WifiDisplay and thus we do not pass checks
for CAPTURE_AUDIO_OUTPUT and RECORD_AUDIO permissions.
To fix audio for WifiDisplay, it should be safe to
always allow a trusted calling uid (AID_MEDIA which
has the same perms as AID_AUDIOSERVER).
Change-Id: Ifa46d8e77a43027645cad02a04263b58e134c3ad
-rw-r--r-- | services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp index 0b15713c66..751759af50 100644 --- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp +++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp @@ -475,7 +475,7 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, // check calling permissions. // Capturing from FM_TUNER source is controlled by captureAudioOutputAllowed() only as this // does not affect users privacy as does capturing from an actual microphone. - if (!(recordingAllowed(opPackageName, pid, uid) || attr->source == AUDIO_SOURCE_FM_TUNER)) { + if (!isAudioServerOrMediaServerUid(callingUid) && !(recordingAllowed(opPackageName, pid, uid) || attr->source == AUDIO_SOURCE_FM_TUNER)) { ALOGE("%s permission denied: recording not allowed for uid %d pid %d", __func__, uid, pid); return PERMISSION_DENIED; @@ -523,7 +523,7 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, case AudioPolicyInterface::API_INPUT_TELEPHONY_RX: // FIXME: use the same permission as for remote submix for now. case AudioPolicyInterface::API_INPUT_MIX_CAPTURE: - if (!canCaptureOutput) { + if (!isAudioServerOrMediaServerUid(callingUid) && !canCaptureOutput) { ALOGE("getInputForAttr() permission denied: capture not allowed"); status = PERMISSION_DENIED; } @@ -592,7 +592,7 @@ status_t AudioPolicyService::startInput(audio_port_handle_t portId) } // check calling permissions - if (!(startRecording(client->opPackageName, client->pid, client->uid, + if (!isAudioServerOrMediaServerUid(IPCThreadState::self()->getCallingUid()) && !(startRecording(client->opPackageName, client->pid, client->uid, client->attributes.source == AUDIO_SOURCE_HOTWORD) || client->attributes.source == AUDIO_SOURCE_FM_TUNER)) { ALOGE("%s permission denied: recording not allowed for uid %d pid %d", |