From 5d4932264f0200a218ae45b4824f1346894af8b3 Mon Sep 17 00:00:00 2001 From: "John W. Bruce" Date: Tue, 9 Oct 2018 14:07:13 -0700 Subject: [PATCH] Allow Reloading Partially-Released Licenses (This is a merge of http://go/wvgerrit/62780) The EME spec requires that it be possible to do the following flow: 1) Generate a release request for a persistent session. 2) Close the session. 3) Load the persistent session. 4) Update the session with the release response. This flow is used by Netflix in their API as well. However, our code did not support this flow, as it rejected attempts to reload partially-released sessions. This patch changes attempts to load sessions that have already had release messages generated into release-retry reloads, allowing them to be released. Bug: 113167010 Test: CE CDM Unit Tests Test: Android CDM Unit Tests Change-Id: I75bb7c75911e0fad1584bd8dd27f83c17f73bf45 --- libwvdrmengine/cdm/core/include/cdm_session.h | 2 +- libwvdrmengine/cdm/core/src/cdm_session.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libwvdrmengine/cdm/core/include/cdm_session.h b/libwvdrmengine/cdm/core/include/cdm_session.h index 9bfa638d..04e7ef74 100644 --- a/libwvdrmengine/cdm/core/include/cdm_session.h +++ b/libwvdrmengine/cdm/core/include/cdm_session.h @@ -60,7 +60,7 @@ class CdmSession { WvCdmEventListener* event_listener); virtual CdmResponseType RestoreOfflineSession( - const CdmKeySetId& key_set_id, const CdmLicenseType license_type); + const CdmKeySetId& key_set_id, CdmLicenseType license_type); virtual CdmResponseType RestoreUsageSession( const DeviceFiles::CdmUsageData& usage_data); diff --git a/libwvdrmengine/cdm/core/src/cdm_session.cpp b/libwvdrmengine/cdm/core/src/cdm_session.cpp index 16873e41..21fef480 100644 --- a/libwvdrmengine/cdm/core/src/cdm_session.cpp +++ b/libwvdrmengine/cdm/core/src/cdm_session.cpp @@ -186,7 +186,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set, } CdmResponseType CdmSession::RestoreOfflineSession( - const CdmKeySetId& key_set_id, const CdmLicenseType license_type) { + const CdmKeySetId& key_set_id, CdmLicenseType license_type) { if (!initialized_) { LOGE("CdmSession::RestoreOfflineSession: not initialized"); return NOT_INITIALIZED_ERROR; @@ -214,7 +214,14 @@ CdmResponseType CdmSession::RestoreOfflineSession( return GET_LICENSE_ERROR; } - // Do not restore a released offline license, unless a release retry + // Attempts to restore a released offline license are treated as a release + // retry. + if (license_state == DeviceFiles::kLicenseStateReleasing) { + license_type = kLicenseTypeRelease; + } + + // Only restore offline licenses if they are active or this is a release + // retry. if (!(license_type == kLicenseTypeRelease || license_state == DeviceFiles::kLicenseStateActive)) { LOGE(