Implement Method to Release Licenses Without a Server Roundtrip

Merge from Widevine repo of http://go/wvgerrit/52480

Partners have asked for a way to release offline licenses without
using a release message. This is typically used by cable partners who
are caching licenses ahead of time and do not care about usage
statistics.

As part of implementing this request, CdmSession::DeleteLicense() was
renamed to reflect that it only deletes the *files* associated with a
license, and a new CdmSession::DeleteLicense() has been written that
also cleans up other related data.

Bug: 77955334
Test: CE CDM Unit Tests
Test: tested as part of http://go/ag/4674759
Change-Id: I00d6e20935c5fecb3ac9be6757c0f191d85c6bd6
This commit is contained in:
Fred Gylys-Colwell
2018-06-30 23:08:55 -07:00
parent 240652afcf
commit a242a32bba
8 changed files with 53 additions and 18 deletions

View File

@@ -414,6 +414,18 @@ CdmResponseType CdmEngine::RemoveKeys(const CdmSessionId& session_id) {
return NO_ERROR;
}
CdmResponseType CdmEngine::RemoveLicense(const CdmSessionId& session_id) {
LOGI("CdmEngine::RemoveLicense");
shared_ptr<CdmSession> session;
if (!session_map_.FindSession(session_id, &session)) {
LOGE("session_id not found = %s", session_id.c_str());
return SESSION_NOT_FOUND_19;
}
return session->RemoveLicense();
}
CdmResponseType CdmEngine::GenerateRenewalRequest(
const CdmSessionId& session_id, CdmKeyRequest* key_request) {
LOGI("CdmEngine::GenerateRenewalRequest");
@@ -1167,8 +1179,8 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
switch (status) {
case KEY_MESSAGE:
break;
case KEY_CANCELED: // usage information not present in
usage_session_->DeleteLicense(); // OEMCrypto, delete and try again
case KEY_CANCELED: // usage information not present in
usage_session_->DeleteLicenseFile(); // OEMCrypto, delete and try again
usage_info->clear();
break;
default:
@@ -1455,7 +1467,7 @@ CdmResponseType CdmEngine::LoadUsageSession(const CdmKeySetId& key_set_id,
break;
case KEY_CANCELED:
// usage information not present in OEMCrypto, delete and try again
session->DeleteLicense();
session->DeleteLicenseFile();
break;
default:
LOGE("CdmEngine::LoadUsageSession: generate release request error: %d",