mtp: don't create storage device after format data
Since we don't re-create data/media on FBE devices, don't create an MTP storage device for it. This fixes the bug when, after formatting data on and FBE device, an empty Internal Storage appears on the PC. This also prevents an empty storage device from being created if recovery is rebooted after formatting data before booting to Android. A warning will appear in the console that MTP is disabled in that case. Currently the path is hardcoded to data/media; this should probably be adjusted for cases where adoptable storage is being used. Change-Id: Iaafc5e3cde54c3ef6ffaf33f76d14c626b6e590d
This commit is contained in:
committed by
bigbiff
parent
210ebe3d46
commit
63573b550f
@@ -2573,6 +2573,12 @@ TWPartition *TWPartitionManager::Get_Default_Storage_Partition()
|
||||
|
||||
bool TWPartitionManager::Enable_MTP(void) {
|
||||
#ifdef TW_HAS_MTP
|
||||
string mtp_base_path = "/data/media";
|
||||
if (!TWFunc::Path_Exists(mtp_base_path)) {
|
||||
gui_msg(Msg(msg::kWarning, "mtp_base_path_missing=Media storage not found. Unable to enable MTP."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mtppid) {
|
||||
gui_err("mtp_already_enabled=MTP already enabled");
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user