Delete usage information on insufficient resources
[ Merge of http://go/wvgerrit/58460 ] If OEMCrypto runs out of space in the usage table header+entries adding a new license or loading/using an existing one might fail. This CL makes two modifications to handle this scenario. * OEMCrypto_ERROR_INSUFFICIENT_RESOURCES will be returned from OEMCrypto_CreateNewUsageEntry or OEMCrypto_LoadUsageEntry. An attempt will be made to release a LRU entry from the usage table and retry the operation. This may be retried 3 times unless success occurs earlier. * On initialization, the usage table header is loaded. If there are more than the minimum number of usage entries (200), an attempt is made to add a usage entry. If this fails, we are likely in an unrecoverable state. We then delete all offline licenses, usage information and recreate the usage table header. This will allow future playback attempts to succeed and offline licenses to be able to be downloaded but will lose all current offline licenses and secure stops. Bug: 112486006 Test: WV unit/integration tests, GtsMediaDrmTest Playback tests using Netflix and Play movies. Change-Id: I41a18d69a329f8a96c7b607d299ce73af3d56177
This commit is contained in:
@@ -129,6 +129,8 @@ class DeviceFiles {
|
||||
const std::string& usage_info_file_name,
|
||||
std::vector<std::string>* provider_session_tokens);
|
||||
|
||||
virtual bool DeleteAllUsageInfo();
|
||||
|
||||
// Retrieve one usage info from the file. Subsequent calls will retrieve
|
||||
// subsequent entries in the table for this app_id.
|
||||
virtual bool RetrieveUsageInfo(
|
||||
@@ -186,6 +188,8 @@ class DeviceFiles {
|
||||
CdmUsageTableHeader* usage_table_header,
|
||||
std::vector<CdmUsageEntryInfo>* usage_entry_info);
|
||||
|
||||
virtual bool DeleteUsageTableInfo();
|
||||
|
||||
private:
|
||||
// Extract serial number and system ID from DRM Device certificate
|
||||
bool ExtractDeviceInfo(const std::string& device_certificate,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "crypto_session.h"
|
||||
#include "device_files.h"
|
||||
#include "file_store.h"
|
||||
#include "lock.h"
|
||||
@@ -17,8 +18,6 @@
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
class CryptoSession;
|
||||
|
||||
// Offline licenses/secure stops may be securely tracked using usage
|
||||
// tables (OEMCrypto v9-12) or usage table headers+usage entries
|
||||
// (OEMCrypto v13+). This class assists with the latter, synchronizing
|
||||
@@ -117,6 +116,8 @@ class UsageTableHeader {
|
||||
// data-structures
|
||||
Lock usage_table_header_lock_;
|
||||
|
||||
metrics::CryptoMetrics alternate_crypto_metrics_;
|
||||
|
||||
// Test related declarations
|
||||
friend class UsageTableHeaderTest;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user