Merge "Improve effect AIDL HAL logging" into main am: e26729ae76 am: 70ce590f52

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3080653

Change-Id: If000f13854811d779625074606710da4600bcc03
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shunkai Yao 2024-05-10 02:38:45 +00:00 committed by Automerger Merge Worker
commit e3396f81f3

View file

@ -75,49 +75,49 @@ inline std::ostream& operator<<(std::ostream& out, const RetCode& code) {
return out << "EnumError: " << code;
}
#define RETURN_IF_ASTATUS_NOT_OK(status, message) \
do { \
const ::ndk::ScopedAStatus curr_status = (status); \
if (!curr_status.isOk()) { \
LOG(ERROR) << __func__ << ":" << __LINE__ \
<< "return with status: " << curr_status.getDescription() << (message); \
return ndk::ScopedAStatus::fromExceptionCodeWithMessage( \
curr_status.getExceptionCode(), (message)); \
} \
#define RETURN_IF_ASTATUS_NOT_OK(status, message) \
do { \
const ::ndk::ScopedAStatus curr_status = (status); \
if (!curr_status.isOk()) { \
LOG(ERROR) << __func__ << ": line" << __LINE__ \
<< " return with status: " << curr_status.getDescription() << (message); \
return ndk::ScopedAStatus::fromExceptionCodeWithMessage( \
curr_status.getExceptionCode(), (message)); \
} \
} while (0)
#define RETURN_IF(expr, exception, message) \
do { \
if (expr) { \
LOG(ERROR) << __func__ << ":" << __LINE__ << " return with expr " << #expr; \
LOG(ERROR) << __func__ << ": line" << __LINE__ << " return with expr " << #expr; \
return ndk::ScopedAStatus::fromExceptionCodeWithMessage((exception), (message)); \
} \
} while (0)
#define RETURN_OK_IF(expr) \
do { \
if (expr) { \
LOG(INFO) << __func__ << ":" << __LINE__ << " return with expr " << #expr; \
return ndk::ScopedAStatus::ok(); \
} \
#define RETURN_OK_IF(expr) \
do { \
if (expr) { \
LOG(INFO) << __func__ << ": line" << __LINE__ << " return with expr " << #expr; \
return ndk::ScopedAStatus::ok(); \
} \
} while (0)
#define RETURN_VALUE_IF(expr, ret, log) \
do { \
if (expr) { \
LOG(ERROR) << __func__ << ":" << __LINE__ << " return with expr \"" << #expr \
<< "\":" << (log); \
return ret; \
} \
#define RETURN_VALUE_IF(expr, ret, log) \
do { \
if (expr) { \
LOG(ERROR) << __func__ << ": line" << __LINE__ << " return with expr \"" << #expr \
<< "\":" << (log); \
return ret; \
} \
} while (0)
#define RETURN_IF_BINDER_EXCEPTION(functor) \
{ \
binder_exception_t exception = functor; \
if (EX_NONE != exception) { \
LOG(ERROR) << #functor << ": failed with error " << exception; \
return ndk::ScopedAStatus::fromExceptionCode(exception); \
} \
#define RETURN_IF_BINDER_EXCEPTION(functor) \
{ \
binder_exception_t exception = functor; \
if (EX_NONE != exception) { \
LOG(ERROR) << #functor << ": failed with error " << exception; \
return ndk::ScopedAStatus::fromExceptionCode(exception); \
} \
}
/**