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

Commit a8e6d831 authored by Matt Mower's avatar Matt Mower Committed by Dees Troy
Browse files

Do not unconditionally remove MTP storage on unmount

* It is not necessary to Remove_MTP_Storage() for a partition if an
  MTP_Storage_ID has not been assigned.
* The hack to force-set tw_mtp_enabled=1 should no longer be necessary
  now that we're checking whether MTP really needs to be disabled for
  a volume before running Disable_MTP().

Change-Id: I1b7233eedd9da7c6be0c67fc60243f3837105173
parent 84830ce0
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1318,7 +1318,7 @@ bool TWPartition::UnMount(bool Display_Error) {
		if (never_unmount_system == 1 && Mount_Point == "/system")
		if (never_unmount_system == 1 && Mount_Point == "/system")
			return true; // Never unmount system if you're not supposed to unmount it
			return true; // Never unmount system if you're not supposed to unmount it


		if (Is_Storage)
		if (Is_Storage && MTP_Storage_ID > 0)
			PartitionManager.Remove_MTP_Storage(MTP_Storage_ID);
			PartitionManager.Remove_MTP_Storage(MTP_Storage_ID);


		if (!Symlink_Mount_Point.empty())
		if (!Symlink_Mount_Point.empty())
+0 −7
Original line number Original line Diff line number Diff line
@@ -289,13 +289,6 @@ int main(int argc, char **argv) {
	}
	}


	// Read the settings file
	// Read the settings file
#ifdef TW_HAS_MTP
	// We unmount partitions sometimes during early boot which may override
	// the default of MTP being enabled by auto toggling MTP off. This
	// will force it back to enabled then get overridden by the settings
	// file, assuming that an entry for tw_mtp_enabled is set.
	DataManager::SetValue("tw_mtp_enabled", 1);
#endif
	DataManager::ReadSettingsFile();
	DataManager::ReadSettingsFile();
	PageManager::LoadLanguage(DataManager::GetStrValue("tw_language"));
	PageManager::LoadLanguage(DataManager::GetStrValue("tw_language"));
	GUIConsole::Translate_Now();
	GUIConsole::Translate_Now();