From 5f2f804a19ecf511d069ebbda6cc69a07fa7b13d Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 3 Mar 2016 11:50:39 -0800 Subject: [PATCH] Camera: Fix error handling for reading in vendor tags - Fix bad format string for the unexpected error case - Add expected error case for devices with no camera HAL module Bug: 27465574 Change-Id: I0e77a689df402de96553b81274be85da7397e08e --- core/jni/android_hardware_camera2_CameraMetadata.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp index afccfcfe5cef5..f37fd78f6bdd5 100644 --- a/core/jni/android_hardware_camera2_CameraMetadata.cpp +++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp @@ -918,15 +918,14 @@ static jint CameraMetadata_setupGlobalVendorTagDescriptor(JNIEnv *env, jobject t sp desc = new VendorTagDescriptor(); binder::Status res = cameraService->getCameraVendorTagDescriptor(/*out*/desc.get()); - if (res.serviceSpecificErrorCode() == hardware::ICameraService::ERROR_DEPRECATED_HAL) { - ALOGW("%s: Camera HAL too old; does not support vendor tags", __FUNCTION__); + if (res.serviceSpecificErrorCode() == hardware::ICameraService::ERROR_DISCONNECTED) { + // No camera module available, not an error on devices with no cameras VendorTagDescriptor::clearGlobalVendorTagDescriptor(); - return OK; } else if (!res.isOk()) { - ALOGE("%s: Failed to setup vendor tag descriptors: %s: %s", - __FUNCTION__, res.serviceSpecificErrorCode(), - res.toString8().string()); + VendorTagDescriptor::clearGlobalVendorTagDescriptor(); + ALOGE("%s: Failed to setup vendor tag descriptors: %s", + __FUNCTION__, res.toString8().string()); return res.serviceSpecificErrorCode(); }