Fix HidlReturnRestriction for operator= case.
elsk@ noticed we were missing this case.
Bug: N/A
Test: added test fails w/o fix, but now succeeds
Change-Id: I2984e7b680144a7fe0d243e45be80461149176c8
diff --git a/base/Status.cpp b/base/Status.cpp
index 08631cc..7698ff8 100644
--- a/base/Status.cpp
+++ b/base/Status.cpp
@@ -155,6 +155,20 @@
}
}
+ void return_status::onIgnored() const {
+ if (gReturnRestriction == HidlReturnRestriction::NONE) {
+ return;
+ }
+
+ if (gReturnRestriction == HidlReturnRestriction::ERROR_IF_UNCHECKED) {
+ LOG(ERROR) << "Failed to check status of HIDL Return.";
+ CallStack::logStack("unchecked HIDL return", CallStack::getCurrent(10).get(),
+ ANDROID_LOG_ERROR);
+ } else {
+ LOG(FATAL) << "Failed to check status of HIDL Return.";
+ }
+ }
+
void return_status::assertOk() const {
if (!isOk()) {
LOG(FATAL) << "Failed HIDL return status not checked. Usually this happens because of "
@@ -171,22 +185,13 @@
if (mCheckedStatus) return;
assertOk();
-
- if (gReturnRestriction == HidlReturnRestriction::NONE) {
- return;
- }
-
- if (gReturnRestriction == HidlReturnRestriction::ERROR_IF_UNCHECKED) {
- LOG(ERROR) << "Failed to check status of HIDL Return.";
- CallStack::logStack("unchecked HIDL return", CallStack::getCurrent(10).get(), ANDROID_LOG_ERROR);
- } else {
- LOG(FATAL) << "Failed to check status of HIDL Return.";
- }
+ onIgnored();
}
return_status& return_status::operator=(return_status&& other) noexcept {
if (!mCheckedStatus) {
assertOk();
+ onIgnored();
}
std::swap(mStatus, other.mStatus);