add mtp responder to TWRP.
Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
This commit is contained in:
@@ -82,6 +82,8 @@ int main(int argc, char **argv) {
|
||||
crash_counter = atoi(crash_prop_val) + 1;
|
||||
snprintf(crash_prop_val, sizeof(crash_prop_val), "%d", crash_counter);
|
||||
property_set("twrp.crash_counter", crash_prop_val);
|
||||
property_set("ro.twrp.boot", "1");
|
||||
property_set("ro.twrp.version", TW_VERSION_STR);
|
||||
|
||||
time_t StartupTime = time(NULL);
|
||||
printf("Starting TWRP %s on %s", TW_VERSION_STR, ctime(&StartupTime));
|
||||
@@ -279,6 +281,23 @@ int main(int argc, char **argv) {
|
||||
OpenRecoveryScript::Run_OpenRecoveryScript();
|
||||
}
|
||||
|
||||
// Enable MTP?
|
||||
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");
|
||||
}
|
||||
|
||||
// Launch the main GUI
|
||||
gui_start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user