Refactored metrics to support pull model.
MetricsGroup split into 3 groups, session, engine, and crypto. MetricsFrontEnd and Report removed. This is a merge from wvgerrit/28420 Bug: 36217927 Test: Added unit tests to cover modified code. Change-Id: I2f39f99ce88cc2229d6d1aa9459c67c5b86ccef4
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include "file_store.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "log.h"
|
||||
#include "metrics_front_end.h"
|
||||
#include "properties.h"
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
@@ -130,7 +129,8 @@ CdmResponseType CdmEngine::OpenSession(const CdmKeySystem& key_system,
|
||||
|
||||
CloseExpiredReleaseSessions();
|
||||
|
||||
scoped_ptr<CdmSession> new_session(new CdmSession(file_system_));
|
||||
scoped_ptr<CdmSession> new_session(new CdmSession(file_system_,
|
||||
metrics_.AddSession()));
|
||||
CdmResponseType sts = new_session->Init(property_set, forced_session_id,
|
||||
event_listener);
|
||||
if (sts != NO_ERROR) {
|
||||
@@ -498,13 +498,13 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
const std::string& query_token,
|
||||
std::string* query_response) {
|
||||
LOGI("CdmEngine::QueryStatus");
|
||||
CryptoSession crypto_session(&metrics_);
|
||||
CryptoSession crypto_session(metrics_.GetCryptoMetrics());
|
||||
if (security_level == kLevel3) {
|
||||
CdmResponseType status;
|
||||
M_TIME(
|
||||
status = crypto_session.Open(
|
||||
kLevel3),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_open_,
|
||||
status,
|
||||
kLevel3);
|
||||
@@ -520,7 +520,7 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
CdmSecurityLevel security_level;
|
||||
M_TIME(
|
||||
security_level = crypto_session.GetSecurityLevel(),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_get_security_level_,
|
||||
security_level);
|
||||
switch (security_level) {
|
||||
@@ -548,7 +548,7 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
M_TIME(
|
||||
got_id = crypto_session.GetExternalDeviceUniqueId(
|
||||
&deviceId),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_get_device_unique_id_,
|
||||
got_id);
|
||||
if (!got_id) {
|
||||
@@ -563,7 +563,7 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
M_TIME(
|
||||
got_id = crypto_session.GetSystemId(
|
||||
&system_id),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_get_system_id_,
|
||||
got_id,
|
||||
system_id);
|
||||
@@ -600,7 +600,7 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
M_TIME(
|
||||
got_info = crypto_session.UsageInformationSupport(
|
||||
&supports_usage_reporting),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_usage_information_support_,
|
||||
got_info);
|
||||
if (!got_info) {
|
||||
@@ -782,7 +782,8 @@ CdmResponseType CdmEngine::GetProvisioningRequest(
|
||||
DeleteAllUsageReportsUponFactoryReset();
|
||||
|
||||
if (NULL == cert_provisioning_.get()) {
|
||||
cert_provisioning_.reset(new CertificateProvisioning(&metrics_));
|
||||
cert_provisioning_.reset(
|
||||
new CertificateProvisioning(metrics_.GetCryptoMetrics()));
|
||||
}
|
||||
CdmResponseType ret = cert_provisioning_->GetProvisioningRequest(
|
||||
cert_provisioning_requested_security_level_, cert_type, cert_authority,
|
||||
@@ -824,12 +825,12 @@ CdmResponseType CdmEngine::HandleProvisioningResponse(
|
||||
if (NULL == cert_provisioning_.get()) {
|
||||
// Certificate provisioning object has been released. Check if a concurrent
|
||||
// provisioning attempt has succeeded before declaring failure.
|
||||
CryptoSession crypto_session(&metrics_);
|
||||
CryptoSession crypto_session(metrics_.GetCryptoMetrics());
|
||||
CdmResponseType status;
|
||||
M_TIME(
|
||||
status = crypto_session.Open(
|
||||
cert_provisioning_requested_security_level_),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_open_,
|
||||
status,
|
||||
cert_provisioning_requested_security_level_);
|
||||
@@ -842,7 +843,7 @@ CdmResponseType CdmEngine::HandleProvisioningResponse(
|
||||
CdmSecurityLevel security_level;
|
||||
M_TIME(
|
||||
security_level = crypto_session.GetSecurityLevel(),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_get_security_level_,
|
||||
security_level);
|
||||
if (!IsProvisioned(security_level)) {
|
||||
@@ -892,14 +893,14 @@ CdmResponseType CdmEngine::Unprovision(CdmSecurityLevel security_level) {
|
||||
return UNPROVISION_ERROR_3;
|
||||
}
|
||||
|
||||
CryptoSession crypto_session(&metrics_);
|
||||
CryptoSession crypto_session(metrics_.GetCryptoMetrics());
|
||||
CdmResponseType status;
|
||||
M_TIME(
|
||||
status = crypto_session.Open(
|
||||
security_level == kSecurityLevelL3 ?
|
||||
kLevel3 :
|
||||
kLevelDefault),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_open_,
|
||||
status,
|
||||
security_level == kSecurityLevelL3 ? kLevel3 : kLevelDefault);
|
||||
@@ -909,7 +910,7 @@ CdmResponseType CdmEngine::Unprovision(CdmSecurityLevel security_level) {
|
||||
}
|
||||
M_TIME(
|
||||
status = crypto_session.DeleteAllUsageReports(),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_delete_all_usage_reports_,
|
||||
status);
|
||||
if (status != NO_ERROR) {
|
||||
@@ -948,7 +949,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
|
||||
}
|
||||
usage_property_set_->set_security_level(kLevelDefault);
|
||||
usage_property_set_->set_app_id(app_id);
|
||||
usage_session_.reset(new CdmSession(file_system_));
|
||||
usage_session_.reset(new CdmSession(file_system_, metrics_.AddSession()));
|
||||
CdmResponseType status = usage_session_->Init(usage_property_set_.get());
|
||||
if (NO_ERROR != status) {
|
||||
LOGE("CdmEngine::GetUsageInfo: session init error: %d", status);
|
||||
@@ -968,7 +969,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
|
||||
ssid, &usage_data)) {
|
||||
usage_property_set_->set_security_level(kLevel3);
|
||||
usage_property_set_->set_app_id(app_id);
|
||||
usage_session_.reset(new CdmSession(file_system_));
|
||||
usage_session_.reset(new CdmSession(file_system_, metrics_.AddSession()));
|
||||
status = usage_session_->Init(usage_property_set_.get());
|
||||
if (NO_ERROR != status) {
|
||||
LOGE("CdmEngine::GetUsageInfo: session init error");
|
||||
@@ -1042,7 +1043,7 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
|
||||
usage_property_set_->set_security_level(requested_security_level);
|
||||
usage_property_set_->set_app_id(app_id);
|
||||
|
||||
usage_session_.reset(new CdmSession(file_system_));
|
||||
usage_session_.reset(new CdmSession(file_system_, metrics_.AddSession()));
|
||||
|
||||
CdmResponseType status = usage_session_->Init(usage_property_set_.get());
|
||||
if (NO_ERROR != status) {
|
||||
@@ -1120,7 +1121,8 @@ CdmResponseType CdmEngine::ReleaseAllUsageInfo(const std::string& app_id) {
|
||||
? kLevel3
|
||||
: kLevelDefault;
|
||||
usage_property_set_->set_security_level(security_level);
|
||||
usage_session_.reset(new CdmSession(file_system_));
|
||||
usage_session_.reset(
|
||||
new CdmSession(file_system_, metrics_.AddSession()));
|
||||
usage_session_->Init(usage_property_set_.get());
|
||||
|
||||
if (usage_session_->get_usage_support_type() == kUsageEntrySupport) {
|
||||
@@ -1544,19 +1546,20 @@ void CdmEngine::DeleteAllUsageReportsUponFactoryReset() {
|
||||
|
||||
if (!file_system_->Exists(device_base_path_level1) &&
|
||||
!file_system_->Exists(device_base_path_level3)) {
|
||||
scoped_ptr<CryptoSession> crypto_session(new CryptoSession(&metrics_));
|
||||
scoped_ptr<CryptoSession> crypto_session(
|
||||
new CryptoSession(metrics_.GetCryptoMetrics()));
|
||||
CdmResponseType status;
|
||||
M_TIME(
|
||||
status = crypto_session->Open(
|
||||
cert_provisioning_requested_security_level_),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_open_,
|
||||
status,
|
||||
cert_provisioning_requested_security_level_);
|
||||
if (NO_ERROR == status) {
|
||||
M_TIME(
|
||||
status = crypto_session->DeleteAllUsageReports(),
|
||||
&metrics_,
|
||||
metrics_.GetCryptoMetrics(),
|
||||
crypto_session_delete_all_usage_reports_,
|
||||
status);
|
||||
if (NO_ERROR != status) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "clock.h"
|
||||
#include "file_store.h"
|
||||
#include "log.h"
|
||||
#include "metrics_front_end.h"
|
||||
#include "properties.h"
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
@@ -25,9 +24,10 @@ const size_t kKeySetIdLength = 14;
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
CdmSession::CdmSession(FileSystem* file_system) :
|
||||
CdmSession::CdmSession(FileSystem* file_system,
|
||||
metrics::SessionMetrics* metrics) :
|
||||
metrics_(metrics),
|
||||
initialized_(false),
|
||||
crypto_session_(new CryptoSession(&metrics_)),
|
||||
file_handle_(new DeviceFiles(file_system)),
|
||||
license_received_(false),
|
||||
is_offline_(false),
|
||||
@@ -44,6 +44,9 @@ CdmSession::CdmSession(FileSystem* file_system) :
|
||||
usage_entry_number_(0),
|
||||
mock_license_parser_in_use_(false),
|
||||
mock_policy_engine_in_use_(false) {
|
||||
// If metrics was not provided, then use a NULL CryptoMetrics instance, too.
|
||||
crypto_metrics_ = metrics_ == NULL ? NULL : metrics_->GetCryptoMetrics();
|
||||
crypto_session_.reset(new CryptoSession(crypto_metrics_));
|
||||
life_span_.Start();
|
||||
}
|
||||
|
||||
@@ -54,7 +57,10 @@ CdmSession::~CdmSession() {
|
||||
}
|
||||
Properties::RemoveSessionPropertySet(session_id_);
|
||||
|
||||
M_RECORD(&metrics_, cdm_session_life_span_, life_span_.AsMs());
|
||||
if (metrics_) {
|
||||
M_RECORD(metrics_, cdm_session_life_span_, life_span_.AsMs());
|
||||
metrics_->SetCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::Init(
|
||||
@@ -78,16 +84,15 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
}
|
||||
CdmResponseType sts;
|
||||
M_TIME(
|
||||
sts = crypto_session_->Open(
|
||||
requested_security_level_),
|
||||
&metrics_,
|
||||
sts = crypto_session_->Open(requested_security_level_),
|
||||
crypto_metrics_,
|
||||
crypto_session_open_,
|
||||
sts,
|
||||
requested_security_level_);
|
||||
if (NO_ERROR != sts) return sts;
|
||||
M_TIME(
|
||||
security_level_ = crypto_session_->GetSecurityLevel(),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_get_security_level_,
|
||||
security_level_);
|
||||
if (!file_handle_->Init(security_level_)) {
|
||||
@@ -121,7 +126,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
M_TIME(
|
||||
get_client_token_sts = crypto_session_->GetClientToken(
|
||||
&client_token),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_get_token_,
|
||||
get_client_token_sts);
|
||||
if (!get_client_token_sts) {
|
||||
@@ -138,7 +143,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
M_TIME(
|
||||
load_cert_sts = crypto_session_->LoadCertificatePrivateKey(
|
||||
wrapped_key),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_load_certificate_private_key_,
|
||||
load_cert_sts);
|
||||
if(!load_cert_sts) {
|
||||
@@ -157,6 +162,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
|
||||
session_id_ =
|
||||
Properties::AlwaysUseKeySetIds() ? key_set_id_ : GenerateSessionId();
|
||||
metrics_->SetSessionId(session_id_);
|
||||
|
||||
if (session_id_.empty()) {
|
||||
LOGE("CdmSession::Init: empty session ID");
|
||||
@@ -454,7 +460,8 @@ CdmResponseType CdmSession::AddKey(const CdmKeyResponse& key_response) {
|
||||
if (sts != KEY_ADDED) {
|
||||
CdmResponseType sts =
|
||||
usage_table_header_->DeleteEntry(usage_entry_number_,
|
||||
file_handle_.get(), &metrics_);
|
||||
file_handle_.get(),
|
||||
crypto_metrics_);
|
||||
if (sts != NO_ERROR) {
|
||||
LOGW("CdmSession::AddKey: Delete usage entry failed = %d", sts);
|
||||
}
|
||||
@@ -687,10 +694,10 @@ CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
|
||||
// it, so close and reopen session.
|
||||
CdmResponseType sts;
|
||||
crypto_session_->Close();
|
||||
crypto_session_.reset(new CryptoSession(&metrics_));
|
||||
crypto_session_.reset(new CryptoSession(crypto_metrics_));
|
||||
M_TIME(
|
||||
sts = crypto_session_->Open(requested_security_level_),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_open_,
|
||||
sts,
|
||||
requested_security_level_);
|
||||
@@ -711,7 +718,7 @@ CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
|
||||
|
||||
return usage_table_header_->DeleteEntry(usage_entry_number,
|
||||
file_handle_.get(),
|
||||
&metrics_);
|
||||
crypto_metrics_);
|
||||
}
|
||||
|
||||
bool CdmSession::IsKeyLoaded(const KeyId& key_id) {
|
||||
@@ -861,7 +868,7 @@ CdmResponseType CdmSession::DeleteMultipleUsageInformation(
|
||||
M_TIME(
|
||||
sts = crypto_session_->DeleteMultipleUsageInformation(
|
||||
provider_session_tokens),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_delete_multiple_usage_information_,
|
||||
sts);
|
||||
return sts;
|
||||
@@ -871,7 +878,7 @@ CdmResponseType CdmSession::UpdateUsageTableInformation() {
|
||||
CdmResponseType sts;
|
||||
M_TIME(
|
||||
sts = crypto_session_->UpdateUsageInformation(),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_update_usage_information_,
|
||||
sts);
|
||||
return sts;
|
||||
@@ -917,7 +924,7 @@ CdmResponseType CdmSession::GenericEncrypt(const std::string& in_buffer,
|
||||
iv,
|
||||
algorithm,
|
||||
out_buffer),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_generic_encrypt_,
|
||||
sts,
|
||||
metrics::Pow2Bucket(in_buffer.size()),
|
||||
@@ -942,7 +949,7 @@ CdmResponseType CdmSession::GenericDecrypt(const std::string& in_buffer,
|
||||
iv,
|
||||
algorithm,
|
||||
out_buffer),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_generic_decrypt_,
|
||||
sts,
|
||||
metrics::Pow2Bucket(in_buffer.size()),
|
||||
@@ -965,7 +972,7 @@ CdmResponseType CdmSession::GenericSign(const std::string& message,
|
||||
key_id,
|
||||
algorithm,
|
||||
signature),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_generic_sign_,
|
||||
sts,
|
||||
metrics::Pow2Bucket(message.size()),
|
||||
@@ -984,7 +991,7 @@ CdmResponseType CdmSession::GenericVerify(const std::string& message,
|
||||
key_id,
|
||||
algorithm,
|
||||
signature),
|
||||
&metrics_,
|
||||
crypto_metrics_,
|
||||
crypto_session_generic_verify_,
|
||||
sts,
|
||||
metrics::Pow2Bucket(message.size()),
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "crypto_key.h"
|
||||
#include "log.h"
|
||||
#include "metrics_front_end.h"
|
||||
#include "openssl/sha.h"
|
||||
#include "properties.h"
|
||||
#include "pst_report.h"
|
||||
@@ -45,7 +44,7 @@ uint64_t CryptoSession::request_id_index_ = 0;
|
||||
UsageTableHeader* CryptoSession::usage_table_header_l1_ = NULL;
|
||||
UsageTableHeader* CryptoSession::usage_table_header_l3_ = NULL;
|
||||
|
||||
CryptoSession::CryptoSession(metrics::MetricsGroup* metrics)
|
||||
CryptoSession::CryptoSession(metrics::CryptoMetrics* metrics)
|
||||
: metrics_(metrics),
|
||||
open_(false),
|
||||
update_usage_table_after_close_session_(false),
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
#include "level3.h"
|
||||
#include "lock.h"
|
||||
#include "log.h"
|
||||
#include "metrics_front_end.h"
|
||||
#include "metrics_group.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "properties.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
@@ -425,8 +424,12 @@ class Adapter {
|
||||
* To avoid changing the function signature and function contract - declare
|
||||
* a one-off metrics group to collect detailed information about how
|
||||
* oemcrypto was intialized.
|
||||
*
|
||||
* TODO(blueeyes): Refactor this to allow Initialize to provide the
|
||||
* details to the caller or to use the metrics instance provided by
|
||||
* the caller.
|
||||
*/
|
||||
wvcdm::metrics::MetricsGroup metrics;
|
||||
wvcdm::metrics::CryptoMetrics metrics;
|
||||
|
||||
level1_ = FunctionPointers(); // start with all null pointers.
|
||||
level3_ = FunctionPointers(); // start with all null pointers.
|
||||
@@ -474,7 +477,7 @@ class Adapter {
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_L1_OPEN_FAILED);
|
||||
return result;
|
||||
}
|
||||
if (LoadLevel1(metrics)) {
|
||||
if (LoadLevel1(&metrics)) {
|
||||
LOGD("OEMCrypto_Initialize Level 1 success. I will use level 1.");
|
||||
} else {
|
||||
level1_ = FunctionPointers(); // revert to all null pointers.
|
||||
@@ -485,7 +488,7 @@ class Adapter {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool LoadLevel1(wvcdm::metrics::MetricsGroup& metrics) {
|
||||
bool LoadLevel1(wvcdm::metrics::CryptoMetrics* metrics) {
|
||||
level1_valid_ = true;
|
||||
const uint32_t kMinimumVersion = 8;
|
||||
const uint32_t kMaximumVersion = 13;
|
||||
@@ -495,7 +498,7 @@ class Adapter {
|
||||
LOOKUP_ALL(8, Terminate, OEMCrypto_Terminate);
|
||||
if (!level1_valid_) {
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_INVALID_L1);
|
||||
@@ -505,7 +508,7 @@ class Adapter {
|
||||
if (st != OEMCrypto_SUCCESS) {
|
||||
LOGW("Could not initialize L1. Falling Back to L3.");
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_COULD_NOT_INITIALIZE_L1);
|
||||
@@ -513,7 +516,7 @@ class Adapter {
|
||||
}
|
||||
level1_.version = level1_.APIVersion();
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_l1_api_version_,
|
||||
NO_TIME,
|
||||
level1_.version,
|
||||
@@ -522,7 +525,7 @@ class Adapter {
|
||||
LOGW("liboemcrypto.so is version %d, not %d. Falling Back to L3.",
|
||||
level1_.version, kMinimumVersion);
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_WRONG_L1_VERSION);
|
||||
@@ -600,7 +603,7 @@ class Adapter {
|
||||
// If we have a valid keybox, initialization is done. We're good.
|
||||
if (OEMCrypto_SUCCESS == level1_.IsKeyboxValid()) {
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L1_WITH_KEYBOX);
|
||||
@@ -612,7 +615,7 @@ class Adapter {
|
||||
if (level1_.version > 11 &&
|
||||
(level1_.GetProvisioningMethod() == OEMCrypto_OEMCertificate)) {
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L1_WITH_PROVISIONING_3_0);
|
||||
@@ -632,13 +635,13 @@ class Adapter {
|
||||
LOGE("OEMCrypto uses cert as identification, but cdm does not!");
|
||||
LOGE("This will not work on a production device.");
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L1_CERTIFICATE_MIX);
|
||||
} else {
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L1_WITH_CERTIFICATE);
|
||||
@@ -651,7 +654,7 @@ class Adapter {
|
||||
LOGW("Bad Level 1 Keybox. Falling Back to L3.");
|
||||
level1_.Terminate();
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_BAD_KEYBOX);
|
||||
@@ -663,7 +666,7 @@ class Adapter {
|
||||
LOGW("Could not open %s. Falling Back to L3.", filename.c_str());
|
||||
level1_.Terminate();
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_COULD_NOT_OPEN_FACTORY_KEYBOX);
|
||||
@@ -677,7 +680,7 @@ class Adapter {
|
||||
filename.c_str());
|
||||
level1_.Terminate();
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_COULD_NOT_INSTALL_KEYBOX);
|
||||
@@ -685,7 +688,7 @@ class Adapter {
|
||||
}
|
||||
LOGI("Installed keybox from %s", filename.c_str());
|
||||
M_RECORD(
|
||||
&metrics,
|
||||
metrics,
|
||||
oemcrypto_initialization_mode_,
|
||||
NO_TIME,
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L1_INSTALLED_KEYBOX);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "crypto_session.h"
|
||||
#include "license.h"
|
||||
#include "log.h"
|
||||
#include "metrics_group.h"
|
||||
|
||||
namespace {
|
||||
std::string kEmptyString;
|
||||
@@ -140,7 +139,7 @@ CdmResponseType UsageTableHeader::UpdateEntry(CryptoSession* crypto_session,
|
||||
|
||||
CdmResponseType UsageTableHeader::DeleteEntry(uint32_t usage_entry_number,
|
||||
DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics) {
|
||||
metrics::CryptoMetrics* metrics) {
|
||||
LOGV("UsageTableHeader::DeleteEntry: Lock");
|
||||
AutoLock auto_lock(usage_table_header_lock_);
|
||||
if (usage_entry_number >= usage_entry_info_.size())
|
||||
@@ -189,14 +188,13 @@ CdmResponseType UsageTableHeader::DeleteEntry(uint32_t usage_entry_number,
|
||||
number_of_entries_to_be_deleted =
|
||||
usage_entry_info_.size() - swap_entry_number;
|
||||
}
|
||||
|
||||
return Shrink(metrics, number_of_entries_to_be_deleted);
|
||||
}
|
||||
|
||||
CdmResponseType UsageTableHeader::MoveEntry(
|
||||
uint32_t from_usage_entry_number, const CdmUsageEntry& from_usage_entry,
|
||||
uint32_t to_usage_entry_number, DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics) {
|
||||
metrics::CryptoMetrics* metrics) {
|
||||
LOGV("UsageTableHeader::MoveEntry");
|
||||
|
||||
// crypto_session points to an object whose scope is this method or a test
|
||||
@@ -373,7 +371,7 @@ CdmResponseType UsageTableHeader::StoreEntry(uint32_t usage_entry_number,
|
||||
}
|
||||
|
||||
CdmResponseType UsageTableHeader::Shrink(
|
||||
metrics::MetricsGroup* metrics,
|
||||
metrics::CryptoMetrics* metrics,
|
||||
uint32_t number_of_usage_entries_to_delete) {
|
||||
if (usage_entry_info_.empty()) {
|
||||
LOGE("UsageTableHeader::Shrink: usage entry info table unexpectedly empty");
|
||||
@@ -414,14 +412,14 @@ CdmResponseType UsageTableHeader::Shrink(
|
||||
}
|
||||
|
||||
CdmResponseType UsageTableHeader::UpgradeFromUsageTable(
|
||||
DeviceFiles* handle, metrics::MetricsGroup* metrics) {
|
||||
DeviceFiles* handle, metrics::CryptoMetrics* metrics) {
|
||||
UpgradeLicensesFromUsageTable(handle, metrics);
|
||||
UpgradeUsageInfoFromUsageTable(handle, metrics);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
bool UsageTableHeader::UpgradeLicensesFromUsageTable(
|
||||
DeviceFiles* handle, metrics::MetricsGroup* metrics) {
|
||||
DeviceFiles* handle, metrics::CryptoMetrics* metrics) {
|
||||
// Fetch the key set IDs for each offline license. For each license
|
||||
// * retrieve the provider session token,
|
||||
// * create a new usage entry
|
||||
@@ -510,7 +508,7 @@ bool UsageTableHeader::UpgradeLicensesFromUsageTable(
|
||||
}
|
||||
|
||||
bool UsageTableHeader::UpgradeUsageInfoFromUsageTable(
|
||||
DeviceFiles* handle, metrics::MetricsGroup* metrics) {
|
||||
DeviceFiles* handle, metrics::CryptoMetrics* metrics) {
|
||||
// Fetch all usage files. For each file retrieve all the usage info records
|
||||
// within the file. For each piece of usage information
|
||||
// * create a new usage entry
|
||||
|
||||
Reference in New Issue
Block a user