Disallow restoring an offline license multiple times
[ Merge of http://go/wvgerrit/126063 ] As a side-effect of fixing b/161865160 CDM checks to flag reloading of an offline license were removed. This left it to the OEMCrypto which varied by device implementation. Checks are being reintroduced to the CDM and will help MediaDrm return the expected error ERROR_LICENSE_STATE. In addition restoring an offline liense to a session where a license is already loaded will be rejected. Bug: 184608310 Bug: 182208685 Test: WV unit/integration tests MediaDrmTest.testMultipleLoadKeys Change-Id: Id8ee069d22819f7823aa6af11a41f35f0a04ce0a
This commit is contained in:
@@ -215,6 +215,12 @@ CdmResponseType CdmSession::RestoreOfflineSession(const CdmKeySetId& key_set_id,
|
||||
if (!key_set_id_.empty()) {
|
||||
file_handle_->UnreserveLicenseId(key_set_id_);
|
||||
}
|
||||
if (has_license_been_loaded_ || has_license_been_restored_) {
|
||||
LOGE(
|
||||
"Disallow multiple offline license restores or restoring a license if "
|
||||
"a license has already been loaded");
|
||||
return RESTORE_OFFLINE_LICENSE_ERROR_3;
|
||||
}
|
||||
|
||||
key_set_id_ = key_set_id;
|
||||
|
||||
@@ -338,6 +344,7 @@ CdmResponseType CdmSession::RestoreOfflineSession(const CdmKeySetId& key_set_id,
|
||||
license_received_ = true;
|
||||
is_offline_ = true;
|
||||
is_release_ = license_type == kLicenseTypeRelease;
|
||||
has_license_been_restored_ = true;
|
||||
return KEY_ADDED;
|
||||
}
|
||||
|
||||
@@ -582,6 +589,7 @@ CdmResponseType CdmSession::AddKeyInternal(const CdmKeyResponse& key_response) {
|
||||
if (sts != NO_ERROR) return sts;
|
||||
}
|
||||
|
||||
has_license_been_loaded_ = true;
|
||||
return KEY_ADDED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user