Merges to android Pi release (part: 1)

Below are a set of CLs being merged from the wv cdm repo to the android repo.

* Fix handling of OEM Cert public key.

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/27921 ]

  This is a potential fix for b/36656190. Set aside public
  key on first call to get the public key, and use it afterwards.
  This gets rid of extra calls to OEMCrypto_GetOEMPublicCertificate(),
  which has side-effect of staging the OEM private key.

  This also fixes a problem where the public cert string was
  not being trimmed to match the size returned by
  OEMCrypto_GetOEMPublicCertificate().

* Complete provisioning request/response for Provisioning 3.0

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Fix bug on provisioning request path where GenerateDerivedKeys()
  was being called when preparing to generate the signature.

  Add message signature verification, and call correct OEMCrypto
  routine to rewrap the private key (OEMCrypto_RewrapDeviceRSAKey30).

* Implement Cdm::deleteAllUsageRecords()

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27780 ]

  Delete all usage records for current origin.  Removes usage
  records from file system and retains the PSTs.  The deletes
  any usage entries matching those PSTs held by OEMCrypto.

  BUG: 35319024

* Remove stringencoders library from third_party.

  Author: Jacob Trimble <modmaker@google.com>

  [ Merge of http://go/wvgerrit/27585 ]

  We have a fork of the stringencoders library that we use for base64
  encoding.  This reimplements base64 encoding to remove the extra
  dependency and to reduce the amount of code.

* Add Cdm::deleteUsageRecord() based on key_set_id.

  Author: Gene Morgan <gmorgan@google.com>

  [ Merge of http://go/wvgerrit/27605 ]

  Delete specified usage record from file system usage info and
  from OEMCrypto.

  BUG: 35319024

* Modifiable OEMCrypto

  Author: Fred Gylys-Colwell <fredgc@google.com>

  [ Merge of http://go/wvgerrit/24729 ]

  This CL adds a new variant of the OEMCrypto mock code that adjusts its
  behavior based on a configuration file.  This is intended for
  testing.

  For example, a tester can set current_hdcp to 2 in the options.txt
  file, push it to the device, and verify that a license is granted for
  HDCP 2.0.  Then the tester can edit the value of current_hdcp to 1 and
  push the file to the device.  Playback should stop because the license
  is no longer valid.

  This variant uses a real level 1 liboemcrypto.so to push data to a
  secure buffer.  That means we can test playback for a license that
  requires secure buffers on an Android device with real secure buffers.

  BUG: 35141278
  BUG: 37353534

BUG: 71650075
Test: Not currently passing. Will be addressed in a subsequent
      commit in the chain.

Change-Id: I58443c510919e992bb455192e70373490a00e2b6
This commit is contained in:
Rahul Frias
2018-01-05 17:05:18 -08:00
parent e34f83cdce
commit 0419b55222
120 changed files with 5402 additions and 6827 deletions

View File

@@ -6,14 +6,19 @@
#define WVCDM_METRICS_EVENT_METRIC_H_
#include <cstdarg>
#include <functional>
#include <map>
#include <memory>
#include <ostream>
#include <sstream>
#include <stdint.h>
#include <string>
#include <vector>
#include "distribution.h"
#include "field_tuples.h"
#include "lock.h"
#include "metric_serialization.h"
#include "distribution.h"
#include "metric_publisher.h"
namespace wvcdm {
namespace metrics {
@@ -22,11 +27,11 @@ class EventMetricTest;
// This base class provides the common defintion used by all templated
// instances of EventMetric.
class BaseEventMetric : public MetricSerializable {
class BaseEventMetric : public MetricPublisher {
public:
// Send metric values to the MetricSerializer. |serializer| must
// Publish metric values to the MetricNotification. |subscriber| must
// not be null and is owned by the caller.
virtual void Serialize(MetricSerializer* serializer);
virtual void Publish(MetricNotification* subscriber);
protected:
// Instantiates a BaseEventMetric.
@@ -55,6 +60,14 @@ class BaseEventMetric : public MetricSerializable {
Lock internal_lock_;
};
// This is a placeholder type for unused type parameters.
struct Unused {
// Required for compilation. Should never be used.
inline friend std::ostream& operator<< (std::ostream& out, const Unused&)
{ return out; }
};
// This class converts the size_t value into the highest power of two
// below the value. E.g. for 7, the value is 4. For 11, the value is 8.
// This class is intended to simplify the use of EventMetric Fields that may
@@ -100,7 +113,7 @@ class Pow2Bucket {
// on certain "field" values. For example, if a particular operation can run in
// one of two modes, it's useful to track the latency of the operation in each
// mode separately. You can use Fields to define how to breakdown the
// statistics. Each Field is a separate dimension. The statistics for each
// statistics. Each Field is a separate dimention. The statistics for each
// combination of field values are tracked independently.
//
// Example usage:
@@ -110,22 +123,19 @@ class Pow2Bucket {
//
// my_metric.Record(1, 7, 23); // (latency value, request type, error code).
//
// The EventMetric supports serialization. A call to Serialize will
// serialize all values to the provided MetricsSerializer instance.
// A MetricNotification may be used to allow the EventMetric instance to
// notify that an update occurred and provide the updated value.
//
// example:
//
// class MyMetricSerializer : public MetricSerializer {
// class MyMetricNotification : public MetricNotification {
// // Add implementation here.
// }
//
// MyMetricSerializer serializer;
// my_metric.Serialize(&serializer);
//
template<typename F1=util::Unused,
typename F2=util::Unused,
typename F3=util::Unused,
typename F4=util::Unused>
// MyMetricNotification notification;
// my_metric.Publish(notification);
template<typename F1=Unused,
typename F2=Unused,
typename F3=Unused,
typename F4=Unused>
class EventMetric : public BaseEventMetric {
public:
// Create an EventMetric instance with the name |metric_name|.
@@ -152,33 +162,96 @@ class EventMetric : public BaseEventMetric {
// Record will update the statistics of the EventMetric broken down by the
// given field values.
void Record(double value,
F1 field1 = util::Unused(),
F2 field2 = util::Unused(),
F3 field3 = util::Unused(),
F4 field4 = util::Unused());
F1 field1 = Unused(),
F2 field2 = Unused(),
F3 field3 = Unused(),
F4 field4 = Unused());
private:
friend class EventMetricTest;
std::vector<std::string> field_names_;
};
// This is an internal namespace for helper functions only.
namespace impl {
// This method formats the collection of field name/value pairs.
// The format of the string is:
//
// [{field:value[&field:value]*}]
//
// If there are no pairs, returns a blank string.
//
// TODO(blueeyes): Add a check for the count of field_names and the count
// of field values (check that the fields are not type Unused).
template<typename F1, typename F2, typename F3, typename F4>
std::string MakeFieldNameString(const std::vector<std::string>& field_names,
const F1 field1, const F2 field2,
const F3 field3, const F4 field4) {
std::stringstream field_name_and_values;
std::vector<std::string>::const_iterator field_name_iterator =
field_names.begin();
if (field_name_iterator == field_names.end()) {
return field_name_and_values.str();
}
// There is at least one name/value pair. prepend open brace.
field_name_and_values << "{";
field_name_and_values << *field_name_iterator << ':' << field1;
if (++field_name_iterator == field_names.end()) {
field_name_and_values << "}";
return field_name_and_values.str();
}
field_name_and_values << '&' << *field_name_iterator << ':' << field2;
if (++field_name_iterator == field_names.end()) {
field_name_and_values << "}";
return field_name_and_values.str();
}
field_name_and_values << '&' << *field_name_iterator << ':' << field3;
if (++field_name_iterator == field_names.end()) {
field_name_and_values << "}";
return field_name_and_values.str();
}
field_name_and_values << '&' << *field_name_iterator << ':' << field4;
field_name_and_values << "}";
return field_name_and_values.str();
}
// This specialization of the helper method is a shortcut for EventMetric
// instances with no fields.
template<>
inline std::string MakeFieldNameString<Unused, Unused, Unused, Unused>(
const std::vector<std::string>& /* field_names */,
const Unused /* unused1 */, const Unused /* unused2 */,
const Unused /* unused3 */, const Unused /* unused4 */) {
return "";
}
// This helper function appends the field names to a vector of strings.
inline void AppendFieldNames(std::vector<std::string>* field_name_vector,
int field_count, ...) {
va_list field_names;
va_start(field_names, field_count);
for (int x = 0; x < field_count; x++) {
field_name_vector->push_back(va_arg(field_names, const char*));
}
va_end(field_names);
}
} // namespace impl
// Overloaded template constructor implementations for EventMetric.
template<typename F1, typename F2, typename F3, typename F4>
EventMetric<F1, F2, F3, F4>::EventMetric(
const std::string& metric_name)
: BaseEventMetric(metric_name) {
ASSERT_METRIC_UNUSED_START_FROM(1);
}
: BaseEventMetric(metric_name) {}
template<typename F1, typename F2, typename F3, typename F4>
EventMetric<F1, F2, F3, F4>::EventMetric(
const std::string& metric_name,
const char* field_name)
: BaseEventMetric(metric_name) {
ASSERT_METRIC_UNUSED_START_FROM(2);
util::AppendFieldNames(&field_names_,
util::FirstUnusedType<F1, F2, F3, F4>::value - 1,
field_name);
impl::AppendFieldNames(&field_names_, 1, field_name);
}
template<typename F1, typename F2, typename F3, typename F4>
EventMetric<F1, F2, F3, F4>::EventMetric(
@@ -186,10 +259,7 @@ EventMetric<F1, F2, F3, F4>::EventMetric(
const char* field_name1,
const char* field_name2)
: BaseEventMetric(metric_name) {
ASSERT_METRIC_UNUSED_START_FROM(3);
util::AppendFieldNames(&field_names_,
util::FirstUnusedType<F1, F2, F3, F4>::value - 1,
field_name1, field_name2);
impl::AppendFieldNames(&field_names_, 2, field_name1, field_name2);
}
template<typename F1, typename F2, typename F3, typename F4>
EventMetric<F1, F2, F3, F4>::EventMetric(
@@ -198,10 +268,8 @@ EventMetric<F1, F2, F3, F4>::EventMetric(
const char* field_name2,
const char* field_name3)
: BaseEventMetric(metric_name) {
ASSERT_METRIC_UNUSED_START_FROM(4);
util::AppendFieldNames(&field_names_,
util::FirstUnusedType<F1, F2, F3, F4>::value - 1,
field_name1, field_name2, field_name3);
impl::AppendFieldNames(&field_names_,
3, field_name1, field_name2, field_name3);
}
template<typename F1, typename F2, typename F3, typename F4>
EventMetric<F1, F2, F3, F4>::EventMetric(
@@ -211,10 +279,8 @@ EventMetric<F1, F2, F3, F4>::EventMetric(
const char* field_name3,
const char* field_name4)
: BaseEventMetric(metric_name) {
ASSERT_METRIC_UNUSED_START_FROM(5);
util::AppendFieldNames(&field_names_,
util::FirstUnusedType<F1, F2, F3, F4>::value - 1,
field_name1, field_name2,
impl::AppendFieldNames(&field_names_,
4, field_name1, field_name2,
field_name3, field_name4);
}
@@ -222,7 +288,7 @@ template<typename F1, typename F2, typename F3, typename F4>
void EventMetric<F1, F2, F3, F4>::Record(
double value, F1 field1, F2 field2, F3 field3, F4 field4) {
std::string field_name_values =
util::MakeFieldNameString(field_names_, field1, field2, field3, field4);
impl::MakeFieldNameString(field_names_, field1, field2, field3, field4);
BaseEventMetric::Record(field_name_values, value);
}

View File

@@ -17,6 +17,9 @@ namespace wvcdm {
namespace metrics {
namespace util {
// TODO(blueeyes): Change to use C++ 11 support for variadic template args.
// The C++ 03 pattern is no longer needed since we require C++11. b/68766426.
// This is a placeholder type for unused type parameters. It aids in supporting
// templated classes with "variable" type arguments.
struct Unused {

View File

@@ -10,11 +10,9 @@
#include <stddef.h>
#include <stdint.h>
#include "counter_metric.h"
#include "event_metric.h"
#include "metrics.pb.h"
#include "OEMCryptoCENC.h"
#include "value_metric.h"
#include "wv_cdm_types.h"
// This definition indicates that a given metric does not need timing
@@ -88,64 +86,70 @@ class CryptoMetrics {
void Serialize(drm_metrics::MetricsGroup* metrics);
/* CRYPTO SESSION */
// TODO(blueeyes): Convert this to crypto_session_default_security_level_.
ValueMetric<CdmSecurityLevel> crypto_session_security_level_;
CounterMetric<CdmResponseType> crypto_session_delete_all_usage_reports_;
CounterMetric<CdmResponseType> crypto_session_delete_multiple_usage_information_;
EventMetric<CdmResponseType> crypto_session_delete_all_usage_reports_;
EventMetric<CdmResponseType> crypto_session_delete_multiple_usage_information_;
EventMetric<CdmResponseType, Pow2Bucket, CdmEncryptionAlgorithm> crypto_session_generic_decrypt_;
EventMetric<CdmResponseType, Pow2Bucket, CdmEncryptionAlgorithm> crypto_session_generic_encrypt_;
EventMetric<CdmResponseType, Pow2Bucket, CdmSigningAlgorithm> crypto_session_generic_sign_;
EventMetric<CdmResponseType, Pow2Bucket, CdmSigningAlgorithm> crypto_session_generic_verify_;
CounterMetric<bool> crypto_session_get_device_unique_id_;
CounterMetric<bool> crypto_session_get_token_;
ValueMetric<double> crypto_session_life_span_;
EventMetric<bool> crypto_session_get_device_unique_id_;
EventMetric<CdmSecurityLevel> crypto_session_get_security_level_;
EventMetric<bool, uint32_t> crypto_session_get_system_id_;
EventMetric<bool> crypto_session_get_token_;
EventMetric<> crypto_session_life_span_;
EventMetric<bool> crypto_session_load_certificate_private_key_;
EventMetric<CdmResponseType, SecurityLevel> crypto_session_open_; // This is the requested security level.
ValueMetric<uint32_t> crypto_session_system_id_;
EventMetric<CdmResponseType, SecurityLevel> crypto_session_open_;
EventMetric<CdmResponseType> crypto_session_update_usage_information_;
ValueMetric<bool> crypto_session_usage_information_support_;
EventMetric<bool> crypto_session_usage_information_support_;
/* OEMCRYPTO */
ValueMetric<uint32_t> oemcrypto_api_version_;
CounterMetric<OEMCryptoResult> oemcrypto_close_session_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_copy_buffer_;
ValueMetric<OEMCrypto_HDCP_Capability> oemcrypto_current_hdcp_capability_;
CounterMetric<OEMCryptoResult> oemcrypto_deactivate_usage_entry_;
EventMetric<uint32_t, SecurityLevel> oemcrypto_api_version_;
EventMetric<OEMCryptoResult> oemcrypto_close_session_;
EventMetric<OEMCryptoResult, SecurityLevel, Pow2Bucket> oemcrypto_copy_buffer_;
EventMetric<OEMCryptoResult> oemcrypto_deactivate_usage_entry_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_decrypt_cenc_;
CounterMetric<OEMCryptoResult> oemcrypto_delete_usage_entry_;
CounterMetric<OEMCryptoResult> oemcrypto_delete_usage_table_;
EventMetric<OEMCryptoResult> oemcrypto_delete_usage_entry_;
EventMetric<OEMCryptoResult> oemcrypto_delete_usage_table_;
EventMetric<OEMCryptoResult> oemcrypto_derive_keys_from_session_key_;
CounterMetric<OEMCryptoResult> oemcrypto_force_delete_usage_entry_;
EventMetric<OEMCryptoResult> oemcrypto_force_delete_usage_entry_;
EventMetric<OEMCryptoResult> oemcrypto_generate_derived_keys_;
CounterMetric<OEMCryptoResult> oemcrypto_generate_nonce_;
EventMetric<OEMCryptoResult> oemcrypto_generate_nonce_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generate_rsa_signature_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generate_signature_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_decrypt_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_encrypt_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_sign_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_generic_verify_;
CounterMetric<OEMCryptoResult> oemcrypto_get_device_id_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_get_key_data_;
CounterMetric<OEMCryptoResult> oemcrypto_get_oem_public_certificate_;
CounterMetric<OEMCryptoResult> oemcrypto_get_random_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_device_id_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_hdcp_capability_;
EventMetric<OEMCryptoResult, Pow2Bucket, SecurityLevel> oemcrypto_get_key_data_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_max_number_of_sessions_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_get_number_of_open_sessions_;
EventMetric<OEMCryptoResult> oemcrypto_get_oem_public_certificate_;
EventMetric<OEMCrypto_ProvisioningMethod, SecurityLevel> oemcrypto_get_provisioning_method_;
EventMetric<OEMCryptoResult, Pow2Bucket> oemcrypto_get_random_;
EventMetric<OEMCryptoResult> oemcrypto_initialize_;
EventMetric<OEMCryptoResult> oemcrypto_install_keybox_;
ValueMetric<bool> oemcrypto_is_anti_rollback_hw_present_;
ValueMetric<bool> oemcrypto_is_keybox_valid_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_install_keybox_;
EventMetric<bool, SecurityLevel> oemcrypto_is_anti_rollback_hw_present_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_is_keybox_valid_;
EventMetric<OEMCryptoResult> oemcrypto_load_device_rsa_key_;
EventMetric<OEMCryptoResult> oemcrypto_load_keys_;
ValueMetric<OEMCrypto_HDCP_Capability> oemcrypto_max_hdcp_capability_;
ValueMetric<size_t> oemcrypto_max_number_of_sessions_;
ValueMetric<size_t> oemcrypto_number_of_open_sessions_;
ValueMetric<OEMCrypto_ProvisioningMethod> oemcrypto_provisioning_method_;
EventMetric<OEMCryptoResult> oemcrypto_load_test_keybox_;
EventMetric<OEMCryptoResult> oemcrypto_load_test_rsa_key_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_open_session_;
EventMetric<OEMCryptoResult> oemcrypto_refresh_keys_;
CounterMetric<OEMCryptoResult> oemcrypto_report_usage_;
EventMetric<OEMCryptoResult> oemcrypto_report_usage_;
EventMetric<OEMCryptoResult> oemcrypto_rewrap_device_rsa_key_;
EventMetric<OEMCryptoResult> oemcrypto_rewrap_device_rsa_key_30_;
ValueMetric<uint16_t> oemcrypto_security_patch_level_;
EventMetric<CdmSecurityLevel, SecurityLevel> oemcrypto_security_level_;
EventMetric<uint16_t, SecurityLevel> oemcrypto_security_patch_level_;
EventMetric<OEMCryptoResult> oemcrypto_select_key_;
ValueMetric<bool> oemcrypto_supports_usage_table_;
CounterMetric<OEMCryptoResult> oemcrypto_update_usage_table_;
EventMetric<OEMCryptoResult, SecurityLevel> oemcrypto_supports_usage_table_;
EventMetric<OEMCryptoResult> oemcrypto_update_usage_table_;
EventMetric<OEMCryptoResult> oemcrypto_wrap_keybox_;
/* Internal OEMCrypto Metrics */
EventMetric<OEMCryptoInitializationMode> oemcrypto_initialization_mode_;
EventMetric<uint32_t, uint32_t> oemcrypto_l1_api_version_;
};
// This class contains session-scoped metrics. All properties and
@@ -174,16 +178,16 @@ class SessionMetrics {
// This instance retains ownership of the object.
CryptoMetrics* GetCryptoMetrics() { return &crypto_metrics_; }
// Metrics collected at the session level.
EventMetric<> cdm_session_life_span_;
EventMetric<CdmResponseType> cdm_session_renew_key_;
EventMetric<CdmResponseType> cdm_session_restore_offline_session_;
EventMetric<CdmResponseType> cdm_session_restore_usage_session_;
// Serialize the session metrics to the provided |metric_group|.
// |metric_group| is owned by the caller and must not be null.
void Serialize(drm_metrics::MetricsGroup* metric_group);
// Metrics collected at the session level.
ValueMetric<double> cdm_session_life_span_; // Milliseconds.
EventMetric<CdmResponseType> cdm_session_renew_key_;
CounterMetric<CdmResponseType> cdm_session_restore_offline_session_;
CounterMetric<CdmResponseType> cdm_session_restore_usage_session_;
private:
void SerializeSessionMetrics(drm_metrics::MetricsGroup* metric_group);
CdmSessionId session_id_;
@@ -191,45 +195,6 @@ class SessionMetrics {
CryptoMetrics crypto_metrics_;
};
// This class contains metrics for the OEMCrypto Dynamic Adapter. They are
// separated from other metrics because they need to be encapsulated in a
// singleton object. This is because the dynamic adapter uses the OEMCrypto
// function signatures and contract and cannot be extended to inject
// dependencies.
//
// Operations for this metrics class are serialized since these particular
// metrics may be accessed by a separate thread during intialize even as
// the metric may be serialized.
class OemCryptoDynamicAdapterMetrics {
public:
explicit OemCryptoDynamicAdapterMetrics();
// Set methods for OEMCrypto metrics.
void SetInitializationMode(OEMCryptoInitializationMode mode);
void SetL1ApiVersion(uint32_t version);
void SetL1MinApiVersion(uint32_t version);
// Serialize the session metrics to the provided |metric_group|.
// |metric_group| is owned by the caller and must not be null.
void Serialize(drm_metrics::MetricsGroup* metric_group);
// Clears the existing metric values.
void Clear();
private:
Lock adapter_lock_;
ValueMetric<OEMCryptoInitializationMode> oemcrypto_initialization_mode_;
ValueMetric<uint32_t> oemcrypto_l1_api_version_;
ValueMetric<uint32_t> oemcrypto_l1_min_api_version_;
};
// This will fetch the singleton instance for dynamic adapter metrics.
// This method is safe only if we use C++ 11. In C++ 11, static function-local
// initialization is guaranteed to be threadsafe. We return the reference to
// avoid non-guaranteed destructor order problems. Effectively, the destructor
// is never run for the created instance.
OemCryptoDynamicAdapterMetrics& GetDynamicAdapterMetricsInstance();
// This class contains engine-scoped metrics. All properties and
// statistics related to operations within the engine, but outside
// the scope of a session are recorded here.
@@ -263,34 +228,29 @@ class EngineMetrics {
void Serialize(drm_metrics::MetricsGroup* metric_group, bool completed_only,
bool clear_serialized_sessions);
void SetAppPackageName(const std::string& app_package_name);
// Metrics recorded at the engine level.
EventMetric<CdmResponseType> cdm_engine_add_key_;
ValueMetric<std::string> cdm_engine_cdm_version_;
CounterMetric<CdmResponseType> cdm_engine_close_session_;
ValueMetric<int64_t> cdm_engine_creation_time_millis_;
EventMetric<CdmResponseType, Pow2Bucket> cdm_engine_decrypt_;
CounterMetric<bool> cdm_engine_find_session_for_key_;
EventMetric<CdmResponseType> cdm_engine_close_session_;
EventMetric<CdmResponseType> cdm_engine_decrypt_;
EventMetric<bool> cdm_engine_find_session_for_key_;
EventMetric<CdmResponseType> cdm_engine_generate_key_request_;
EventMetric<CdmResponseType> cdm_engine_get_provisioning_request_;
EventMetric<CdmResponseType> cdm_engine_get_usage_info_;
EventMetric<CdmResponseType> cdm_engine_handle_provisioning_response_;
ValueMetric<double> cdm_engine_life_span_; // Milliseconds
CounterMetric<CdmResponseType> cdm_engine_open_key_set_session_;
CounterMetric<CdmResponseType> cdm_engine_open_session_;
EventMetric<> cdm_engine_life_span_;
EventMetric<CdmResponseType> cdm_engine_open_key_set_session_;
EventMetric<CdmResponseType> cdm_engine_open_session_;
EventMetric<CdmResponseType> cdm_engine_query_key_status_;
CounterMetric<CdmResponseType> cdm_engine_release_all_usage_info_;
CounterMetric<CdmResponseType> cdm_engine_release_usage_info_;
CounterMetric<CdmResponseType> cdm_engine_remove_keys_;
EventMetric<CdmResponseType> cdm_engine_release_all_usage_info_;
EventMetric<CdmResponseType> cdm_engine_release_usage_info_;
EventMetric<CdmResponseType> cdm_engine_remove_keys_;
EventMetric<CdmResponseType> cdm_engine_restore_key_;
CounterMetric<CdmResponseType, CdmSecurityLevel> cdm_engine_unprovision_;
EventMetric<CdmResponseType, CdmSecurityLevel> cdm_engine_unprovision_;
private:
Lock session_metrics_lock_;
std::vector<metrics::SessionMetrics*> session_metrics_list_;
CryptoMetrics crypto_metrics_;
std::string app_package_name_;
void SerializeEngineMetrics(drm_metrics::MetricsGroup* out);
};

View File

@@ -86,12 +86,6 @@ class ValueMetric : public MetricSerializable {
// Get the current value of the metric.
const T& GetValue() { return value_; }
// Clears the indicators that the metric or error was set.
void Clear() {
has_value_ = false;
has_error_ = false;
}
private:
std::string metric_name_;
T value_;