Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5216bef5 authored by Ethan Yonker's avatar Ethan Yonker Committed by Dees Troy
Browse files

Toggle MTP during ADB sideload

Windows does not do very well if you try to sideload while MTP is
enabled due to drivers. This will toggle MTP off and back on if
MTP is currently enabled before and after a sideload operation.

Change-Id: I022dbedecc97565b50b6ae1fda8922b822f63440
parent e3e8829e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1268,6 +1268,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
				int wipe_dalvik = 0;

				gui_print("Starting ADB sideload feature...\n");
				bool mtp_was_enabled = TWFunc::Toggle_MTP(false);
				DataManager::GetValue("tw_wipe_dalvik", wipe_dalvik);
				ret = apply_from_adb("/");
				DataManager::SetValue("tw_has_cancel", 0); // Remove cancel button from gui now that the zip install is going to start
@@ -1289,6 +1290,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
					set_usb_driver(false);
					maybe_restart_adbd();
				}
				TWFunc::Toggle_MTP(mtp_was_enabled);
				if (strcmp(file_prop, "error") != 0) {
					struct stat st;
					stat("/sideload/exit", &st);