sdm660-common: whyred: init: Add custom init to set proper variants (#55)

* Revert "sdm660: whyred: libinit: Set product model dynamically"

This reverts commit 92bf64ca5b27324f40d02a64ff770d29426e6eb4.

* sdm660-common: whyred: init: Add custom init to set proper variants

Change-Id: I30c57fb24cea89af879d102e4749f95ec1aa9985
This commit is contained in:
Keertesh 2020-06-22 10:43:52 +05:30 committed by OdSazib
parent 3648c48235
commit 3c89fae5d3
No known key found for this signature in database
GPG key ID: A2D2E5C18BB04462

View file

@ -116,22 +116,25 @@ void vendor_load_persist_properties()
}
}
if (product.find("whyred") != std::string::npos) {
std::ifstream fin;
std::string buf;
fin.open("/proc/cmdline");
while (std::getline(fin, buf, ' '))
if (buf.find("androidboot.hwc") != std::string::npos)
break;
fin.close();
if (buf.find("CN") != std::string::npos || buf.find("Global") != std::string::npos) {
property_override_dual("ro.product.model", "ro.vendor.product.model", "Redmi Note 5");
} else {
property_override_dual("ro.product.model", "ro.vendor.product.model", "Redmi Note 5 Pro");
}
}
}
void vendor_load_properties()
{
std::string product = GetProperty("ro.product.vendor.device", "");
if (product.find("whyred") != std::string::npos)
{
std::string region = GetProperty("ro.boot.hwc", "");
if (region.find("CN") != std::string::npos || region.find("Global") != std::string::npos || region.find("GLOBAL") != std::string::npos)
{
property_override_dual("ro.product.model", "ro.vendor.product.model", "Redmi Note 5");
property_override_dual("ro.product.odm.model", "ro.product.system.model", "Redmi Note 5");
property_override_dual("ro.product.vendor.model", "persist.vendor.camera.exif.model", "Redmi Note 5");
}
else
{
property_override_dual("ro.product.model", "ro.vendor.product.model", "Redmi Note 5 Pro");
property_override_dual("ro.product.odm.model", "ro.product.system.model", "Redmi Note 5 Pro");
property_override_dual("ro.product.vendor.model", "persist.vendor.camera.exif.model", "Redmi Note 5 Pro");
}
}
}