Delay license state evaluation for offline licenses am: 8543b4c903 am: 9f2363e076

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12646162

Change-Id: I0158e6b1dc2560ff28ff9379533a428f2970efeb
This commit is contained in:
Rahul Frias
2020-09-23 03:03:08 +00:00
committed by Automerger Merge Worker
7 changed files with 248 additions and 171 deletions

View File

@@ -58,9 +58,9 @@ class CdmLicense {
CdmSession* cdm_session, CdmKeyMessage* signed_request,
std::string* server_url);
virtual CdmResponseType HandleKeyResponse(
const CdmKeyResponse& license_response);
bool is_restore, const CdmKeyResponse& license_response);
virtual CdmResponseType HandleKeyUpdateResponse(
bool is_renewal, const CdmKeyResponse& license_response);
bool is_renewal, bool is_restore, const CdmKeyResponse& license_response);
virtual CdmResponseType HandleEmbeddedKeyData(
const InitializationData& init_data);
@@ -109,7 +109,7 @@ class CdmLicense {
video_widevine::LicenseRequest* license_request);
CdmResponseType HandleContentKeyResponse(
const std::string& msg, const std::string& core_message,
bool is_restore, const std::string& msg, const std::string& core_message,
const std::string& signature, const std::string& mac_key_iv,
const std::string& mac_key, const std::vector<CryptoKey>& key_array,
const video_widevine::License& license);
@@ -118,7 +118,7 @@ class CdmLicense {
// the crypto session. In addition, it also extracts content keys from
// |wrapped_keys_| and loads them for use.
CdmResponseType HandleEntitlementKeyResponse(
const std::string& msg, const std::string& core_message,
bool is_restore, const std::string& msg, const std::string& core_message,
const std::string& signature, const std::string& mac_key_iv,
const std::string& mac_key, const std::vector<CryptoKey>& key_array,
const video_widevine::License& license);

View File

@@ -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