Allow Secure Stops to be queried and deleted by application ID
This CL changes the WVDrmPlugin so that an application can segregate its secure stops from those of other applications by setting an application ID. This CL is a merge of the following Widevine CLs: https://widevine-internal-review.googlesource.com/#/c/11565/ Add getSecureStop by ssid https://widevine-internal-review.googlesource.com/#/c/11572 Add getSecureStop by SSID and releaseAllSecureStops by app id. https://widevine-internal-review.googlesource.com/#/c/11564/ Store Usage Info by App Id (device_file stubs) https://widevine-internal-review.googlesource.com/#/c/11563/ Add application id to StoreUsageInfo. https://widevine-internal-review.googlesource.com/#/c/11561/ Added Application ID to PropertySet for secure stop. bug: 18053197 bug: 18076411 Change-Id: I5444baf67ba1b960dee2dc958bced8de82ab70a3
This commit is contained in:
@@ -81,6 +81,7 @@ void CdmSession::Create(
|
||||
}
|
||||
security_level_ = GetRequestedSecurityLevel() == kLevel3
|
||||
? kSecurityLevelL3 : GetSecurityLevel();
|
||||
app_id_.clear();
|
||||
}
|
||||
|
||||
CdmSession::~CdmSession() { Properties::RemoveSessionPropertySet(session_id_); }
|
||||
@@ -503,8 +504,10 @@ CdmResponseType CdmSession::StoreLicense() {
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
std::string app_id;
|
||||
GetApplicationId(&app_id);
|
||||
if (!file_handle_->StoreUsageInfo(provider_session_token, key_request_,
|
||||
key_response_)) {
|
||||
key_response_, app_id)) {
|
||||
LOGE("CdmSession::StoreLicense: Unable to store usage info");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
@@ -532,11 +535,14 @@ bool CdmSession::DeleteLicense() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_offline_)
|
||||
if (is_offline_) {
|
||||
return file_handle_->DeleteLicense(key_set_id_);
|
||||
else
|
||||
} else {
|
||||
std::string app_id;
|
||||
GetApplicationId(&app_id);
|
||||
return file_handle_->DeleteUsageInfo(
|
||||
license_parser_->provider_session_token());
|
||||
app_id, license_parser_->provider_session_token());
|
||||
}
|
||||
}
|
||||
|
||||
bool CdmSession::AttachEventListener(WvCdmEventListener* listener) {
|
||||
@@ -579,6 +585,12 @@ void CdmSession::OnKeyReleaseEvent(const CdmKeySetId& key_set_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void CdmSession::GetApplicationId(std::string* app_id) {
|
||||
if (app_id && !Properties::GetApplicationId(session_id_, app_id)) {
|
||||
*app_id = "";
|
||||
}
|
||||
}
|
||||
|
||||
SecurityLevel CdmSession::GetRequestedSecurityLevel() {
|
||||
std::string security_level;
|
||||
if (Properties::GetSecurityLevel(session_id_, &security_level) &&
|
||||
@@ -596,6 +608,20 @@ CdmSecurityLevel CdmSession::GetSecurityLevel() {
|
||||
return crypto_session_.get()->GetSecurityLevel();
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::DeleteUsageInformation(const std::string& app_id) {
|
||||
if (!file_handle_->Reset(security_level_)) {
|
||||
LOGE("CdmSession::StoreLicense: Unable to initialize device files");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
if (file_handle_->DeleteAllUsageInfoForApp(app_id)) {
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
LOGE("CdmSession::DeleteUsageInformation: failed");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::UpdateUsageInformation() {
|
||||
return crypto_session_->UpdateUsageInformation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user