[automerger skipped] VTSHalAudio: Increase test timeout for V6, V7.x to 10 minutes am: 83cf51eb33 am: 23ce0e42c1 am: bb267a1af6 -s ours
am skip reason: Merged-In Id7fa8eaa98bf2437fd1f676b9e5a7290df260fbd with SHA-1 0b9b03eb71 is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/17921237
Change-Id: I95e88571a891241f704a777aa84494f4fff1d8fe
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/neuralnetworks/utils/adapter/aidl/src/Device.cpp b/neuralnetworks/utils/adapter/aidl/src/Device.cpp
index 1b90a1a..453ec9b 100644
--- a/neuralnetworks/utils/adapter/aidl/src/Device.cpp
+++ b/neuralnetworks/utils/adapter/aidl/src/Device.cpp
@@ -135,16 +135,26 @@
return ndk::SharedRefBase::make<PreparedModel>(std::move(preparedModel));
}
+void notify(IPreparedModelCallback* callback, ErrorStatus status,
+ const std::shared_ptr<IPreparedModel>& preparedModel) {
+ if (callback != nullptr) {
+ const auto ret = callback->notify(status, preparedModel);
+ if (!ret.isOk()) {
+ LOG(ERROR) << "IPreparedModelCallback::notify failed with " << ret.getDescription();
+ }
+ }
+}
+
void notify(IPreparedModelCallback* callback, PrepareModelResult result) {
if (!result.has_value()) {
const auto& [message, status] = result.error();
LOG(ERROR) << message;
const auto aidlCode = utils::convert(status).value_or(ErrorStatus::GENERAL_FAILURE);
- callback->notify(aidlCode, nullptr);
+ notify(callback, aidlCode, nullptr);
} else {
auto preparedModel = std::move(result).value();
auto aidlPreparedModel = adaptPreparedModel(std::move(preparedModel));
- callback->notify(ErrorStatus::NONE, std::move(aidlPreparedModel));
+ notify(callback, ErrorStatus::NONE, std::move(aidlPreparedModel));
}
}
@@ -284,7 +294,7 @@
if (!result.has_value()) {
const auto& [message, code] = result.error();
const auto aidlCode = utils::convert(code).value_or(ErrorStatus::GENERAL_FAILURE);
- callback->notify(aidlCode, nullptr);
+ notify(callback.get(), aidlCode, nullptr);
return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
static_cast<int32_t>(aidlCode), message.c_str());
}
@@ -300,7 +310,7 @@
if (!result.has_value()) {
const auto& [message, code] = result.error();
const auto aidlCode = utils::convert(code).value_or(ErrorStatus::GENERAL_FAILURE);
- callback->notify(aidlCode, nullptr);
+ notify(callback.get(), aidlCode, nullptr);
return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
static_cast<int32_t>(aidlCode), message.c_str());
}
@@ -317,7 +327,7 @@
if (!result.has_value()) {
const auto& [message, code] = result.error();
const auto aidlCode = utils::convert(code).value_or(ErrorStatus::GENERAL_FAILURE);
- callback->notify(aidlCode, nullptr);
+ notify(callback.get(), aidlCode, nullptr);
return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
static_cast<int32_t>(aidlCode), message.c_str());
}