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

Unverified Commit 8dd4bfb0 authored by myfluxi's avatar myfluxi Committed by Michael Bestas
Browse files

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
parent 3887abbd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -592,7 +592,7 @@ Status AudioPolicyService::getInputForAttr(const media::AudioAttributesInternal&
    // Capturing from FM_TUNER source is controlled by captureTunerAudioInputAllowed() and
    // captureAudioOutputAllowed() (deprecated) as this does not affect users privacy
    // as does capturing from an actual microphone.
    if (!(recordingAllowed(adjAttributionSource, attr.source)
    if (!isAudioServerOrMediaServerUid(callingUid) && !(recordingAllowed(adjAttributionSource, attr.source)
            || attr.source == AUDIO_SOURCE_FM_TUNER)) {
        ALOGE("%s permission denied: recording not allowed for %s",
                __func__, adjAttributionSource.toString().c_str());
@@ -654,7 +654,7 @@ Status AudioPolicyService::getInputForAttr(const media::AudioAttributesInternal&
            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;
                }
@@ -737,7 +737,7 @@ Status AudioPolicyService::startInput(int32_t portIdAidl)
    msg << "Audio recording on session " << client->session;

    // check calling permissions
    if (!(startRecording(client->attributionSource, String16(msg.str().c_str()),
    if (!isAudioServerOrMediaServerUid(IPCThreadState::self()->getCallingUid()) && !(startRecording(client->attributionSource, String16(msg.str().c_str()),
        client->attributes.source)
            || client->attributes.source == AUDIO_SOURCE_FM_TUNER)) {
        ALOGE("%s permission denied: recording not allowed for attribution source %s",