Merge "Request permission for global audio effects." into gingerbread
This commit is contained in:
@ -4656,13 +4656,25 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
{
|
{
|
||||||
Mutex::Autolock _l(mLock);
|
Mutex::Autolock _l(mLock);
|
||||||
|
|
||||||
// check recording permission for visualizer
|
// check audio settings permission for global effects
|
||||||
if (memcmp(&pDesc->type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0 ||
|
if (sessionId == AudioSystem::SESSION_OUTPUT_MIX && !settingsAllowed()) {
|
||||||
memcmp(&pDesc->uuid, &VISUALIZATION_UUID_, sizeof(effect_uuid_t)) == 0) {
|
|
||||||
if (!recordingAllowed()) {
|
|
||||||
lStatus = PERMISSION_DENIED;
|
lStatus = PERMISSION_DENIED;
|
||||||
goto Exit;
|
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) &&
|
||||||
|
!recordingAllowed()) {
|
||||||
|
lStatus = PERMISSION_DENIED;
|
||||||
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EffectIsNullUuid(&pDesc->uuid)) {
|
if (!EffectIsNullUuid(&pDesc->uuid)) {
|
||||||
@ -4727,14 +4739,6 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid,
|
|||||||
goto Exit;
|
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
|
// return effect descriptor
|
||||||
memcpy(pDesc, &desc, sizeof(effect_descriptor_t));
|
memcpy(pDesc, &desc, sizeof(effect_descriptor_t));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user