Delay license state evaluation for offline licenses
[ Merge of http://go/wvgerrit/106325 and http://go/ag/12644840 ] When offline licenses are restored, licenses and any renewals are processed. License state evaluation occurs and notifications are sent to listeners. If the license is expired, which is likely if a renewal is present, the license state will transition to expired. Transitions out of expired state are not allowed and the renewal has no effect. If we work around this by allowing transitions out of expired state, listeners will get notifications that keys have expired and then that are usable soon after. To avoid delivering erroneous notifications we delay evaluation of license state while the license and renewal are being processed. Evaluation occurs at the last stage of license restoration when playback information from the usage table is being restored. This only need to occur for when licenses are being restored. In other cases when a license or renewal is received, license state evaluation and event listener notification needs to occur immediately. Bug: 166131956 Test: WV unit/integration tests, GtsMediaTestCases tests Change-Id: Ic8ade25316c5e20cc88de9225c43c24b28f21ac4
This commit is contained in:
@@ -56,10 +56,13 @@ class PolicyEngine {
|
||||
|
||||
// SetLicense is used in handling the initial license response. It stores
|
||||
// an exact copy of the policy information stored in the license.
|
||||
// The license state transitions to kLicenseStateCanPlay if the license
|
||||
// permits playback.
|
||||
// License state transitions and notifications may occur if
|
||||
// |defer_license_state_update| is not set. If set, the license is likely
|
||||
// being restored and transitions and notifications will be deferred until
|
||||
// stored playback times are restored.
|
||||
virtual void SetLicense(const video_widevine::License& license,
|
||||
bool supports_core_messages);
|
||||
bool supports_core_messages,
|
||||
bool defer_license_state_update);
|
||||
|
||||
// Used to update the currently loaded entitled content keys.
|
||||
virtual void SetEntitledLicenseKeys(
|
||||
@@ -78,9 +81,17 @@ class PolicyEngine {
|
||||
// UpdateLicense is used in handling a license response for a renewal request.
|
||||
// The response may only contain any policy fields that have changed. In this
|
||||
// case an exact copy is not what we want to happen. We also will receive an
|
||||
// updated license_start_time from the server. The license will transition to
|
||||
// kLicenseStateCanPlay if the license permits playback.
|
||||
virtual void UpdateLicense(const video_widevine::License& license);
|
||||
// updated license_start_time from the server.
|
||||
// License state transitions and notifications may occur if
|
||||
// |defer_license_state_update| is not set. If set, the license is likely
|
||||
// being restored and transitions and notifications will be deferred until
|
||||
// stored playback times are restored.
|
||||
virtual void UpdateLicense(const video_widevine::License& license,
|
||||
bool defer_license_state_update);
|
||||
|
||||
// This method updates license state and sends appropriate notifications
|
||||
// to event listeners.
|
||||
virtual void UpdateLicenseState(int64_t current_time);
|
||||
|
||||
// Used for notifying the Policy Engine of resolution changes
|
||||
virtual void NotifyResolution(uint32_t width, uint32_t height);
|
||||
@@ -101,6 +112,9 @@ class PolicyEngine {
|
||||
int64_t GetPlaybackStartTime();
|
||||
int64_t GetLastPlaybackTime();
|
||||
int64_t GetGracePeriodEndTime();
|
||||
|
||||
// This method will also update license state and sends appropriate
|
||||
// notifications to event listeners.
|
||||
void RestorePlaybackTimes(int64_t playback_start_time,
|
||||
int64_t last_playback_time,
|
||||
int64_t grace_period_end_time);
|
||||
@@ -153,6 +167,7 @@ class PolicyEngine {
|
||||
void SetSecurityLevelForTest(CdmSecurityLevel security_level);
|
||||
|
||||
LicenseState license_state_;
|
||||
int64_t license_state_update_deadline_;
|
||||
|
||||
// This is the license id field from server response. This data gets passed
|
||||
// back to the server in each renewal request. When we get a renewal response
|
||||
|
||||
Reference in New Issue
Block a user