diff options
author | bigbiff bigbiff <bigbiff@teamw.in> | 2014-09-03 00:59:01 +0200 |
---|---|---|
committer | bigbiff bigbiff <bigbiff@teamw.in> | 2014-09-03 03:44:49 +0200 |
commit | c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30 (patch) | |
tree | a994f2110aeeb58ef2bc1f23c31f695cd840ac46 /twrp-functions.cpp | |
parent | Fix derp (diff) | |
download | android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.tar android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.tar.gz android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.tar.bz2 android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.tar.lz android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.tar.xz android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.tar.zst android_bootable_recovery-c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30.zip |
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r-- | twrp-functions.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 885d352db..1798c49b7 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -1260,4 +1260,22 @@ int TWFunc::Set_Brightness(std::string brightness_value) 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 |