From 940b28bc37f819c62386e393614354f55069e8f6 Mon Sep 17 00:00:00 2001 From: Scott Mertz Date: Wed, 6 Jul 2016 10:18:52 -0700 Subject: Enforce permission for accessing fm tuner Change-Id: I13f3ba8fc9caaeee21597a2405a8c3629e985502 --- services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp | 5 +++++ services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'services/audiopolicy') diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp index f0be341..b23c35e 100644 --- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp +++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp @@ -316,6 +316,11 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, if ((attr->source == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) { return BAD_VALUE; } + + if ((attr->source == AUDIO_SOURCE_FM_TUNER) && !accessFmRadioAllowed()) { + return BAD_VALUE; + } + spaudioPolicyEffects; status_t status; AudioPolicyInterface::input_type_t inputType; diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp index 0aad54d..da7f45d 100644 --- a/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp +++ b/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp @@ -275,6 +275,10 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, return BAD_VALUE; } + if ((inputSource == AUDIO_SOURCE_FM_TUNER) && !accessFmRadioAllowed()) { + return BAD_VALUE; + } + #ifdef HAVE_PRE_KITKAT_AUDIO_POLICY_BLOB if (inputSource == AUDIO_SOURCE_HOTWORD) inputSource = AUDIO_SOURCE_VOICE_RECOGNITION; -- cgit v1.1