Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebe865b1 authored by Igor Murashkin's avatar Igor Murashkin
Browse files

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
parent c80863e9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);

+2 −1
Original line number Diff line number Diff line
@@ -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());