summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-09-22 14:17:38 -0700
committerEric Laurent <elaurent@google.com>2010-09-22 15:58:38 -0700
commitfac4895de4ae63928ff0cf2ccece106eb6d33f72 (patch)
tree38909e0176ac47546dd9c58390a38db07f406444 /services
parent9fb467e5c50795afda3675efd5ba0e5cd552fd75 (diff)
downloadframeworks_av-fac4895de4ae63928ff0cf2ccece106eb6d33f72.zip
frameworks_av-fac4895de4ae63928ff0cf2ccece106eb6d33f72.tar.gz
frameworks_av-fac4895de4ae63928ff0cf2ccece106eb6d33f72.tar.bz2
Request permission for global audio effects.
Applications creating an audio effect on the output mix must have the MODIFY_AUDIO_SETTINGS permission. Change-Id: I57d88533f91ad0d33680107d79abcec28f7263b5
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 886c25b..56de765 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -4656,13 +4656,25 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
{
Mutex::Autolock _l(mLock);
+ // check audio settings permission for global effects
+ if (sessionId == AudioSystem::SESSION_OUTPUT_MIX && !settingsAllowed()) {
+ lStatus = PERMISSION_DENIED;
+ goto Exit;
+ }
+
+ // Session AudioSystem::SESSION_OUTPUT_STAGE is reserved for output stage effects
+ // that can only be created by audio policy manager (running in same process)
+ if (sessionId == AudioSystem::SESSION_OUTPUT_STAGE && getpid() != pid) {
+ lStatus = PERMISSION_DENIED;
+ goto Exit;
+ }
+
// check recording permission for visualizer
- if (memcmp(&pDesc->type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0 ||
- memcmp(&pDesc->uuid, &VISUALIZATION_UUID_, sizeof(effect_uuid_t)) == 0) {
- if (!recordingAllowed()) {
- lStatus = PERMISSION_DENIED;
- goto Exit;
- }
+ if ((memcmp(&pDesc->type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0 ||
+ memcmp(&pDesc->uuid, &VISUALIZATION_UUID_, sizeof(effect_uuid_t)) == 0) &&
+ !recordingAllowed()) {
+ lStatus = PERMISSION_DENIED;
+ goto Exit;
}
if (!EffectIsNullUuid(&pDesc->uuid)) {
@@ -4727,14 +4739,6 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
goto Exit;
}
- // Session AudioSystem::SESSION_OUTPUT_STAGE is reserved for output stage effects
- // that can only be created by audio policy manager (running in same process)
- if (sessionId == AudioSystem::SESSION_OUTPUT_STAGE &&
- getpid() != pid) {
- lStatus = INVALID_OPERATION;
- goto Exit;
- }
-
// return effect descriptor
memcpy(pDesc, &desc, sizeof(effect_descriptor_t));