Partition_Property_Get: Get props from additional partitions
Use the TW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS flag to
specify a space-separated list of additional partitions
that should be parsed when trying to locate props
for overriding.
Example:
TW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS := vendor odm
Requires TW_OVERRIDE_SYSTEM_PROPS to be defined.
Change-Id: I7baf4c15628789fe525976d9de0251bba6882395
(cherry picked from commit aafc82e8e263a9e323d789da1193c0de4c77347c)
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index f30206b..73399b3 100755
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -881,16 +881,21 @@
}
string TWFunc::System_Property_Get(string Prop_Name) {
- return System_Property_Get(Prop_Name, PartitionManager, PartitionManager.Get_Android_Root_Path(), "build.prop");
+ return Partition_Property_Get(Prop_Name, PartitionManager, PartitionManager.Get_Android_Root_Path(), "build.prop");
}
-string TWFunc::System_Property_Get(string Prop_Name, TWPartitionManager &PartitionManager, string Mount_Point, string prop_file_name) {
+string TWFunc::Partition_Property_Get(string Prop_Name, TWPartitionManager &PartitionManager, string Mount_Point, string prop_file_name) {
bool mount_state = PartitionManager.Is_Mounted_By_Path(Mount_Point);
std::vector<string> buildprop;
string propvalue;
+ string prop_file;
if (!PartitionManager.Mount_By_Path(Mount_Point, true))
return propvalue;
- string prop_file = Mount_Point + "/system/" + prop_file_name;
+ if (Mount_Point == PartitionManager.Get_Android_Root_Path()) {
+ prop_file = Mount_Point + "/system/" + prop_file_name;
+ } else {
+ prop_file = Mount_Point + "/" + prop_file_name;
+ }
if (!TWFunc::Path_Exists(prop_file)) {
LOGINFO("Unable to locate file: %s\n", prop_file.c_str());
return propvalue;