twrp.cpp: set ro.*.build.date.utc props globally on start of recovery
This prevents certain "timestamp errors" during OTA installation.
Change-Id: I2fced5493fbb228c83c97e132fb8b51a54b984dc
(cherry picked from commit 44e2346a60d34f12af1afcadfe0bb6dfbc79ee3a)
diff --git a/twrp.cpp b/twrp.cpp
index 8ed0a8a..615ef27 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -180,7 +180,14 @@
#endif
// We are doing this here to allow super partition to be set up prior to overriding properties
-#if defined(TW_INCLUDE_LIBRESETPROP) && defined(TW_OVERRIDE_SYSTEM_PROPS)
+#if defined(TW_INCLUDE_LIBRESETPROP)
+ std::vector<std::string> build_date_props = {"ro.build.date.utc", "ro.bootimage.build.date.utc", "ro.vendor.build.date.utc", "ro.system.build.date.utc", "ro.system_ext.build.date.utc", "ro.product.build.date.utc", "ro.odm.build.date.utc"};
+ std::string val = "0";
+ for (auto prop : build_date_props) {
+ TWFunc::Property_Override(prop, val);
+ LOGINFO("Overriding %s with value: \"%s\"\n", prop.c_str(), val.c_str());
+ }
+#if defined(TW_OVERRIDE_SYSTEM_PROPS)
stringstream override_props(EXPAND(TW_OVERRIDE_SYSTEM_PROPS));
string current_prop;
@@ -238,7 +245,8 @@
exit:
continue;
}
-#endif
+#endif // defined(TW_OVERRIDE_SYSTEM_PROPS)
+#endif // defined(TW_INCLUDE_LIBRESETPROP)
// Check for and run startup script if script exists
TWFunc::check_and_run_script("/system/bin/runatboot.sh", "boot");