Add device ID to Widevine license request
Also added other Client identification fields specified in license exchange protocol, Appendix C https://docs.google.com/a/google.com/document/d/1cng6cDnchbDQDymLEd5MxMc_laS3EDv6IsoW3IzpgwQ/edit#heading=h.pmkiti873xeg They are company, model, architecture, device and product name. bug: 8292249 Change-Id: I4d5fa93a0c85c7abb025c66d48e4aafbfe90efd8
This commit is contained in:
@@ -66,6 +66,7 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
|
libcutils \
|
||||||
libdl \
|
libdl \
|
||||||
liblog \
|
liblog \
|
||||||
libstlport \
|
libstlport \
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ LOCAL_SRC_FILES := \
|
|||||||
$(SRC_DIR)/clock.cpp \
|
$(SRC_DIR)/clock.cpp \
|
||||||
$(SRC_DIR)/lock.cpp \
|
$(SRC_DIR)/lock.cpp \
|
||||||
$(SRC_DIR)/log.cpp \
|
$(SRC_DIR)/log.cpp \
|
||||||
|
$(SRC_DIR)/properties.cpp \
|
||||||
$(SRC_DIR)/timer.cpp \
|
$(SRC_DIR)/timer.cpp \
|
||||||
$(SRC_DIR)/wv_content_decryption_module.cpp
|
$(SRC_DIR)/wv_content_decryption_module.cpp
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,11 @@ class Properties {
|
|||||||
static inline bool use_certificates_as_identification() {
|
static inline bool use_certificates_as_identification() {
|
||||||
return 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:
|
private:
|
||||||
static void set_begin_license_usage_when_received(bool flag) {
|
static void set_begin_license_usage_when_received(bool flag) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "crypto_engine.h"
|
||||||
#include "crypto_session.h"
|
#include "crypto_session.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "policy_engine.h"
|
#include "policy_engine.h"
|
||||||
@@ -11,6 +12,17 @@
|
|||||||
#include "string_conversions.h"
|
#include "string_conversions.h"
|
||||||
#include "wv_cdm_constants.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 {
|
namespace wvcdm {
|
||||||
|
|
||||||
// Protobuf generated classes.
|
// Protobuf generated classes.
|
||||||
@@ -105,13 +117,45 @@ bool CdmLicense::PrepareKeyRequest(const CdmInitData& init_data,
|
|||||||
client_id->set_type(ClientIdentification::KEYBOX);
|
client_id->set_type(ClientIdentification::KEYBOX);
|
||||||
client_id->set_token(token_);
|
client_id->set_token(token_);
|
||||||
|
|
||||||
ClientIdentification_NameValue client_info;
|
ClientIdentification_NameValue* client_info;
|
||||||
CdmAppParameterMap::const_iterator iter;
|
CdmAppParameterMap::const_iterator iter;
|
||||||
for (iter = app_parameters.begin(); iter != app_parameters.end(); 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_name(iter->first);
|
||||||
client_info->set_value(iter->second);
|
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
|
// Content Identification may be a cenc_id, a webm_id or a license_id
|
||||||
LicenseRequest_ContentIdentification* content_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 := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
|
libcutils \
|
||||||
libdl \
|
libdl \
|
||||||
liblog \
|
liblog \
|
||||||
libstagefright_foundation \
|
libstagefright_foundation \
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
|
libcutils \
|
||||||
libdl \
|
libdl \
|
||||||
liblog \
|
liblog \
|
||||||
libstlport \
|
libstlport \
|
||||||
|
|||||||
Reference in New Issue
Block a user