Check if calling uid is system uid for setAllowedPolicyCapture.

AudioSystem.setAllowedPolicyCapture is only called from audio service.
In that case, checking if the calling uid is system uid to before taking
action.

Bug: 145115448
Test: dumpsys audio, query active playback configuration
Change-Id: I614ac881ecde6bad13f22f1382de701f314a7ada
gugelfrei
jiabin 5 years ago committed by Eric Laurent
parent 31f9891041
commit 140a34fbfe

@ -1451,7 +1451,8 @@ status_t BnAudioPolicyService::onTransact(
case SET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY:
case REMOVE_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY:
case GET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY:
case GET_DEVICES_FOR_ATTRIBUTES: {
case GET_DEVICES_FOR_ATTRIBUTES:
case SET_ALLOWED_CAPTURE_POLICY: {
if (!isServiceUid(IPCThreadState::self()->getCallingUid())) {
ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
__func__, code, IPCThreadState::self()->getCallingPid(),

@ -1008,11 +1008,6 @@ status_t AudioPolicyService::setAllowedCapturePolicy(uid_t uid, audio_flags_mask
ALOGV("%s() mAudioPolicyManager == NULL", __func__);
return NO_INIT;
}
uint_t callingUid = IPCThreadState::self()->getCallingUid();
if (uid != callingUid) {
ALOGD("%s() uid invalid %d != %d", __func__, uid, callingUid);
return PERMISSION_DENIED;
}
return mAudioPolicyManager->setAllowedCapturePolicy(uid, capturePolicy);
}

Loading…
Cancel
Save