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 --- gui/Android.mk | 2 +- gui/action.cpp | 27 ++++++++++++++++++++++- gui/devices/landscape/res/landscape.xml | 39 +++++++++++++++++++++++++++++++++ gui/devices/portrait/res/portrait.xml | 28 +++++++++++++++++++++++ gui/devices/watch/res/watch.xml | 26 ++++++++++++++++++++++ 5 files changed, 120 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/Android.mk b/gui/Android.mk index b172b2b25..3e499abe3 100644 --- a/gui/Android.mk +++ b/gui/Android.mk @@ -62,7 +62,7 @@ endif 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 c471533ef..7e432226e 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -1305,7 +1305,6 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) } 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 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) 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 2bed2a578..aea32f1b7 100644 --- a/gui/devices/landscape/res/landscape.xml +++ b/gui/devices/landscape/res/landscape.xml @@ -901,6 +901,45 @@ usb_mount + + + + + + + + + Enable MTP + + + + + + + + + + + + + Disable MTP + + + + + + + + + + + + + Decrypt Data + + decrypt + + diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml index 0be685517..e07a217bf 100644 --- a/gui/devices/portrait/res/portrait.xml +++ b/gui/devices/portrait/res/portrait.xml @@ -2143,6 +2143,32 @@ usb_mount + + + + + + + + + Enable MTP + + + + + + + + + + + + + Disable MTP + + + + @@ -2201,6 +2227,7 @@ usb + tw_busy=1 @@ -2213,6 +2240,7 @@ mount + tw_busy=0 diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml index 686b24b3f..00f449ea8 100644 --- a/gui/devices/watch/res/watch.xml +++ b/gui/devices/watch/res/watch.xml @@ -2115,6 +2115,32 @@ usb_mount + + + + + + + + + Enable MTP + + + + + + + + + + + + + Disable MTP + + + + -- cgit v1.2.3