add mtp responder to TWRP.
Big thanks to Dees_Troy for helping with the implementation.
Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 885d352..1798c49 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1260,4 +1260,22 @@
return -1;
}
+bool TWFunc::Toggle_MTP(bool enable) {
+#ifdef TW_HAS_MTP
+ static int was_enabled = false;
+
+ if (enable && was_enabled) {
+ if (!PartitionManager.Enable_MTP())
+ PartitionManager.Disable_MTP();
+ } else {
+ was_enabled = DataManager::GetIntValue("tw_mtp_enabled");
+ PartitionManager.Disable_MTP();
+ usleep(500);
+ }
+ return was_enabled;
+#else
+ return false;
+#endif
+}
+
#endif // ndef BUILD_TWRPTAR_MAIN