From 01f4e035aa0833252b99dcbda0e08a327ba8bf3d Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Fri, 3 Feb 2017 15:30:52 -0600 Subject: Improve backup display names with emulated storage -Change backup display name to say that we are excluding storage -Add warning message during backup of any partition with data media -Also eliminate unused variable from twrpTar class Maybe this will make the people in issue 276 happy, but probably not because they already lost their data, or because the warning text is yellow instead of red. https://github.com/TeamWin/Team-Win-Recovery-Project/issues/276 Change-Id: I98303fe7f6b7a25fea029637c90145258d41ee46 --- partitionmanager.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'partitionmanager.cpp') diff --git a/partitionmanager.cpp b/partitionmanager.cpp index f94b6aa22..9afc67727 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -2383,8 +2383,8 @@ void TWPartitionManager::Translate_Partition(const char* path, const char* resou TWPartition* part = PartitionManager.Find_Partition_By_Path(path); if (part) { if (part->Is_Adopted_Storage) { + part->Backup_Display_Name = part->Display_Name + " - " + gui_lookup("data_backup", "Data (excl. storage)"); part->Display_Name = part->Display_Name + " - " + gui_lookup("data", "Data"); - part->Backup_Display_Name = part->Display_Name; part->Storage_Name = part->Storage_Name + " - " + gui_lookup("adopted_storage", "Adopted Storage"); } else { part->Display_Name = gui_lookup(resource_name, default_value); @@ -2395,6 +2395,22 @@ void TWPartitionManager::Translate_Partition(const char* path, const char* resou } } +void TWPartitionManager::Translate_Partition(const char* path, const char* resource_name, const char* default_value, const char* storage_resource_name, const char* storage_default_value, const char* backup_name, const char* backup_default) { + TWPartition* part = PartitionManager.Find_Partition_By_Path(path); + if (part) { + if (part->Is_Adopted_Storage) { + part->Backup_Display_Name = part->Display_Name + " - " + gui_lookup(backup_name, backup_default); + part->Display_Name = part->Display_Name + " - " + gui_lookup("data", "Data"); + part->Storage_Name = part->Storage_Name + " - " + gui_lookup("adopted_storage", "Adopted Storage"); + } else { + part->Display_Name = gui_lookup(resource_name, default_value); + part->Backup_Display_Name = gui_lookup(backup_name, backup_default); + if (part->Is_Storage) + part->Storage_Name = gui_lookup(storage_resource_name, storage_default_value); + } + } +} + void TWPartitionManager::Translate_Partition_Display_Names() { LOGINFO("Translating partition display names\n"); Translate_Partition("/system", "system", "System"); @@ -2402,17 +2418,19 @@ void TWPartitionManager::Translate_Partition_Display_Names() { Translate_Partition("/vendor", "vendor", "Vendor"); Translate_Partition("/vendor_image", "vendor_image", "Vendor Image"); Translate_Partition("/cache", "cache", "Cache"); - Translate_Partition("/data", "data", "Data", "internal", "Internal Storage"); Translate_Partition("/boot", "boot", "Boot"); Translate_Partition("/recovery", "recovery", "Recovery"); if (!datamedia) { + Translate_Partition("/data", "data", "Data", "internal", "Internal Storage"); Translate_Partition("/sdcard", "sdcard", "SDCard", "sdcard", "SDCard"); Translate_Partition("/internal_sd", "sdcard", "SDCard", "sdcard", "SDCard"); Translate_Partition("/internal_sdcard", "sdcard", "SDCard", "sdcard", "SDCard"); Translate_Partition("/emmc", "sdcard", "SDCard", "sdcard", "SDCard"); + } else { + Translate_Partition("/data", "data", "Data", "internal", "Internal Storage", "data_backup", "Data (excl. storage)"); } - Translate_Partition("/external_sd", "microsd", "Micro SDCard", "microsd", "Micro SDCard"); - Translate_Partition("/external_sdcard", "microsd", "Micro SDCard", "microsd", "Micro SDCard"); + Translate_Partition("/external_sd", "microsd", "Micro SDCard", "microsd", "Micro SDCard", "data_backup", "Data (excl. storage)"); + Translate_Partition("/external_sdcard", "microsd", "Micro SDCard", "microsd", "Micro SDCard", "data_backup", "Data (excl. storage)"); Translate_Partition("/usb-otg", "usbotg", "USB OTG", "usbotg", "USB OTG"); Translate_Partition("/sd-ext", "sdext", "SD-EXT"); -- cgit v1.2.3