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

Commit 74c3785a authored by myfluxi's avatar myfluxi Committed by Bruno Martins
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 4b9439b5
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -650,7 +650,7 @@ Status AudioPolicyService::getInputForAttr(const media::AudioAttributesInternal&
    // type is API_INPUT_MIX_EXT_POLICY_REROUTE and by AudioService if a media projection
    // is used and input type is API_INPUT_MIX_PUBLIC_CAPTURE_PLAYBACK
    // - ECHO_REFERENCE source is controlled by captureAudioOutputAllowed()
    if (!(recordingAllowed(adjAttributionSource, inputSource)
    if (!isAudioServerOrMediaServerUid(callingUid) && !(recordingAllowed(adjAttributionSource, inputSource)
            || inputSource == AUDIO_SOURCE_FM_TUNER
            || inputSource == AUDIO_SOURCE_REMOTE_SUBMIX
            || inputSource == AUDIO_SOURCE_ECHO_REFERENCE)) {
@@ -731,7 +731,7 @@ Status AudioPolicyService::getInputForAttr(const media::AudioAttributesInternal&
                // FIXME: use the same permission as for remote submix for now.
                FALLTHROUGH_INTENDED;
            case AudioPolicyInterface::API_INPUT_MIX_CAPTURE:
                if (!canCaptureOutput) {
                if (!isAudioServerOrMediaServerUid(callingUid) && !canCaptureOutput) {
                    ALOGE("%s permission denied: capture not allowed", __func__);
                    status = PERMISSION_DENIED;
                }
@@ -816,7 +816,8 @@ 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
            || client->attributes.source == AUDIO_SOURCE_REMOTE_SUBMIX