Disallow the ability to load offline licenses more than once
[ Merge of http://go/wvgerrit/123263 ] In b/65839890 we discovered that an android app loaded an offline license more than once in a session. We did not intend to allow this behavior but did not prohibit it. OEMCrypto v16 disallowed this behavior at the OEMCrypto level but we worked around it within the CDM to maintain the bad behavior. Now that we have confirmed that the app no longer relies on that behavior, we are reverting the CDM workaround. Bug: 161865160 Test: WV unit/integration test, GtsMediaTestCases Amazon, Netflix, Google TV streaming and offline playback. Change-Id: I31254e4c13b81587f88c6c684d08d5aa5c18e39d
This commit is contained in:
@@ -122,18 +122,6 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
return REINIT_ERROR;
|
||||
}
|
||||
|
||||
// Save parameters in case Init needs to be called again (load and restore
|
||||
// offline license)
|
||||
if (cdm_client_property_set)
|
||||
cdm_client_property_set_ = cdm_client_property_set;
|
||||
|
||||
if (forced_session_id) {
|
||||
forced_session_id_value_ = *forced_session_id;
|
||||
forced_session_id_ = &forced_session_id_value_;
|
||||
}
|
||||
|
||||
if (event_listener) event_listener_ = event_listener;
|
||||
|
||||
if (cdm_client_property_set && cdm_client_property_set->security_level() ==
|
||||
QUERY_VALUE_SECURITY_LEVEL_L3) {
|
||||
requested_security_level_ = kLevel3;
|
||||
@@ -217,22 +205,6 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::ReleaseOfflineResources() {
|
||||
// |license_parser_| and |policy_engine_| are reset in Init. No need to
|
||||
// deallocate here.
|
||||
if (has_provider_session_token() && supports_usage_info() && !is_release_) {
|
||||
UpdateUsageEntryInformation();
|
||||
}
|
||||
|
||||
if (!key_set_id_.empty()) {
|
||||
// Unreserve the license ID.
|
||||
file_handle_->UnreserveLicenseId(key_set_id_);
|
||||
}
|
||||
crypto_session_.reset(CryptoSession::MakeCryptoSession(crypto_metrics_));
|
||||
initialized_ = false;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::RestoreOfflineSession(const CdmKeySetId& key_set_id,
|
||||
CdmLicenseType license_type,
|
||||
int* error_detail) {
|
||||
@@ -244,30 +216,6 @@ CdmResponseType CdmSession::RestoreOfflineSession(const CdmKeySetId& key_set_id,
|
||||
file_handle_->UnreserveLicenseId(key_set_id_);
|
||||
}
|
||||
|
||||
// On android, we previously permitted an offline license to be loaded and
|
||||
// restored in the same session. OEMCrypto v16+ disallows it so we need to
|
||||
// release and initialize an OEMCrypto session. We will still prohibit
|
||||
// multiple restore attempts on the same session.
|
||||
// TODO(b/161865160): reevalute this scenario. Should we also
|
||||
// (a) only allow a restore for the same key set ID that was loaded
|
||||
// (b) if (a) is true, indicate success and do nothing else rather than
|
||||
// release resources and reinitialize.
|
||||
// We need to investigate the conditions that caused an app failure and
|
||||
// led us to add a test to support this use case as there were multiple
|
||||
// related issues.
|
||||
if (!has_license_been_loaded_ && has_license_been_restored_) {
|
||||
LOGE("Disallow multiple offline license restores");
|
||||
return RESTORE_OFFLINE_LICENSE_ERROR_3;
|
||||
}
|
||||
|
||||
if (has_license_been_loaded_) {
|
||||
CdmResponseType status = ReleaseOfflineResources();
|
||||
if (status != NO_ERROR) return status;
|
||||
status =
|
||||
Init(cdm_client_property_set_, forced_session_id_, event_listener_);
|
||||
if (status != NO_ERROR) return status;
|
||||
}
|
||||
has_license_been_restored_ = true;
|
||||
key_set_id_ = key_set_id;
|
||||
|
||||
DeviceFiles::CdmLicenseData license_data;
|
||||
@@ -633,7 +581,6 @@ CdmResponseType CdmSession::AddKeyInternal(const CdmKeyResponse& key_response) {
|
||||
sts = StoreLicense();
|
||||
if (sts != NO_ERROR) return sts;
|
||||
}
|
||||
has_license_been_loaded_ = true;
|
||||
|
||||
return KEY_ADDED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user