Android CDM: Restored secure stop tests.

[ Semi-revert of http://ag/20183443 ]
[ Merge of http://go/wvgerrit/168898 ]

These tests were removed from Android last quarter; however, they
now need to be restored.  These tests will be removed in Android V.

To help with ambiguity around where the CDM is operating on a single
or set of usage info messages, the variables have been renamed to
propery indicate plurality.

Bug: 263319220
Test: cdm_extended_duration_test
Test: request_license_test
Test: libwvdrmdrmplugin_hal_test
Change-Id: I38b16dd5811069fafaeab5ffc19d0f8a8095f0cf
This commit is contained in:
Alex Dale
2023-03-23 22:03:21 -07:00
parent 5ed89d16e2
commit e928670c85
11 changed files with 1842 additions and 343 deletions

View File

@@ -261,18 +261,28 @@ bool WvContentDecryptionModule::IsProvisioned(CdmSecurityLevel security_level,
CdmResponseType WvContentDecryptionModule::GetUsageInfo(
const std::string& app_id, const CdmIdentifier& identifier,
CdmUsageInfo* usage_info) {
CdmUsageReportList* usage_reports) {
if (usage_reports == nullptr) return CdmResponseType(PARAMETER_NULL);
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
int error_detail = NO_ERROR;
return cdm_engine->GetUsageInfo(app_id, &error_detail, usage_info);
CdmUsageReport usage_report;
// Doesn't actually retrieve all reports, just a single random one.
const CdmResponseType status =
cdm_engine->GetUsageInfo(app_id, &error_detail, &usage_report);
usage_reports->clear();
// Possible that no report is available, still a successful call.
if ((status == NO_ERROR || status == KEY_MESSAGE) && !usage_report.empty()) {
usage_reports->push_back(std::move(usage_report));
}
return status;
}
CdmResponseType WvContentDecryptionModule::GetUsageInfo(
const std::string& app_id, const CdmSecureStopId& ssid,
const CdmIdentifier& identifier, CdmUsageInfo* usage_info) {
const CdmIdentifier& identifier, CdmUsageReport* usage_report) {
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
int error_detail = NO_ERROR;
return cdm_engine->GetUsageInfo(app_id, ssid, &error_detail, usage_info);
return cdm_engine->GetUsageInfo(app_id, ssid, &error_detail, usage_report);
}
CdmResponseType WvContentDecryptionModule::RemoveAllUsageInfo(
@@ -289,8 +299,7 @@ CdmResponseType WvContentDecryptionModule::RemoveUsageInfo(
}
CdmResponseType WvContentDecryptionModule::ReleaseUsageInfo(
const CdmUsageInfoReleaseMessage& message,
const CdmIdentifier& identifier) {
const CdmKeyResponse& message, const CdmIdentifier& identifier) {
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
return cdm_engine->ReleaseUsageInfo(message);
}
@@ -306,10 +315,10 @@ CdmResponseType WvContentDecryptionModule::GetSecureStopIds(
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
const CdmResponseType sts =
cdm_engine->ListUsageIds(app_id, kSecurityLevelL1, nullptr, ssids);
std::vector<CdmSecureStopId> secure_stop_ids;
const CdmResponseType sts_l3 = cdm_engine->ListUsageIds(
app_id, kSecurityLevelL3, nullptr, &secure_stop_ids);
ssids->insert(ssids->end(), secure_stop_ids.begin(), secure_stop_ids.end());
std::vector<CdmSecureStopId> ssids_l3;
const CdmResponseType sts_l3 =
cdm_engine->ListUsageIds(app_id, kSecurityLevelL3, nullptr, &ssids_l3);
ssids->insert(ssids->end(), ssids_l3.begin(), ssids_l3.end());
return sts_l3 != NO_ERROR ? sts_l3 : sts;
}