Support ATSC license installation
[ Merge of http://go/wvgerrit/163900/ ] ATSC licenses can be saved by calling MediaDrm#setPropertyString("storeAtscLicense",<value>) where <value> is "<atsc-key-set-ID>:<license-file-data in Base64 format>" Before storing an ATSC license a session must be opened and the ATSC mode must be enabled. Use MediaDrm#setPropertyString("atscMode","enable"); Bug: 176871821 Test: WV Unit/integration/Luci tests Test: libwvdrmdrmplugin_hal_test Test: GtsMediaTestCases Change-Id: Iec2a8b7f87b1122395d06856202278b92316fdfe
This commit is contained in:
@@ -235,6 +235,10 @@ class CdmEngine {
|
||||
virtual CdmResponseType RemoveOfflineLicense(const std::string& key_set_id,
|
||||
CdmSecurityLevel security_level);
|
||||
|
||||
virtual CdmResponseType StoreAtscLicense(
|
||||
RequestedSecurityLevel security_level, const CdmKeySetId& key_set_id,
|
||||
const std::string& serialized_license_data);
|
||||
|
||||
// Usage related methods for streaming licenses
|
||||
// Retrieve a random usage info from the list of all usage infos for this app
|
||||
// id. If |error_detail| is not null, an additional error code may be provided
|
||||
|
||||
@@ -155,6 +155,9 @@ class DeviceFiles {
|
||||
virtual bool RetrieveLicense(const std::string& key_set_id,
|
||||
CdmLicenseData* license_data,
|
||||
ResponseType* result);
|
||||
virtual ResponseType StoreAtscLicense(
|
||||
const CdmKeySetId& key_set_id,
|
||||
const std::string& serialized_license_data);
|
||||
|
||||
virtual bool DeleteLicense(const std::string& key_set_id);
|
||||
virtual bool ListLicenses(std::vector<std::string>* key_set_ids);
|
||||
|
||||
@@ -1413,6 +1413,35 @@ CdmResponseType CdmEngine::RemoveOfflineLicense(
|
||||
return sts;
|
||||
}
|
||||
|
||||
CdmResponseType CdmEngine::StoreAtscLicense(
|
||||
RequestedSecurityLevel requested_security_level,
|
||||
const CdmKeySetId& key_set_id, const std::string& serialized_license_data) {
|
||||
std::string security_level_string;
|
||||
|
||||
CdmResponseType status =
|
||||
QueryStatus(requested_security_level, QUERY_KEY_SECURITY_LEVEL,
|
||||
&security_level_string);
|
||||
if (status != NO_ERROR) return status;
|
||||
|
||||
DeviceFiles handle(file_system_);
|
||||
CdmSecurityLevel security_level =
|
||||
security_level_string == QUERY_VALUE_SECURITY_LEVEL_L1 ? kSecurityLevelL1
|
||||
: kSecurityLevelL3;
|
||||
if (!handle.Init(security_level)) {
|
||||
LOGE("Unable to initialize device files");
|
||||
return CdmResponseType(STORE_ATSC_LICENSE_DEVICE_FILES_INIT_ERROR);
|
||||
}
|
||||
|
||||
DeviceFiles::ResponseType response_type =
|
||||
handle.StoreAtscLicense(key_set_id, serialized_license_data);
|
||||
if (response_type != DeviceFiles::kNoError) {
|
||||
LOGE("Unable to store ATSC license: response = %s",
|
||||
DeviceFiles::ResponseTypeToString(response_type));
|
||||
return CdmResponseType(STORE_ATSC_LICENSE_ERROR);
|
||||
}
|
||||
return CdmResponseType(NO_ERROR);
|
||||
}
|
||||
|
||||
CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
|
||||
const CdmSecureStopId& ssid,
|
||||
int* error_detail,
|
||||
|
||||
@@ -943,6 +943,11 @@ bool DeviceFiles::RetrieveLicense(const std::string& key_set_id,
|
||||
&license_data->wrapped_private_key);
|
||||
}
|
||||
|
||||
DeviceFiles::ResponseType DeviceFiles::StoreAtscLicense(
|
||||
const CdmKeySetId& key_set_id, const std::string& serialized_data) {
|
||||
return StoreFileWithHash(key_set_id + kLicenseFileNameExt, serialized_data);
|
||||
}
|
||||
|
||||
bool DeviceFiles::DeleteLicense(const std::string& key_set_id) {
|
||||
RETURN_FALSE_IF_UNINITIALIZED();
|
||||
return RemoveFile(key_set_id + kLicenseFileNameExt);
|
||||
|
||||
@@ -194,6 +194,10 @@ class WvContentDecryptionModule : public android::RefBase, public TimerHandler {
|
||||
virtual CdmResponseType GetSessionUserId(const CdmSessionId& session_id,
|
||||
uint32_t* user_id);
|
||||
|
||||
virtual CdmResponseType StoreAtscLicense(
|
||||
const CdmIdentifier& identifier, RequestedSecurityLevel security_level,
|
||||
const CdmKeySetId& key_set_id,
|
||||
const std::string& serialized_license_data);
|
||||
virtual bool SetDefaultOtaKeyboxFallbackDurationRules();
|
||||
virtual bool SetFastOtaKeyboxFallbackDurationRules();
|
||||
|
||||
|
||||
@@ -656,6 +656,15 @@ CdmResponseType WvContentDecryptionModule::GetSessionUserId(
|
||||
return CdmResponseType(NO_ERROR);
|
||||
}
|
||||
|
||||
CdmResponseType WvContentDecryptionModule::StoreAtscLicense(
|
||||
const CdmIdentifier& identifier,
|
||||
RequestedSecurityLevel requested_security_level,
|
||||
const CdmKeySetId& key_set_id, const std::string& serialized_license_data) {
|
||||
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
|
||||
return cdm_engine->StoreAtscLicense(requested_security_level, key_set_id,
|
||||
serialized_license_data);
|
||||
}
|
||||
|
||||
bool WvContentDecryptionModule::SetDefaultOtaKeyboxFallbackDurationRules() {
|
||||
CdmEngine* cdm_engine = EnsureCdmForIdentifier(kDefaultCdmIdentifier);
|
||||
if (!cdm_engine) return false;
|
||||
|
||||
Reference in New Issue
Block a user