Use Usage information from OEMCrypto on clock rollback

[ Merge of http://go/wvgerrit/123103 ]

This corrects setting of first and last playback times stored by the
CDM on rollback. Earlier usage information from the usage entry in
OEMCrypto would be ignored on rollback even when available.
Information stored along with the license in persistent storage would
be used instead.

A new test with longer duration expiry has been added as well as some
additional verification.

Bug: 186199213
Test: WV unit/integration test
Change-Id: I601f9584a8a0c5137ce68546f8ec833bf2e70cc5
This commit is contained in:
Rahul Frias
2021-04-23 03:57:10 -07:00
parent 2a316f65fe
commit 87e84d5498
2 changed files with 72 additions and 5 deletions

View File

@@ -864,13 +864,13 @@ CdmResponseType CdmLicense::RestoreOfflineLicense(
break;
case CryptoSession::kUsageDurationsValid: {
int64_t current_time = clock_->GetCurrentTime();
if (current_time - seconds_since_started > 0)
playback_start_time = current_time - seconds_since_started;
if (current_time - last_playback_time > 0)
last_playback_time = current_time - seconds_since_last_played;
playback_start_time = current_time - seconds_since_started;
last_playback_time = current_time - seconds_since_last_played;
break;
}
default:
// Use playback_start_time and last_playback_time from
// persistently stored license data
break;
}
}