Update usage entry before closing a session

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

When deleting a usage entry, a crypto session may need to be closed
and reopened if a usage entry has previously been loaded. Before closing
this session, the usage entry/usage table header information should be
saved.

This is for completeness rather than correctness. Looking at code,
usage header and entry information are saved after the license
release has been generated. This change might be helpful in case
that changes in the future.

Bug: 115920873
Test: CE CDM unit tests, WV unit/integration tests
Change-Id: Ifc8f761497198247db31dab2f47e8323af783681
This commit is contained in:
Rahul Frias
2019-03-12 15:21:58 -07:00
parent 77ec11b8a8
commit f9ad1dad69

View File

@@ -775,6 +775,7 @@ CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
// The usage entry cannot be deleted if it has a crypto session handling
// it, so close and reopen session.
UpdateUsageEntryInformation();
CdmResponseType sts;
crypto_session_->Close();
crypto_session_.reset(CryptoSession::MakeCryptoSession(crypto_metrics_));
@@ -936,14 +937,14 @@ CdmResponseType CdmSession::RemoveKeys() {
}
CdmResponseType CdmSession::RemoveLicense() {
CdmResponseType sts = NO_ERROR;
if (is_offline_ || has_provider_session_token()) {
DeleteLicenseFile();
if (usage_support_type_ == kUsageEntrySupport &&
has_provider_session_token()) {
CdmResponseType sts = DeleteUsageEntry(usage_entry_number_);
if (NO_ERROR != sts) return sts;
sts = DeleteUsageEntry(usage_entry_number_);
}
DeleteLicenseFile();
}
return NO_ERROR;
}