Make the twrp verify the pre-device among several props
This is really usefull for that devices that have multiple names, for
example for zenfone 6 that is called WW_I01WD and also ASUS_I01WD, with
this commit all roms also with a different pre-device will be successfully
flashed. I decided to use ro.product.model and ro.product.name because
these pros are also used in some roms updater-script to check the device
model before start the rom flashing.
Change-Id: I3b4cd3a13e3fff5c5a6c35bf1a0ed146d2b4c3ec
diff --git a/installcommand.cpp b/installcommand.cpp
index fa079ea..022aef6 100644
--- a/installcommand.cpp
+++ b/installcommand.cpp
@@ -121,8 +121,12 @@
}
}
char value[PROPERTY_VALUE_MAX];
+ char propmodel[PROPERTY_VALUE_MAX];
+ char propname[PROPERTY_VALUE_MAX];
property_get("ro.product.device", value, "");
+ property_get("ro.product.model", propmodel, "");
+ property_get("ro.product.name", propname, "");
const std::string& pkg_device = metadata["pre-device"];
std::vector<std::string> assertResults = android::base::Split(pkg_device, ",");
@@ -132,7 +136,7 @@
for(const std::string& deviceAssert : assertResults)
{
std::string assertName = android::base::Trim(deviceAssert);
- if (assertName == value && !assertName.empty()) {
+ if ((assertName == value || assertName == propmodel || assertName == propname ) && !assertName.empty()) {
deviceExists = true;
break;
}