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

Commit 386bc665 authored by Atneya Nair's avatar Atneya Nair
Browse files

Fix MMAP stream perm check

Fix issue in refactoring APM permission checking where the MMAP path
was missing a call to the perm check.

Fixes: 380479018
Flag: EXEMPT bugfix
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I85b9a8329c988d469d28f45e06c1d159a127ef7c
parent 21398d59
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3013,6 +3013,18 @@ AudioPolicyManager::getInputForAttr(audio_attributes_t attributes,
        }
        device = inputDesc->getDevice();
        ALOGV("%s reusing MMAP input %d for session %d", __FUNCTION__, requestedInput, session);
        auto permRes = mpClientInterface->checkPermissionForInput(attributionSource, permReq);
        if (!permRes.has_value()) return base::unexpected {permRes.error()};
        if (!permRes.value()) {
            return base::unexpected{Status::fromExceptionCode(
                    EX_SECURITY, String8::format("%s: %s missing perms for source %d mix %d vdi %d"
                        "hotword? %d callredir? %d", __func__, attributionSource.toString().c_str(),
                                                 static_cast<int>(permReq.source),
                                                 static_cast<int>(permReq.mixType),
                                                 permReq.virtualDeviceId,
                                                 permReq.isHotword,
                                                 permReq.isCallRedir))};
        }
    } else {
        if (attributes.source == AUDIO_SOURCE_REMOTE_SUBMIX &&
                extractAddressFromAudioAttributes(attributes).has_value()) {