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

Commit 694cd471 authored by Jayant Chowdhary's avatar Jayant Chowdhary
Browse files

camera2 ndk: Fix error code passed on ACameraDevice_ErrorStateCallback.



The error code passed to the camera2 ndk while calling the
ACameraDevice_ErrorStateCallback was the AIDL errorCode passed through
the ICameraDeviceCallbacks::onDeviceError() callback. These error codes
do not map directly, to the ones promised through the ndk in
NdkCameraDevice.h. These need to be fixed to appropriate ndk error code mappings.

Bug: 117833501

Test: GCA (sanity)
Test: CTS Native camera2 tests (sanity)

Change-Id: I65a80e4f2be5a3317a008bf0a71578e31fb45d62
Signed-off-by: default avatarJayant Chowdhary <jchowdhary@google.com>
parent 1ef73503
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1294,12 +1294,17 @@ CameraDevice::ServiceCallback::onDeviceError(
        case ERROR_CAMERA_DEVICE:
        case ERROR_CAMERA_SERVICE:
        {
            int32_t errorVal = ::ERROR_CAMERA_DEVICE;
            // We keep this switch since this block might be encountered with
            // more than just 2 states. The default fallthrough could have us
            // handling more unmatched error cases.
            switch (errorCode) {
                case ERROR_CAMERA_DEVICE:
                    dev->setCameraDeviceErrorLocked(ACAMERA_ERROR_CAMERA_DEVICE);
                    break;
                case ERROR_CAMERA_SERVICE:
                    dev->setCameraDeviceErrorLocked(ACAMERA_ERROR_CAMERA_SERVICE);
                    errorVal = ::ERROR_CAMERA_SERVICE;
                    break;
                default:
                    dev->setCameraDeviceErrorLocked(ACAMERA_ERROR_UNKNOWN);
@@ -1309,7 +1314,7 @@ CameraDevice::ServiceCallback::onDeviceError(
            msg->setPointer(kContextKey, dev->mAppCallbacks.context);
            msg->setPointer(kDeviceKey, (void*) dev->getWrapper());
            msg->setPointer(kCallbackFpKey, (void*) dev->mAppCallbacks.onError);
            msg->setInt32(kErrorCodeKey, errorCode);
            msg->setInt32(kErrorCodeKey, errorVal);
            msg->post();
            break;
        }