libwvdrmengine: Limit custom property check to ChromeOS
We added custom properties that are only used on ChromeOS and to avoid having to bloat the sepolicy for all of Android we are adding a check here so that we only query the properties on ChromeOS based on the bertha hardware property. Bug: b:237492145 Test: Access denied message is gone w/ ExoPlayer Change-Id: I3a5781ad980dfae2e16501b655386287b5e245b7 (cherry picked from commit 890f71ef367aed683a89892000e40d0e0ca6fbdd) (cherry picked from commit 4379b0545a2ae866ba9fc315551a5534fa163924)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user