Merge "Add device ID to Widevine license request" into jb-mr2-dev
This commit is contained in:
@@ -66,6 +66,7 @@ LOCAL_STATIC_LIBRARIES := \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libcrypto \
|
||||
libcutils \
|
||||
libdl \
|
||||
liblog \
|
||||
libstlport \
|
||||
|
||||
@@ -33,6 +33,7 @@ LOCAL_SRC_FILES := \
|
||||
$(SRC_DIR)/clock.cpp \
|
||||
$(SRC_DIR)/lock.cpp \
|
||||
$(SRC_DIR)/log.cpp \
|
||||
$(SRC_DIR)/properties.cpp \
|
||||
$(SRC_DIR)/timer.cpp \
|
||||
$(SRC_DIR)/wv_content_decryption_module.cpp
|
||||
|
||||
|
||||
@@ -39,7 +39,11 @@ class Properties {
|
||||
static inline bool use_certificates_as_identification() {
|
||||
return use_certificates_as_identification_;
|
||||
}
|
||||
|
||||
static bool GetModelName(std::string& model_name);
|
||||
static bool GetArchitectureName(std::string& arch_name);
|
||||
static bool GetDeviceName(std::string& device_name);
|
||||
static bool GetProductName(std::string& product_name);
|
||||
static bool GetBuildInfo(std::string& build_info);
|
||||
|
||||
private:
|
||||
static void set_begin_license_usage_when_received(bool flag) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "crypto_engine.h"
|
||||
#include "crypto_session.h"
|
||||
#include "log.h"
|
||||
#include "policy_engine.h"
|
||||
@@ -11,6 +12,17 @@
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
namespace {
|
||||
std::string kCompanyNameKey = "company_name";
|
||||
std::string kCompanyNameValueGoogle = "Google";
|
||||
std::string kModelNameKey = "model_name";
|
||||
std::string kArchitectureNameKey = "architecture_name";
|
||||
std::string kDeviceNameKey = "device_name";
|
||||
std::string kProductNameKey = "product_name";
|
||||
std::string kBuildInfoKey = "build_info";
|
||||
std::string kDeviceIdKey = "device_id";
|
||||
}
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// Protobuf generated classes.
|
||||
@@ -105,13 +117,45 @@ bool CdmLicense::PrepareKeyRequest(const CdmInitData& init_data,
|
||||
client_id->set_type(ClientIdentification::KEYBOX);
|
||||
client_id->set_token(token_);
|
||||
|
||||
ClientIdentification_NameValue client_info;
|
||||
ClientIdentification_NameValue* client_info;
|
||||
CdmAppParameterMap::const_iterator iter;
|
||||
for (iter = app_parameters.begin(); iter != app_parameters.end(); iter++) {
|
||||
ClientIdentification_NameValue* client_info = client_id->add_client_info();
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(iter->first);
|
||||
client_info->set_value(iter->second);
|
||||
}
|
||||
std::string value;
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(kCompanyNameKey);
|
||||
client_info->set_value(kCompanyNameValueGoogle);
|
||||
if (Properties::GetModelName(value)) {
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(kModelNameKey);
|
||||
client_info->set_value(value);
|
||||
}
|
||||
if (Properties::GetArchitectureName(value)) {
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(kArchitectureNameKey);
|
||||
client_info->set_value(value);
|
||||
}
|
||||
if (Properties::GetDeviceName(value)) {
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(kDeviceNameKey);
|
||||
client_info->set_value(value);
|
||||
}
|
||||
if (Properties::GetProductName(value)) {
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(kProductNameKey);
|
||||
client_info->set_value(value);
|
||||
}
|
||||
if (Properties::GetBuildInfo(value)) {
|
||||
client_info = client_id->add_client_info();
|
||||
client_info->set_name(kBuildInfoKey);
|
||||
client_info->set_value(value);
|
||||
}
|
||||
|
||||
client_info->set_name(kDeviceIdKey);
|
||||
client_info->set_value(CryptoEngine::GetInstance()->GetDeviceUniqueId());
|
||||
|
||||
// Content Identification may be a cenc_id, a webm_id or a license_id
|
||||
LicenseRequest_ContentIdentification* content_id =
|
||||
|
||||
42
libwvdrmengine/cdm/src/properties.cpp
Normal file
42
libwvdrmengine/cdm/src/properties.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "cutils/properties.h"
|
||||
#include "properties.h"
|
||||
|
||||
namespace {
|
||||
bool GetAndroidProperty(const char* key, std::string& value) {
|
||||
char val[PROPERTY_VALUE_MAX];
|
||||
|
||||
if (property_get(key, val, "Unknown") <= 0)
|
||||
return false;
|
||||
|
||||
value = val;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
bool Properties::GetModelName(std::string& model_name) {
|
||||
return GetAndroidProperty("ro.product.model", model_name);
|
||||
}
|
||||
|
||||
bool Properties::GetArchitectureName(std::string& arch_name) {
|
||||
return GetAndroidProperty("ro.product.cpu.abi", arch_name);
|
||||
}
|
||||
|
||||
bool Properties::GetDeviceName(std::string& device_name) {
|
||||
return GetAndroidProperty("ro.product.device", device_name);
|
||||
}
|
||||
|
||||
bool Properties::GetProductName(std::string& product_name) {
|
||||
return GetAndroidProperty("ro.product.name", product_name);
|
||||
}
|
||||
|
||||
bool Properties::GetBuildInfo(std::string& build_info) {
|
||||
return GetAndroidProperty("ro.build.fingerprint", build_info);
|
||||
}
|
||||
|
||||
} // namespace wvcdm
|
||||
@@ -26,6 +26,7 @@ LOCAL_STATIC_LIBRARIES := \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libcrypto \
|
||||
libcutils \
|
||||
libdl \
|
||||
liblog \
|
||||
libstagefright_foundation \
|
||||
|
||||
@@ -27,6 +27,7 @@ LOCAL_STATIC_LIBRARIES := \
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libcrypto \
|
||||
libcutils \
|
||||
libdl \
|
||||
liblog \
|
||||
libstlport \
|
||||
|
||||
Reference in New Issue
Block a user