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
diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp
index afccfcf..f37fd78 100644
--- a/core/jni/android_hardware_camera2_CameraMetadata.cpp
+++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp
@@ -918,15 +918,14 @@
sp<VendorTagDescriptor> 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();
}