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
This commit is contained in:
Eino-Ville Talvala
2016-03-03 11:50:39 -08:00
parent 1ca7c80844
commit 5f2f804a19

View File

@@ -918,15 +918,14 @@ static jint CameraMetadata_setupGlobalVendorTagDescriptor(JNIEnv *env, jobject t
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();
}