diff --git a/data.cpp b/data.cpp index d1077950..b5b7c9ea 100755 --- a/data.cpp +++ b/data.cpp @@ -273,44 +273,6 @@ int DataManager::LoadValues(const string& filename) return 0; } -int DataManager::LoadPersistValues(void) -{ - static bool loaded = false; - string dev_id; - - // Only run this function once, and make sure normal settings file has not yet been read - if (loaded || !mBackingFile.empty() || !TWFunc::Path_Exists(PERSIST_SETTINGS_FILE)) - return -1; - - LOGINFO("Attempt to load settings from /persist settings file...\n"); - - if (!mInitialized) - SetDefaultValues(); - - GetValue("device_id", dev_id); - mPersist.SetFile(PERSIST_SETTINGS_FILE); - mPersist.SetFileVersion(FILE_VERSION); - - // Read in the file, if possible - pthread_mutex_lock(&m_valuesLock); - mPersist.LoadValues(); - -#ifndef TW_NO_SCREEN_TIMEOUT - blankTimer.setTime(mPersist.GetIntValue("tw_screen_timeout_secs")); -#endif - - update_tz_environment_variables(); - TWFunc::Set_Brightness(GetStrValue("tw_brightness")); - - pthread_mutex_unlock(&m_valuesLock); - - /* Don't set storage nor backup paths this early */ - - loaded = true; - - return 0; -} - int DataManager::Flush() { return SaveValues(); @@ -319,15 +281,6 @@ int DataManager::Flush() int DataManager::SaveValues() { #ifndef TW_OEM_BUILD - if (PartitionManager.Mount_By_Path("/persist", false)) { - mPersist.SetFile(PERSIST_SETTINGS_FILE); - mPersist.SetFileVersion(FILE_VERSION); - pthread_mutex_lock(&m_valuesLock); - mPersist.SaveValues(); - pthread_mutex_unlock(&m_valuesLock); - LOGINFO("Saved settings file values to %s\n", PERSIST_SETTINGS_FILE); - } - if (mBackingFile.empty()) return -1; diff --git a/data.hpp b/data.hpp index 4770ed58..bb73c415 100755 --- a/data.hpp +++ b/data.hpp @@ -23,8 +23,6 @@ #include #include "infomanager.hpp" -#define PERSIST_SETTINGS_FILE "/persist/.twrps" - using namespace std; class DataManager diff --git a/partition.cpp b/partition.cpp index 98ef3ec5..e76e9553 100755 --- a/partition.cpp +++ b/partition.cpp @@ -609,8 +609,6 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error, if (Mount_Point == "/persist" && Can_Be_Mounted) { bool mounted = Is_Mounted(); if (mounted || Mount(false)) { - // Read the backup settings file - DataManager::LoadPersistValues(); TWFunc::Fixup_Time_On_Boot("/persist/time/"); if (!mounted) UnMount(false); diff --git a/twrp-functions.cpp b/twrp-functions.cpp index ba0d8a55..9f13fe26 100755 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -770,7 +770,7 @@ int TWFunc::copy_file(string src, string dst, int mode) { PartitionManager.Mount_By_Path(src, false); PartitionManager.Mount_By_Path(dst, false); if (!Path_Exists(src)) { - LOGINFO("Unable to find source file %s\n", src.c_str()); + LOGINFO("Path %s does not exist. Unable to copy %s\n", src.c_str(), dst.c_str()); return -1; } std::ifstream srcfile(src.c_str(), ios::binary); @@ -1259,11 +1259,8 @@ int TWFunc::stream_adb_backup(string &Restore_Name) { std::string TWFunc::get_log_dir() { if (PartitionManager.Find_Partition_By_Path(CACHE_LOGS_DIR) == NULL) { if (PartitionManager.Find_Partition_By_Path(DATA_LOGS_DIR) == NULL) { - if (PartitionManager.Find_Partition_By_Path(PERSIST_LOGS_DIR) == NULL) { - LOGINFO("Unable to find a directory to store TWRP logs."); - return ""; - } - return PERSIST_LOGS_DIR; + LOGINFO("Unable to find a directory to store TWRP logs."); + return ""; } else { return DATA_LOGS_DIR; } diff --git a/twrp-functions.hpp b/twrp-functions.hpp index b793d3fd..80cb80e5 100755 --- a/twrp-functions.hpp +++ b/twrp-functions.hpp @@ -32,7 +32,6 @@ using namespace std; #define CACHE_LOGS_DIR "/cache/" // For devices with a dedicated cache partition #define DATA_LOGS_DIR "/data/" // For devices that do not have a dedicated cache partition -#define PERSIST_LOGS_DIR "/persist/" // For devices with neither cache or dedicated data partition typedef enum { diff --git a/twrp.cpp b/twrp.cpp index a6b0faaa..f861fec4 100755 --- a/twrp.cpp +++ b/twrp.cpp @@ -352,9 +352,6 @@ int main(int argc, char **argv) { if (crash_counter == 0) TWFunc::Fixup_Time_On_Boot(); - // Read the settings file - TWFunc::Update_Log_File(); - if (!PartitionManager.Get_Super_Status()) DataManager::ReadSettingsFile(); PageManager::LoadLanguage(DataManager::GetStrValue("tw_language")); @@ -445,6 +442,8 @@ int main(int argc, char **argv) { } #endif + TWFunc::Update_Log_File(); + twrpAdbBuFifo *adb_bu_fifo = new twrpAdbBuFifo(); adb_bu_fifo->threadAdbBuFifo();