Merge "libwvdrmengine: Limit custom property check to ChromeOS"

This commit is contained in:
Jeffrey Kardatzke
2022-09-23 21:26:24 +00:00
committed by Android (Google) Code Review

View File

@@ -21,6 +21,7 @@ const char kL1Dir[] = "/L1/";
const char kL2Dir[] = "/L2/";
const char kL3Dir[] = "/L3/";
const char kFactoryKeyboxPath[] = "/factory/wv.keys";
const char kChromeOsHardware[] = "bertha";
bool GetAndroidProperty(const char* key, std::string* value) {
if (!key) {
@@ -63,8 +64,12 @@ bool Properties::GetCompanyName(std::string* company_name) {
LOGW("Properties::GetCompanyName: Invalid parameter");
return false;
}
if (GetAndroidProperty("ro.product.cdm.manufacturer", company_name))
std::string hardware;
if (GetAndroidProperty("ro.hardware", &hardware) &&
hardware == kChromeOsHardware &&
GetAndroidProperty("ro.product.cdm.manufacturer", company_name)) {
return true;
}
return GetAndroidProperty("ro.product.manufacturer", company_name);
}
@@ -73,7 +78,12 @@ bool Properties::GetModelName(std::string* model_name) {
LOGW("Properties::GetModelName: Invalid parameter");
return false;
}
if (GetAndroidProperty("ro.product.cdm.model", model_name)) return true;
std::string hardware;
if (GetAndroidProperty("ro.hardware", &hardware) &&
hardware == kChromeOsHardware &&
GetAndroidProperty("ro.product.cdm.model", model_name)) {
return true;
}
return GetAndroidProperty("ro.product.model", model_name);
}
@@ -94,7 +104,12 @@ bool Properties::GetDeviceName(std::string* device_name) {
LOGW("Properties::GetDeviceName: Invalid parameter");
return false;
}
if (GetAndroidProperty("ro.product.cdm.device", device_name)) return true;
std::string hardware;
if (GetAndroidProperty("ro.hardware", &hardware) &&
hardware == kChromeOsHardware &&
GetAndroidProperty("ro.product.cdm.device", device_name)) {
return true;
}
return GetAndroidProperty("ro.product.device", device_name);
}