Prevent renewal license when can_renew is set to false

[ Merge of https://go/wvgerrit/15670 ]

b/18459002

Change-Id: Idad43a621750ff01aee61e8d972957f364a698cf
This commit is contained in:
Rahul Frias
2015-09-16 15:30:38 -07:00
parent ff6b79d945
commit 395f68456b
7 changed files with 36 additions and 1 deletions

View File

@@ -80,6 +80,8 @@ class PolicyEngine {
bool IsLicenseOrPlaybackDurationExpired(int64_t current_time);
bool CanRenew() { return policy_.can_renew(); }
private:
friend class PolicyEngineTest;

View File

@@ -203,6 +203,7 @@ enum CdmResponseType {
LICENSE_REQUEST_SIGNING_ERROR,
EMPTY_LICENSE_REQUEST,
SECURE_BUFFER_REQUIRED,
LICENSE_RENEWAL_PROHIBITED,
};
enum CdmKeyStatus {

View File

@@ -319,6 +319,11 @@ CdmResponseType CdmLicense::PrepareKeyUpdateRequest(
return INVALID_PARAMETERS_LIC_2;
}
if (is_renewal && !policy_engine_->CanRenew()) {
LOGE("CdmLicense::PrepareKeyUpdateRequest: license renewal prohibited");
return LICENSE_RENEWAL_PROHIBITED;
}
LicenseRequest license_request;
if (is_renewal)
license_request.set_type(LicenseRequest::RENEWAL);

View File

@@ -339,6 +339,8 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
break;
case EMPTY_LICENSE_REQUEST: *os << "EMPTY_LICENSE_REQUEST";
break;
case LICENSE_RENEWAL_PROHIBITED: *os << "LICENSE_RENEWAL_PROHIBITED";
break;
default:
*os << "Unknown CdmResponseType";
break;