add mtp responder to TWRP.
Big thanks to Dees_Troy for helping with the implementation.

Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
diff --git a/gui/Android.mk b/gui/Android.mk
index b172b2b..3e499ab 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -62,7 +62,7 @@
 ifeq ($(HAVE_SELINUX), true)
 LOCAL_CFLAGS += -DHAVE_SELINUX
 endif
-ifeq ($(TW_OEM_BUILD),true)
+ifeq ($(TW_OEM_BUILD), true)
     LOCAL_CFLAGS += -DTW_OEM_BUILD
 endif
 
diff --git a/gui/action.cpp b/gui/action.cpp
index c471533..7e43222 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -1305,7 +1305,6 @@
 				} else {
 					ret = 1; // failure
 				}
-				PartitionManager.Update_System_Details();
 				if (DataManager::GetIntValue(TW_HAS_INJECTTWRP) == 1 && DataManager::GetIntValue(TW_INJECT_AFTER_ZIP) == 1) {
 					operation_start("ReinjectTWRP");
 					gui_print("Injecting TWRP into boot image...\n");
@@ -1469,6 +1468,32 @@
 			operation_end(op_status, simulate);
 			return 0;
 		}
+		if (function == "startmtp")
+		{
+			int op_status = 0;
+
+			operation_start("Start MTP");
+			if (PartitionManager.Enable_MTP())
+				op_status = 0; // success
+			else
+				op_status = 1; // fail
+
+			operation_end(op_status, simulate);
+			return 0;
+		}
+		if (function == "stopmtp")
+		{
+			int op_status = 0;
+
+			operation_start("Stop MTP");
+			if (PartitionManager.Disable_MTP())
+				op_status = 0; // success
+			else
+				op_status = 1; // fail
+
+			operation_end(op_status, simulate);
+			return 0;
+		}
 	}
 	else
 	{
diff --git a/gui/devices/landscape/res/landscape.xml b/gui/devices/landscape/res/landscape.xml
index 2bed2a5..aea32f1 100644
--- a/gui/devices/landscape/res/landscape.xml
+++ b/gui/devices/landscape/res/landscape.xml
@@ -903,6 +903,45 @@
 
 			<object type="button">
 				<highlight color="%highlight_color%" />
+				<conditions>
+					<condition var1="tw_has_mtp" var2="1" />
+					<condition var1="tw_mtp_enabled" var2="0" />
+				</conditions>
+				<placement x="%col3_x%" y="row1_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Enable MTP</text>
+				<image resource="main_button" />
+				<action function="startmtp"></action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
+				<conditions>
+					<condition var1="tw_has_mtp" var2="1" />
+					<condition var1="tw_mtp_enabled" var2="1" />
+				</conditions>
+				<placement x="%col3_x%" y="row1_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Disable MTP</text>
+				<image resource="main_button" />
+				<action function="stopmtp"></action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
+				<conditions>
+					<condition var1="tw_is_encrypted" var2="1" />
+					<condition var1="tw_is_decrypted" var2="0" />
+				</conditions>
+				<placement x="%col3_x%" y="row1_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Decrypt Data</text>
+				<image resource="main_button" />
+				<action function="page">decrypt</action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
 				<fill color="%button_fill_color%" />
 				<placement x="%col3_x%" y="%backup_storage_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
 				<font resource="font" color="%button_text_color%" />
diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml
index 0be6855..e07a217 100644
--- a/gui/devices/portrait/res/portrait.xml
+++ b/gui/devices/portrait/res/portrait.xml
@@ -2146,6 +2146,32 @@
 			<object type="button">
 				<highlight color="%highlight_color%" />
 				<conditions>
+					<condition var1="tw_has_mtp" var2="1" />
+					<condition var1="tw_mtp_enabled" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row4_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Enable MTP</text>
+				<image resource="main_button" />
+				<action function="startmtp"></action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
+				<conditions>
+					<condition var1="tw_has_mtp" var2="1" />
+					<condition var1="tw_mtp_enabled" var2="1" />
+				</conditions>
+				<placement x="%col2_x%" y="row4_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Disable MTP</text>
+				<image resource="main_button" />
+				<action function="stopmtp"></action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
+				<conditions>
 					<condition var1="tw_is_encrypted" var2="1" />
 					<condition var1="tw_is_decrypted" var2="0" />
 				</conditions>
@@ -2201,6 +2227,7 @@
 
 			<object type="action">
 				<action function="mount">usb</action>
+				<action function="set">tw_busy=1</action>
 			</object>
 
 			<object type="template" name="footer" />
@@ -2213,6 +2240,7 @@
 
 			<object type="action">
 				<action function="page">mount</action>
+				<action function="set">tw_busy=0</action>
 			</object>
 		</page>
 
diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml
index 686b24b..00f449e 100644
--- a/gui/devices/watch/res/watch.xml
+++ b/gui/devices/watch/res/watch.xml
@@ -2118,6 +2118,32 @@
 			<object type="button">
 				<highlight color="%highlight_color%" />
 				<conditions>
+					<condition var1="tw_has_mtp" var2="1" />
+					<condition var1="tw_mtp_enabled" var2="0" />
+				</conditions>
+				<placement x="%col2_x%" y="row4_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Enable MTP</text>
+				<image resource="main_button" />
+				<action function="startmtp"></action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
+				<conditions>
+					<condition var1="tw_has_mtp" var2="1" />
+					<condition var1="tw_mtp_enabled" var2="1" />
+				</conditions>
+				<placement x="%col2_x%" y="row4_y" />
+				<font resource="font" color="%button_text_color%" />
+				<text>Disable MTP</text>
+				<image resource="main_button" />
+				<action function="stopmtp"></action>
+			</object>
+
+			<object type="button">
+				<highlight color="%highlight_color%" />
+				<conditions>
 					<condition var1="tw_is_encrypted" var2="1" />
 					<condition var1="tw_is_decrypted" var2="0" />
 				</conditions>