sdm660: whyred: libinit: Set product model dynamically

Change-Id: I4f67e7025ea2a3b566fd7871e9f86dfa93c79c2a
This commit is contained in:
guaiyihu 2020-05-18 13:18:35 +02:00 committed by OdSazib
parent 10e587e287
commit cfc35d0d26
No known key found for this signature in database
GPG key ID: CB336514F9F5CF69

View file

@ -94,4 +94,22 @@ void vendor_load_persist_properties()
property_override_dual("ro.product.model", "ro.vendor.product.model", "MI PAD 4");
}
}
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");
}
}
}