summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEllie Yang <shusyuan@google.com>2020-06-29 09:25:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-29 09:25:28 +0000
commitb0f83a476327493d0837a2392f8c7f694746e20a (patch)
treefd6af40d4e3c6d7286a2f69c28252b47115596b7
parent00b34b84295b116730baceded947509507f14228 (diff)
parent7192b8d31a8e560f4117fe21a52ad0a19b9ac5be (diff)
downloadcamera-b0f83a476327493d0837a2392f8c7f694746e20a.tar.gz
Merge "hidl: Allow more error types to propagate from hal to fwk" into rvc-d1-dev
-rw-r--r--common/hal/hidl_service/hidl_utils.cc8
-rw-r--r--common/hal/hidl_service/hidl_utils.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/common/hal/hidl_service/hidl_utils.cc b/common/hal/hidl_service/hidl_utils.cc
index 291fa3f..7967a43 100644
--- a/common/hal/hidl_service/hidl_utils.cc
+++ b/common/hal/hidl_service/hidl_utils.cc
@@ -128,8 +128,16 @@ Status ConvertToHidlStatus(status_t hal_status) {
return Status::OK;
case BAD_VALUE:
return Status::ILLEGAL_ARGUMENT;
+ case -EBUSY:
+ return Status::CAMERA_IN_USE;
+ case -EUSERS:
+ return Status::MAX_CAMERAS_IN_USE;
+ case UNKNOWN_TRANSACTION:
+ return Status::METHOD_NOT_SUPPORTED;
case INVALID_OPERATION:
return Status::OPERATION_NOT_SUPPORTED;
+ case DEAD_OBJECT:
+ return Status::CAMERA_DISCONNECTED;
default:
return Status::INTERNAL_ERROR;
}
diff --git a/common/hal/hidl_service/hidl_utils.h b/common/hal/hidl_service/hidl_utils.h
index 2116eed..72b0ac0 100644
--- a/common/hal/hidl_service/hidl_utils.h
+++ b/common/hal/hidl_service/hidl_utils.h
@@ -92,6 +92,11 @@ status_t ConverToHidlNotifyMessage(
// Convert from HAL status_t to HIDL Status
// OK is converted to Status::OK.
// BAD_VALUE is converted to Status::ILLEGAL_ARGUMENT.
+// -EBUSY is converted to Status::CAMERA_IN_USE.
+// -EUSERS is converted to Status::MAX_CAMERAS_IN_USE.
+// UNKNOWN_TRANSACTION is converted to Status::METHOD_NOT_SUPPORTED.
+// INVALID_OPERATION is converted to Status::OPERATION_NOT_SUPPORTED.
+// DEAD_OBJECT is converted to Status::CAMERA_DISCONNECTED.
// All other errors are converted to Status::INTERNAL_ERROR.
Status ConvertToHidlStatus(status_t hal_status);