From 0fc157373073708a2eb1106001d4dc31b64dab6b Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Fri, 4 Jul 2014 01:09:50 +0200 Subject: Change ro.twrp.boot boolean to twrp.crash_counter Change-Id: If1ef25fee5a138a90ccb4f0a70b20b55698e0d0d Signed-off-by: Vojtech Bocek --- twrp.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'twrp.cpp') diff --git a/twrp.cpp b/twrp.cpp index dda84ddae..b67631ea8 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -78,6 +78,13 @@ int main(int argc, char **argv) { return 0; } + char crash_prop_val[PROPERTY_VALUE_MAX]; + int crash_counter; + property_get("twrp.crash_counter", crash_prop_val, "-1"); + crash_counter = atoi(crash_prop_val) + 1; + snprintf(crash_prop_val, sizeof(crash_prop_val), "%d", crash_counter); + property_set("twrp.crash_counter", crash_prop_val); + time_t StartupTime = time(NULL); printf("Starting TWRP %s on %s", TW_VERSION_STR, ctime(&StartupTime)); @@ -204,14 +211,14 @@ int main(int argc, char **argv) { } } } + printf("\n"); } - char twrp_booted[PROPERTY_VALUE_MAX]; - property_get("ro.twrp.boot", twrp_booted, "0"); - if (strcmp(twrp_booted, "0") == 0) { + if(crash_counter == 0) { property_list(Print_Prop, NULL); printf("\n"); - property_set("ro.twrp.boot", "1"); + } else { + printf("twrp.crash_counter=%d\n", crash_counter); } // Check for and run startup script if script exists -- cgit v1.2.3