diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2014-09-04 04:42:49 +0200 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2014-09-04 04:42:49 +0200 |
commit | 6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12 (patch) | |
tree | 20c82dfac082916555161ad5bc5e304ec8f3ca94 | |
parent | Allow MTP debug setting to stick through a reboot (diff) | |
download | android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.tar android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.tar.gz android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.tar.bz2 android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.tar.lz android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.tar.xz android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.tar.zst android_bootable_recovery-6f49e11d8adb08a8b420d679b3ab0cbfda6ffb12.zip |
Diffstat (limited to '')
-rwxr-xr-x | mtp/MtpStorage.cpp | 2 | ||||
-rw-r--r-- | twrp.cpp | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/mtp/MtpStorage.cpp b/mtp/MtpStorage.cpp index c726bc651..8a0a4514f 100755 --- a/mtp/MtpStorage.cpp +++ b/mtp/MtpStorage.cpp @@ -652,7 +652,7 @@ int MtpStorage::renameObject(MtpObjectHandle handle, std::string newName) { } } } - // handle not foudn on this storage + // handle not found on this storage return -1; } @@ -288,22 +288,32 @@ int main(int argc, char **argv) { OpenRecoveryScript::Run_OpenRecoveryScript(); } +#ifdef TW_HAS_MTP // Enable MTP? - if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) { - if (DataManager::GetIntValue(TW_IS_DECRYPTED) != 0 && DataManager::GetIntValue("tw_mtp_enabled") == 1) { + char mtp_crash_check[PROPERTY_VALUE_MAX]; + property_get("mtp.crash_check", mtp_crash_check, "0"); + if (strcmp(mtp_crash_check, "0") == 0) { + property_set("mtp.crash_check", "1"); + 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"); } - } 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"); + property_set("mtp.crash_check", "0"); + } else { + gui_print_color("warning", "MTP Crashed, not starting MTP on boot.\n"); } +#endif // Launch the main GUI gui_start(); |