libwvhidl: implement API to get plugin logs

Bug: 162255728
Test: VtsHalDrmV1_4TargetTest
Change-Id: I333cb1ee2f25ae718e7f544f4a5f7ee50668041a
This commit is contained in:
Robert Shih
2021-01-21 07:08:30 -08:00
parent 83ef9081d1
commit 12995287fa
6 changed files with 38 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
#include <android/hardware/drm/1.1/types.h>
#include <android/hardware/drm/1.2/types.h>
#include <android/hardware/drm/1.2/IDrmPluginListener.h>
#include <android/hardware/drm/1.4/types.h>
#include <android/hardware/drm/1.4/ICryptoFactory.h>
#include <android/hardware/drm/1.4/ICryptoPlugin.h>
#include <android/hardware/drm/1.4/IDrmFactory.h>

View File

@@ -19,6 +19,7 @@
#include <vector>
#include "log.h"
#include "media/stagefright/MediaErrors.h"
#include "HidlTypes.h"
#include "utils/Errors.h"
@@ -29,6 +30,23 @@ namespace drm {
namespace V1_2 {
namespace widevine {
template<typename T, typename U>
hidl_vec<T> toHidlVec(const std::vector<U> &vec);
template<>
inline hidl_vec<::drm::V1_4::LogMessage> toHidlVec(const std::vector<wvcdm::LogMessage> &vec) {
hidl_vec<::drm::V1_4::LogMessage> hLogs(vec.size());
for (size_t i = 0; i < vec.size(); i++) {
const auto& msg = vec[i];
hLogs[i] = {
msg.time_ms_,
static_cast<::drm::V1_4::LogPriority>(msg.priority_),
msg.message_,
};
}
return hLogs;
}
template<typename T> const hidl_vec<T> toHidlVec(const std::vector<T> &vec) {
hidl_vec<T> hVec;
hVec.setToExternal(const_cast<T *>(vec.data()), vec.size());