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

Commit 6f49e11d authored by Ethan Yonker's avatar Ethan Yonker
Browse files

Prevent MTP enable on startup if crash detected

Change-Id: Ie1388a8acadf714a29721dd90c7f9a8aa38a860d
parent c8743cf5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
}

+18 −8
Original line number Diff line number Diff line
@@ -288,7 +288,12 @@ int main(int argc, char **argv) {
		OpenRecoveryScript::Run_OpenRecoveryScript();
	}

#ifdef TW_HAS_MTP
	// Enable MTP?
	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");
@@ -304,6 +309,11 @@ int main(int argc, char **argv) {
			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();