From c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Tue, 2 Sep 2014 18:59:01 -0400 Subject: add mtp responder to TWRP. Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0 --- twrp.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'twrp.cpp') diff --git a/twrp.cpp b/twrp.cpp index 8b60ee1db..5f58e41aa 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -82,6 +82,8 @@ int main(int argc, char **argv) { 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 @@ int main(int argc, char **argv) { 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(); -- cgit v1.2.3