Snap for 6708411 from d6c8348229 to sc-release

Change-Id: I9534d573232b544972f4c1cd69422ec877ec11cb
This commit is contained in:
android-build-team Robot
2020-07-25 02:10:12 +00:00
5 changed files with 18 additions and 3 deletions

View File

@@ -84,6 +84,8 @@ class PolicyTimersV16 : public PolicyTimers {
return GetRentalDurationRemaining(current_time); return GetRentalDurationRemaining(current_time);
}; };
bool HasRenewalDelayExpired(int64_t current_time) override;
protected: protected:
// Gets the clock time that the license expires based on whether we have // Gets the clock time that the license expires based on whether we have
// started playing. This takes into account GetHardLicenseExpiryTime. // started playing. This takes into account GetHardLicenseExpiryTime.

View File

@@ -139,6 +139,10 @@ bool DeviceFiles::RetrieveCertificate(bool atsc_mode_enabled,
uint32_t* system_id) { uint32_t* system_id) {
RETURN_FALSE_IF_UNINITIALIZED(); RETURN_FALSE_IF_UNINITIALIZED();
if (!HasCertificate(atsc_mode_enabled)) {
return false;
}
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (RetrieveHashedFile(GetCertificateFileName(atsc_mode_enabled), &file) != if (RetrieveHashedFile(GetCertificateFileName(atsc_mode_enabled), &file) !=
kNoError) { kNoError) {
@@ -1109,7 +1113,7 @@ DeviceFiles::ResponseType DeviceFiles::RetrieveHashedFile(
path += name; path += name;
if (!file_system_->Exists(path)) { if (!file_system_->Exists(path)) {
LOGE("File does not exist: path = %s", path.c_str()); LOGW("File does not exist: path = %s", path.c_str());
return kFileNotFound; return kFileNotFound;
} }

View File

@@ -77,6 +77,12 @@ int64_t PolicyTimersV16::GetRentalDurationRemaining(int64_t current_time) {
return rental_expiry_time - current_time; return rental_expiry_time - current_time;
} }
bool PolicyTimersV16::HasRenewalDelayExpired(int64_t current_time) {
return policy_.can_renew() && (policy_.renewal_delay_seconds() > 0) &&
(renewal_start_time_ + policy_.renewal_delay_seconds() <=
current_time);
}
// For the policy time fields checked in the following methods, a value of 0 // For the policy time fields checked in the following methods, a value of 0
// (UNLIMITED_DURATION) indicates that there is no limit to the duration. // (UNLIMITED_DURATION) indicates that there is no limit to the duration.
// If the fields are UNLIMITED_DURATION then these methods will return // If the fields are UNLIMITED_DURATION then these methods will return

View File

@@ -2160,7 +2160,8 @@ TEST_P(DeviceCertificateTest, ReadCertificate) {
// Call to Open will return a unique_ptr, freeing this object. // Call to Open will return a unique_ptr, freeing this object.
MockFile* file = new MockFile(); MockFile* file = new MockFile();
EXPECT_CALL(file_system, Exists(StrEq(device_certificate_path))) EXPECT_CALL(file_system, Exists(StrEq(device_certificate_path)))
.WillOnce(Return(true)); .Times(2)
.WillRepeatedly(Return(true));
EXPECT_CALL(file_system, FileSize(StrEq(device_certificate_path))) EXPECT_CALL(file_system, FileSize(StrEq(device_certificate_path)))
.WillOnce(Return(data.size())); .WillOnce(Return(data.size()));
EXPECT_CALL(file_system, DoOpen(StrEq(device_certificate_path), _)) EXPECT_CALL(file_system, DoOpen(StrEq(device_certificate_path), _))

View File

@@ -3744,7 +3744,9 @@ TEST_F(PolicyEngineTest, PlaybackOk_RenewSuccess_V16) {
EXPECT_TRUE(policy_engine_->CanDecryptContent(kKeyId)); EXPECT_TRUE(policy_engine_->CanDecryptContent(kKeyId));
} }
TEST_F(PolicyEngineTest, PlaybackOk_RenewSuccess_WithFutureStartTime_V16) { // TODO(b/161992421): Rewrite after clarifying expected behavior
TEST_F(PolicyEngineTest,
DISABLED_PlaybackOk_RenewSuccess_WithFutureStartTime_V16) {
License_Policy* policy = license_.mutable_policy(); License_Policy* policy = license_.mutable_policy();
policy->set_can_renew(true); policy->set_can_renew(true);
const int64_t license_renewal_delay = const int64_t license_renewal_delay =