aidl plugin: add error details to return status

Merged from http://go/wvgerrit/163639

Bug: 253271674
Test: Google TV
Test: atest MediaDrmParameterizedTests
Test: atest DrmSessionManagerTest
Change-Id: I9f0e83774d405466a389d2fd90d693830682dde4
This commit is contained in:
Robert Shih
2022-11-30 18:39:52 -08:00
committed by Edwin Wong
parent 2384efde1e
commit 1fdbd3cd2c
15 changed files with 354 additions and 311 deletions

View File

@@ -7,12 +7,11 @@
#ifndef WV_UTILS_H_
#define WV_UTILS_H_
#include <aidl/android/hardware/drm/LogPriority.h>
#include <aidl/android/hardware/drm/Status.h>
#include <android/binder_auto_utils.h>
#include <string>
#include <vector>
#include "WVTypes.h"
#include "log.h"
namespace wvdrm {
@@ -35,19 +34,12 @@ inline ::aidl::android::hardware::drm::LogPriority toAidlLogPriority(
}
}
::ndk::ScopedAStatus toNdkScopedAStatus(::wvdrm::WvStatus status,
const char* msg = nullptr);
inline ::ndk::ScopedAStatus toNdkScopedAStatus(
::aidl::android::hardware::drm::Status status, const char* msg = nullptr) {
if (::aidl::android::hardware::drm::Status::OK == status)
return ::ndk::ScopedAStatus::ok();
else {
auto err = static_cast<int32_t>(status);
if (msg) {
return ::ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(err,
msg);
} else {
return ::ndk::ScopedAStatus::fromServiceSpecificError(err);
}
}
return toNdkScopedAStatus(::wvdrm::WvStatus(status), msg);
}
} // namespace wvdrm