Persist usage entry number

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

Usage entries and usage entry numbers need to be stored with license
and usage information, to facilitate loading usage entries when offline
licenses/usage information are restored or prepared for release.

b/34327459

Test: Validated by running unit/integration tests on angler.

Change-Id: I0949fc4cec8a50be0a7700b659dc12bb82ac6f73
This commit is contained in:
Rahul Frias
2017-02-06 23:45:06 -08:00
parent e85e27d596
commit b384408dd2
6 changed files with 104 additions and 48 deletions

View File

@@ -1055,8 +1055,10 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
CdmKeyMessage license_request;
CdmKeyResponse license_response;
std::string usage_entry;
uint32_t usage_entry_number = 0;
if (!handle.RetrieveUsageInfo(app_id, ssid, &license_request,
&license_response, &usage_entry)) {
&license_response, &usage_entry,
&usage_entry_number)) {
usage_property_set_->set_security_level(kLevel3);
usage_property_set_->set_app_id(app_id);
usage_session_.reset(new CdmSession(file_system_));
@@ -1070,7 +1072,8 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
return GET_USAGE_INFO_ERROR_2;
}
if (!handle.RetrieveUsageInfo(app_id, ssid, &license_request,
&license_response, &usage_entry)) {
&license_response, &usage_entry,
&usage_entry_number)) {
// No entry found for that ssid.
return USAGE_INFO_NOT_FOUND;
}
@@ -1283,11 +1286,15 @@ CdmResponseType CdmEngine::LoadUsageSession(const CdmKeySetId& key_set_id,
std::string app_id;
iter->second->GetApplicationId(&app_id);
std::string provider_session_token;
CdmKeyMessage key_message;
CdmKeyResponse key_response;
std::string usage_entry;
if (!handle.RetrieveUsageInfoByKeySetId(app_id, key_set_id, &key_message,
&key_response, &usage_entry)) {
uint32_t usage_entry_number = 0;
if (!handle.RetrieveUsageInfoByKeySetId(app_id, key_set_id,
&provider_session_token, &key_message,
&key_response, &usage_entry,
&usage_entry_number)) {
LOGE("CdmEngine::LoadUsageSession: unable to find usage information");
return LOAD_USAGE_INFO_MISSING;
}