From c05c598b734337e6a381de4edcb5937e12a69671 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 13 Mar 2014 09:19:56 -0500 Subject: Improve handling of settings storage and android secure Change-Id: I8af92543c2f0c201e7220267c417d74e4561038d --- partitionmanager.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'partitionmanager.cpp') diff --git a/partitionmanager.cpp b/partitionmanager.cpp index db054d28d..73e22852d 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -78,14 +78,11 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error) if (partition->Process_Fstab_Line(line, Display_Error)) { if (!Found_Settings_Storage && partition->Is_Settings_Storage) { Found_Settings_Storage = true; - Partitions.push_back(partition); - DataManager::SetValue("tw_settings_path", partition->Storage_Path); - DataManager::SetValue("tw_storage_path", partition->Storage_Path); - LOGINFO("Settings storage is '%s'\n", partition->Storage_Path.c_str()); + Setup_Settings_Storage_Partition(partition); } else { partition->Is_Settings_Storage = false; - Partitions.push_back(partition); } + Partitions.push_back(partition); } else { delete partition; } @@ -95,14 +92,7 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error) std::vector::iterator iter; for (iter = Partitions.begin(); iter != Partitions.end(); iter++) { if ((*iter)->Is_Storage) { - (*iter)->Is_Settings_Storage = true; -#ifndef RECOVERY_SDCARD_ON_DATA - (*iter)->Setup_AndSec(); -#endif - Found_Settings_Storage = true; - DataManager::SetValue("tw_settings_path", (*iter)->Storage_Path); - DataManager::SetValue("tw_storage_path", (*iter)->Storage_Path); - LOGINFO("Settings storage is '%s'\n", (*iter)->Storage_Path.c_str()); + Setup_Settings_Storage_Partition((*iter)); break; } } @@ -148,6 +138,15 @@ int TWPartitionManager::Write_Fstab(void) { return true; } +void TWPartitionManager::Setup_Settings_Storage_Partition(TWPartition* Part) { +#ifndef RECOVERY_SDCARD_ON_DATA + Part->Setup_AndSec(); +#endif + DataManager::SetValue("tw_settings_path", Part->Storage_Path); + DataManager::SetValue("tw_storage_path", Part->Storage_Path); + LOGINFO("Settings storage is '%s'\n", Part->Storage_Path.c_str()); +} + void TWPartitionManager::Output_Partition_Logging(void) { std::vector::iterator iter; -- cgit v1.2.3