Camera: Fix client permission check
Modify StageFright's CameraSource to forward calling PID as
client PID when connecting to CameraService so CameraService
can check if the client PID has permission to use camera.
Change CameraService to check calling UID is trusted before
using the passed in client PID and client UID to verify permission.
Bug: 24511454
Change-Id: I4906ab73510e2c75714690bed675e3c13aca3ccf
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index c17fc65..5ac5743 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -371,7 +371,7 @@
ATRACE_CALL();
Mutex::Autolock icl(mBinderSerializationLock);
- // Allow both client and the media server to disconnect at all times
+ // Allow both client and the cameraserver to disconnect at all times
int callingPid = getCallingPid();
if (callingPid != mClientPid && callingPid != mServicePid) return;
@@ -1233,6 +1233,7 @@
}
void Camera2Client::releaseRecordingFrame(const sp<IMemory>& mem) {
+ (void)mem;
ATRACE_CALL();
ALOGW("%s: Not supported in buffer queue mode.", __FUNCTION__);
}