add mtp responder to TWRP.
Big thanks to Dees_Troy for helping with the implementation.
Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
diff --git a/twrp.cpp b/twrp.cpp
index 8b60ee1..5f58e41 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -82,6 +82,8 @@
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);
+ property_set("ro.twrp.boot", "1");
+ property_set("ro.twrp.version", TW_VERSION_STR);
time_t StartupTime = time(NULL);
printf("Starting TWRP %s on %s", TW_VERSION_STR, ctime(&StartupTime));
@@ -279,6 +281,23 @@
OpenRecoveryScript::Run_OpenRecoveryScript();
}
+ // Enable MTP?
+ if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {
+ if (DataManager::GetIntValue(TW_IS_DECRYPTED) != 0 && DataManager::GetIntValue("tw_mtp_enabled") == 1) {
+ LOGINFO("Enabling MTP during startup\n");
+ if (!PartitionManager.Enable_MTP())
+ PartitionManager.Disable_MTP();
+ else
+ gui_print("MTP Enabled\n");
+ }
+ } else if (DataManager::GetIntValue("tw_mtp_enabled") == 1) {
+ LOGINFO("Enabling MTP during startup\n");
+ if (!PartitionManager.Enable_MTP())
+ PartitionManager.Disable_MTP();
+ else
+ gui_print("MTP Enabled\n");
+ }
+
// Launch the main GUI
gui_start();