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

@@ -214,17 +214,17 @@ class CdmEngine {
// Return the list of IDs associated with usage records for the
// current (origin-specific) file system. At least one parameter
// |ksids| or |provider_session_tokens| needs to be supplied.
virtual CdmResponseType ListUsageIds(
const std::string& app_id, CdmSecurityLevel security_level,
std::vector<std::string>* ksids,
std::vector<std::string>* provider_session_tokens);
// |ksids| or |psts| needs to be supplied.
virtual CdmResponseType ListUsageIds(const std::string& app_id,
CdmSecurityLevel security_level,
std::vector<CdmKeySetId>* ksids,
std::vector<CdmSecureStopId>* psts);
// Delete the usage record for the given key_set_id. This removes the
// usage record in the file system and the OEMCrypto usage record.
virtual CdmResponseType DeleteUsageRecord(const std::string& app_id,
CdmSecurityLevel security_level,
const std::string& key_set_id);
const CdmKeySetId& key_set_id);
// Get offline license status: active, release or unknown
virtual CdmResponseType GetOfflineLicenseState(
@@ -245,7 +245,7 @@ class CdmEngine {
// in the event of an error.
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
int* error_detail,
CdmUsageInfo* usage_info);
CdmUsageReport* usage_report);
// Retrieve usage info whose PST is specified by |ssid|
// If |error_detail| is not null, an additional error code may be provided
@@ -253,7 +253,7 @@ class CdmEngine {
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
int* error_detail,
CdmUsageInfo* usage_info);
CdmUsageReport* usage_report);
// Retrieve usage info for a given security level and whose
// PST is specified by |ssid|.
@@ -263,7 +263,7 @@ class CdmEngine {
const CdmSecureStopId& ssid,
RequestedSecurityLevel security_level,
int* error_detail,
CdmUsageInfo* usage_info);
CdmUsageReport* usage_report);
// Remove all usage records for the current origin.
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id,
@@ -276,8 +276,7 @@ class CdmEngine {
virtual CdmResponseType RemoveUsageInfo(
const std::string& app_id, const CdmSecureStopId& secure_stop_id);
virtual CdmResponseType ReleaseUsageInfo(
const CdmUsageInfoReleaseMessage& message);
virtual CdmResponseType ReleaseUsageInfo(const CdmKeyResponse& message);
virtual CdmResponseType LoadUsageSession(const CdmKeySetId& key_set_id,
CdmKeyMessage* release_message);
@@ -412,7 +411,7 @@ class CdmEngine {
bool ValidateKeySystem(const CdmKeySystem& key_system);
CdmResponseType GetUsageInfo(const std::string& app_id,
RequestedSecurityLevel requested_security_level,
int* error_detail, CdmUsageInfo* usage_info);
int* error_detail, CdmUsageReport* usage_report);
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);

View File

@@ -184,10 +184,10 @@ class CdmEngineMetricsImpl : public T {
}
CdmResponseType GetUsageInfo(const std::string& app_id, int* error_detail,
CdmUsageInfo* usage_info) override {
CdmUsageReport* usage_report) override {
CdmResponseType sts;
int error_detail_alt;
M_TIME(sts = T::GetUsageInfo(app_id, &error_detail_alt, usage_info),
M_TIME(sts = T::GetUsageInfo(app_id, &error_detail_alt, usage_report),
metrics_, cdm_engine_get_usage_info_, sts, error_detail_alt);
if (error_detail != nullptr) {
*error_detail = error_detail_alt;
@@ -197,10 +197,10 @@ class CdmEngineMetricsImpl : public T {
CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid, int* error_detail,
CdmUsageInfo* usage_info) override {
CdmUsageReport* usage_report) override {
CdmResponseType sts;
int error_detail_alt;
M_TIME(sts = T::GetUsageInfo(app_id, ssid, &error_detail_alt, usage_info),
M_TIME(sts = T::GetUsageInfo(app_id, ssid, &error_detail_alt, usage_report),
metrics_, cdm_engine_get_usage_info_, sts, error_detail_alt);
if (error_detail != nullptr) {
*error_detail = error_detail_alt;
@@ -209,14 +209,14 @@ class CdmEngineMetricsImpl : public T {
}
CdmResponseType RemoveAllUsageInfo(const std::string& app_id) override {
CdmResponseType sts = T::RemoveAllUsageInfo(app_id);
const CdmResponseType sts = T::RemoveAllUsageInfo(app_id);
metrics_->cdm_engine_remove_all_usage_info_.Increment(sts);
return sts;
}
CdmResponseType RemoveAllUsageInfo(const std::string& app_id,
CdmSecurityLevel security_level) override {
CdmResponseType sts = T::RemoveAllUsageInfo(app_id, security_level);
const CdmResponseType sts = T::RemoveAllUsageInfo(app_id, security_level);
metrics_->cdm_engine_remove_all_usage_info_.Increment(sts);
return sts;
}
@@ -224,24 +224,23 @@ class CdmEngineMetricsImpl : public T {
CdmResponseType RemoveUsageInfo(
const std::string& app_id,
const CdmSecureStopId& secure_stop_id) override {
CdmResponseType sts = T::RemoveUsageInfo(app_id, secure_stop_id);
const CdmResponseType sts = T::RemoveUsageInfo(app_id, secure_stop_id);
metrics_->cdm_engine_remove_usage_info_.Increment(sts);
return sts;
}
CdmResponseType ReleaseUsageInfo(
const CdmUsageInfoReleaseMessage& message) override {
CdmResponseType sts = T::ReleaseUsageInfo(message);
CdmResponseType ReleaseUsageInfo(const CdmKeyResponse& message) override {
const CdmResponseType sts = T::ReleaseUsageInfo(message);
metrics_->cdm_engine_release_usage_info_.Increment(sts);
return sts;
}
CdmResponseType ListUsageIds(
const std::string& app_id, CdmSecurityLevel security_level,
std::vector<std::string>* ksids,
std::vector<std::string>* provider_session_tokens) override {
CdmResponseType sts =
T::ListUsageIds(app_id, security_level, ksids, provider_session_tokens);
CdmResponseType ListUsageIds(const std::string& app_id,
CdmSecurityLevel security_level,
std::vector<CdmKeySetId>* ksids,
std::vector<CdmSecureStopId>* ssids) override {
const CdmResponseType sts =
T::ListUsageIds(app_id, security_level, ksids, ssids);
metrics_->cdm_engine_get_secure_stop_ids_.Increment(sts);
return sts;
}

View File

@@ -21,7 +21,6 @@ using CdmInitData = std::string;
using CdmKeyMessage = std::string;
using CdmKeyResponse = std::string;
using KeyId = std::string;
using CdmSecureStopId = std::string;
using CdmSessionId = std::string;
using CdmKeySetId = std::string;
using RequestId = std::string;
@@ -39,6 +38,11 @@ using UsageTableHeader = std::string;
using UsageEntry = std::string;
using UsageEntryIndex = uint32_t;
// Secure stop related data types.
using CdmSecureStopId = std::string;
using CdmUsageReport = std::string;
using CdmUsageReportList = std::vector<std::string>;
enum CdmKeyRequestType : uint32_t {
kKeyRequestTypeUnknown,
kKeyRequestTypeInitial,