Adding TARGET_OTA_ASSERT_DEVICE flag for custom device asserts

Should be handled via device tree's BoardConfig
Sample will be TARGET_OTA_ASSERT_DEVICE := le_zl1,zl1,lepro3,lex720,lex727,LEX720,LEX727 in BoardConfig
Only applicable for AB or VAB devices

Change-Id: I1fbe6155d3f79eee089a31dbe62ee9d04c33d65c
This commit is contained in:
DarthJabba9
2022-01-23 23:35:25 +00:00
committed by bigbiff
parent 74ea1a7d66
commit 45a8d148b5
3 changed files with 27 additions and 0 deletions
+20
View File
@@ -132,6 +132,15 @@ static int check_newer_ab_build(ZipArchiveHandle zip)
bool deviceExists = false;
// twrp.target.devices
bool has_target_devices = false;
char tw_devices[PROPERTY_VALUE_MAX * 2];
property_get("ro.twrp.target.devices", tw_devices, "");
std::vector<std::string> TWRP_devices = android::base::Split(tw_devices, ",");
if (strlen(tw_devices) > 1) {
has_target_devices = true;
}
for(const std::string& deviceAssert : assertResults)
{
std::string assertName = android::base::Trim(deviceAssert);
@@ -139,6 +148,17 @@ static int check_newer_ab_build(ZipArchiveHandle zip)
deviceExists = true;
break;
}
// twrp.target.devices
else if (has_target_devices) {
for(const std::string& twrpDevice_x : TWRP_devices) {
std::string twrpName = android::base::Trim(twrpDevice_x);
if (!twrpName.empty() && !assertName.empty() && assertName == twrpName) {
deviceExists = true;
printf("Package is for product %s. The selected TWRP target device is %s\n", pkg_device.c_str(), twrpName.c_str());
break;
}
}
}
}
if (!deviceExists) {