summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/api1
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2014-08-07 17:07:28 -0700
committerIgor Murashkin <iam@google.com>2014-08-07 17:07:28 -0700
commitebe865b175b3f1b2a9212cea7b008937c919d8f3 (patch)
tree4a6eebdeb73ec03ce494888a8278bc96675f5444 /services/camera/libcameraservice/api1
parentc80863e922cb94122b783ef31ce18cf58471f546 (diff)
downloadframeworks_av-ebe865b175b3f1b2a9212cea7b008937c919d8f3.zip
frameworks_av-ebe865b175b3f1b2a9212cea7b008937c919d8f3.tar.gz
frameworks_av-ebe865b175b3f1b2a9212cea7b008937c919d8f3.tar.bz2
camera: Allow Camera#getParameters to be called by mediaserver anytime
This fixes a crash if the camera was locked by the media recorder and another process tried to get the legacy parameters (for the camera characteristics). Bug: 16695955 Change-Id: I945a16a686a6987150c8754b5296353e76e5afa0
Diffstat (limited to 'services/camera/libcameraservice/api1')
-rw-r--r--services/camera/libcameraservice/api1/Camera2Client.cpp3
-rw-r--r--services/camera/libcameraservice/api1/CameraClient.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index 046988e..5eb5181 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -1368,7 +1368,8 @@ String8 Camera2Client::getParameters() const {
ATRACE_CALL();
ALOGV("%s: Camera %d", __FUNCTION__, mCameraId);
Mutex::Autolock icl(mBinderSerializationLock);
- if ( checkPid(__FUNCTION__) != OK) return String8();
+ // The camera service can unconditionally get the parameters at all times
+ if (getCallingPid() != mServicePid && checkPid(__FUNCTION__) != OK) return String8();
SharedParameters::ReadLock l(mParameters);
diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp
index 517226d..fb6b678 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -556,7 +556,8 @@ status_t CameraClient::setParameters(const String8& params) {
// get preview/capture parameters - key/value pairs
String8 CameraClient::getParameters() const {
Mutex::Autolock lock(mLock);
- if (checkPidAndHardware() != NO_ERROR) return String8();
+ // The camera service can unconditionally get the parameters at all times
+ if (getCallingPid() != mServicePid && checkPidAndHardware() != NO_ERROR) return String8();
String8 params(mHardware->getParameters().flatten());
LOG1("getParameters (pid %d) (%s)", getCallingPid(), params.string());