wvcdm: filter logs by app uid

This commit is a combination of the following:
* http://go/wvgerrit/117003
* http://go/wvgerrit/118303

Bug: 162255728
Test: MediaDrmTest#testGetLogMessages
Change-Id: I5699b64d5c4bab463e5b587595fa7d324dc1d93f
This commit is contained in:
Robert Shih
2021-03-01 08:53:15 -08:00
parent 1ffc6ab16a
commit 7cb52c1ccf
19 changed files with 127 additions and 16 deletions

View File

@@ -53,16 +53,19 @@ 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_,
toHidlPriority(msg.priority_),
msg.message_,
};
uint32_t uid = wvcdm::GetIpcCallingUid();
std::vector<::drm::V1_4::LogMessage> vec2;
for (auto msg : vec) {
if (uid == msg.uid_) {
vec2.push_back({
msg.time_ms_,
toHidlPriority(msg.priority_),
msg.message_,
});
}
}
return hLogs;
return hidl_vec<::drm::V1_4::LogMessage>(vec2);
}
template<typename T> const hidl_vec<T> toHidlVec(const std::vector<T> &vec) {