Merge change 2163 into donut

* changes:
  Fix permission hole for RECORD_AUDIO created when we moved the MediaRecorder implementation to the mediaserver process. The permission check was previously enforced only at the AudioRecord binder interface for clients not in the same process. This change adds an additional check when the client tries to set the audio source. Bug 1868334
This commit is contained in:
Android (Google) Code Review
2009-05-20 19:57:12 -07:00

View File

@@ -37,6 +37,7 @@
namespace android {
const char* cameraPermission = "android.permission.CAMERA";
const char* recordAudioPermission = "android.permission.RECORD_AUDIO";
static bool checkPermission(const char* permissionString) {
#ifndef HAVE_ANDROID_OS
@@ -86,6 +87,9 @@ status_t MediaRecorderClient::setVideoSource(int vs)
status_t MediaRecorderClient::setAudioSource(int as)
{
LOGV("setAudioSource(%d)", as);
if (!checkPermission(recordAudioPermission)) {
return PERMISSION_DENIED;
}
Mutex::Autolock lock(mLock);
if (mRecorder == NULL) {
LOGE("recorder is not initialized");