Merge "Add "Model Year" to list of CDM identification properties"

This commit is contained in:
TreeHugger Robot
2021-11-24 01:06:39 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 1 deletions

View File

@@ -66,6 +66,7 @@ class Properties {
}
static bool GetCompanyName(std::string* company_name);
static bool GetModelName(std::string* model_name);
static bool GetModelYear(std::string* model_year);
static bool GetArchitectureName(std::string* arch_name);
static bool GetDeviceName(std::string* device_name);
static bool GetProductName(std::string* product_name);

View File

@@ -17,6 +17,7 @@ namespace wvcdm {
namespace {
const std::string kKeyCompanyName = "company_name";
const std::string kKeyModelName = "model_name";
const std::string kKeyModelYear = "model_year";
const std::string kKeyArchitectureName = "architecture_name";
const std::string kKeyDeviceName = "device_name";
const std::string kKeyProductName = "product_name";
@@ -29,9 +30,10 @@ const std::string kKeyOemCryptoBuildInformation =
// These client identification keys are used by the CDM for relaying
// important device information that cannot be overwritten by the app.
const std::array<std::string, 9> kReservedProperties = {
const std::array<std::string, 10> kReservedProperties = {
kKeyCompanyName,
kKeyModelName,
kKeyModelYear,
kKeyArchitectureName,
kKeyDeviceName,
kKeyProductName,
@@ -159,6 +161,11 @@ CdmResponseType ClientIdentification::Prepare(
client_info->set_name(kKeyModelName);
client_info->set_value(value);
}
if (Properties::GetModelYear(&value)) {
client_info = client_id->add_client_info();
client_info->set_name(kKeyModelYear);
client_info->set_value(value);
}
if (Properties::GetArchitectureName(&value)) {
client_info = client_id->add_client_info();
client_info->set_name(kKeyArchitectureName);

View File

@@ -71,6 +71,10 @@ bool Properties::GetModelName(std::string* model_name) {
return GetAndroidProperty("ro.product.model", model_name);
}
bool Properties::GetModelYear(std::string* /*model_year*/) {
return false; // Not implemented on Android
}
bool Properties::GetArchitectureName(std::string* arch_name) {
if (!arch_name) {
LOGW("Properties::GetArchitectureName: Invalid parameter");