Check L3 for secure stops

[ Merge of http://go/wvgerrit/151512 ]

Parameterizing GtsMediaDrm tests exposed a few issues. If secure stops
were stored at L3 security level, retrieval would fail. This CL
checks L3 if the secure stop was not found at the default security
level.

Bug: 221249079
Test: GtsMediaTestCases
Change-Id: Ie88197f8e29457981d782199a76d38774f6faa67
This commit is contained in:
Rahul Frias
2022-05-05 15:41:20 -07:00
parent f980049ef0
commit 13daf6d3ed
2 changed files with 35 additions and 4 deletions

View File

@@ -243,15 +243,24 @@ class CdmEngine {
int* error_detail, int* error_detail,
CdmUsageInfo* usage_info); CdmUsageInfo* usage_info);
// Retrieve the usage info for the specified pst. // Retrieve usage info whose PST is specified by |ssid|
// Returns UNKNOWN_ERROR if no usage info was found. // If |error_detail| is not null, an additional error code may be provided
// id. If |error_detail| is not null, an additional error code may be provided
// in the event of an error. // in the event of an error.
virtual CdmResponseType GetUsageInfo(const std::string& app_id, virtual CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid, const CdmSecureStopId& ssid,
int* error_detail, int* error_detail,
CdmUsageInfo* usage_info); CdmUsageInfo* usage_info);
// Retrieve usage info for a given security level and whose
// PST is specified by |ssid|.
// If |error_detail| is not null, an additional error code may be provided
// in the event of an error.
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
RequestedSecurityLevel security_level,
int* error_detail,
CdmUsageInfo* usage_info);
// Remove all usage records for the current origin. // Remove all usage records for the current origin.
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id, virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id,
CdmSecurityLevel security_level); CdmSecurityLevel security_level);

View File

@@ -1385,6 +1385,28 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid, const CdmSecureStopId& ssid,
int* error_detail, int* error_detail,
CdmUsageInfo* usage_info) { CdmUsageInfo* usage_info) {
// Try to find usage info at the default security level. If the
// security level is unprovisioned or we are unable to find it,
// try L3.
CdmResponseType status =
GetUsageInfo(app_id, ssid, kLevelDefault, error_detail, usage_info);
switch (status) {
case NEED_PROVISIONING:
case GET_USAGE_INFO_ERROR_1:
case GET_USAGE_INFO_ERROR_2:
case USAGE_INFO_NOT_FOUND:
status = GetUsageInfo(app_id, ssid, kLevel3, error_detail, usage_info);
return status;
default:
return status;
}
}
CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
RequestedSecurityLevel security_level,
int* error_detail,
CdmUsageInfo* usage_info) {
LOGI("app_id = %s, ssid = %s", IdToString(app_id), IdToString(ssid)); LOGI("app_id = %s, ssid = %s", IdToString(app_id), IdToString(ssid));
if (!usage_property_set_) { if (!usage_property_set_) {
usage_property_set_.reset(new UsagePropertySet()); usage_property_set_.reset(new UsagePropertySet());
@@ -1393,7 +1415,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
LOGE("Output |usage_info| is null"); LOGE("Output |usage_info| is null");
return PARAMETER_NULL; return PARAMETER_NULL;
} }
usage_property_set_->set_security_level(kLevelDefault); usage_property_set_->set_security_level(security_level);
usage_property_set_->set_app_id(app_id); usage_property_set_->set_app_id(app_id);
usage_session_.reset(new CdmSession(file_system_, metrics_->AddSession())); usage_session_.reset(new CdmSession(file_system_, metrics_->AddSession()));
CdmResponseType status = usage_session_->Init(usage_property_set_.get()); CdmResponseType status = usage_session_->Init(usage_property_set_.get());