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

@@ -442,6 +442,7 @@ CdmEngine* WvContentDecryptionModule::EnsureCdmForIdentifier(
cdms_[identifier].cdm_engine->SetAppPackageName(
identifier.app_package_name);
cdms_[identifier].cdm_engine->SetSpoid(identifier.spoid);
cdms_[identifier].cdm_engine->SetUserId(identifier.user_id);
}
cdm_engine = cdms_[identifier].cdm_engine.get();
}
@@ -549,9 +550,12 @@ void WvContentDecryptionModule::OnTimerEvent() {
{
std::unique_lock<std::mutex> auto_lock(cdms_lock_);
for (auto it = cdms_.begin(); it != cdms_.end(); ++it) {
LoggingUidSetter set_uid(it->first.user_id);
it->second.cdm_engine->OnTimerEvent();
}
if (cdms_.empty()) {
// The following code cannot be attributed to any app uid.
LoggingUidSetter set_uid(UNKNOWN_UID);
if (CryptoSession::TryTerminate()) {
// If CryptoSession is in a state to be terminated, try acquiring the
// |timer_lock_| before deciding whether to disable the timer. If the
@@ -617,4 +621,13 @@ CdmResponseType WvContentDecryptionModule::SetPlaybackId(
if (!cdm_engine) return SESSION_NOT_FOUND_23;
return cdm_engine->SetPlaybackId(session_id, playback_id);
}
CdmResponseType WvContentDecryptionModule::GetSessionUserId(
const CdmSessionId& session_id, uint32_t* user_id) {
if (!user_id) return PARAMETER_NULL;
CdmEngine* cdm_engine = GetCdmForSessionId(session_id);
if (!cdm_engine) return SESSION_NOT_FOUND_23;
*user_id = cdm_engine->GetUserId();
return NO_ERROR;
}
} // namespace wvcdm