Fixes metrics collection during CdmEngine close.

This fixes a problem where a CdmEngine instance (and its sessions) could
be closed before its metrics could be collected. The change allows the
wv_content_decryption_module to extract metrics from instances about to
be closed. These are held until reported to the caller.

Test: Manually verified that collection is now occurring correctly. Also
added unit test: wv_cdm_metric_test.

This is a merge from wvgerrit/29069

Change-Id: If82bfd5cae3b72b9d14ab4741424a7ae7cc0a3a6
This commit is contained in:
Adam Stone
2017-06-16 14:00:30 -07:00
parent efad3eea21
commit 457aceb859
11 changed files with 220 additions and 34 deletions

View File

@@ -140,7 +140,7 @@ class CryptoMetrics {
EventMetric<OEMCryptoResult> oemcrypto_rewrap_device_rsa_key_;
EventMetric<OEMCryptoResult> oemcrypto_rewrap_device_rsa_key_30_;
EventMetric<CdmSecurityLevel, SecurityLevel> oemcrypto_security_level_;
EventMetric<uint8_t, SecurityLevel> oemcrypto_security_patch_level_;
EventMetric<uint16_t, SecurityLevel> oemcrypto_security_patch_level_;
EventMetric<OEMCryptoResult> oemcrypto_select_key_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_supports_usage_table_;
EventMetric<OEMCryptoResult> oemcrypto_update_usage_table_;

View File

@@ -4,6 +4,7 @@
#include <algorithm>
#include "log.h"
#include "metrics.pb.h"
using drm_metrics::MetricsGroup;
@@ -438,6 +439,10 @@ EngineMetrics::EngineMetrics() :
EngineMetrics::~EngineMetrics() {
AutoLock kock(session_metrics_lock_);
std::vector<SessionMetrics*>::iterator i;
if (!session_metrics_list_.empty()) {
LOGV("EngineMetrics::~EngineMetrics. Session count: %d",
session_metrics_list_.size());
}
for (i = session_metrics_list_.begin(); i != session_metrics_list_.end();
i++) {
delete *i;