Support GetPropertyByteArray for getting metrics.

Adds support for GetPropertyByteArray to return a serialized set of metrics
to the caller. This should be the last part of the widevine plugin
changes that fix the referenced bug.  More changes are coming on the
MediaDrm side.

This is a merge of wvgerrit/28422

I intend to submit 2048751, 2048750, and 2048509 together.

Bug: 36217927
Test: Added additional unit tests for affected code.
Change-Id: I2618c2be48d7d780127e35f237e2276efd080879
This commit is contained in:
Adam Stone
2017-03-30 11:31:51 -07:00
parent b851dd8cfd
commit a0da1f067b
9 changed files with 85 additions and 32 deletions

View File

@@ -4,22 +4,19 @@
#define CDM_AMI_ADAPTER_H_
#include <stdint.h>
#include <string>
#include <media/MediaAnalyticsItem.h>
#include "report.h"
namespace wvcdm {
class AmiAdapter : public metrics::Report {
class AmiAdapter {
public:
AmiAdapter();
AmiAdapter(int64_t parent);
~AmiAdapter();
metrics::Report* NewReport() const;
void UpdateString(const std::string& metric_id, const std::string& value);
void UpdateInt32(const std::string& metric_id, int32_t value);
void UpdateInt64(const std::string& metric_id, int64_t value);

View File

@@ -11,7 +11,6 @@
#include "cdm_identifier.h"
#include "file_store.h"
#include "lock.h"
#include "metrics_front_end.h"
#include "timer.h"
#include "wv_cdm_types.h"
@@ -122,6 +121,9 @@ class WvContentDecryptionModule : public android::RefBase, public TimerHandler {
// Validate a passed-in service certificate
virtual bool IsValidServiceCertificate(const std::string& certificate);
// Retrieve the serialized metrics from the CDM.
virtual void GetSerializedMetrics(std::string* serialized_metrics);
private:
struct CdmInfo {
CdmInfo();
@@ -156,9 +158,6 @@ class WvContentDecryptionModule : public android::RefBase, public TimerHandler {
// This contains weak pointers to the CDM instances contained in |cdms_|.
std::map<std::string, CdmEngine*> cdm_by_session_id_;
metrics::Report* report_root_;
metrics::MetricsFrontEnd* front_end_;
CORE_DISALLOW_COPY_AND_ASSIGN(WvContentDecryptionModule);
};