Merge "persist logs: remove persist from available log directories in partitions." into android-10.0
diff --git a/data.cpp b/data.cpp
index d107795..b5b7c9e 100755
--- a/data.cpp
+++ b/data.cpp
@@ -273,44 +273,6 @@
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::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 4770ed5..bb73c41 100755
--- a/data.hpp
+++ b/data.hpp
@@ -23,8 +23,6 @@
#include <pthread.h>
#include "infomanager.hpp"
-#define PERSIST_SETTINGS_FILE "/persist/.twrps"
-
using namespace std;
class DataManager
diff --git a/partition.cpp b/partition.cpp
index 98ef3ec..e76e955 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -609,8 +609,6 @@
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 ba0d8a5..9f13fe2 100755
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -770,7 +770,7 @@
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 @@
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 b793d3f..80cb80e 100755
--- a/twrp-functions.hpp
+++ b/twrp-functions.hpp
@@ -32,7 +32,6 @@
#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 4a6a8b8..24cd9ad 100755
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -325,9 +325,6 @@
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"));
@@ -449,6 +446,8 @@
}
#endif
+ TWFunc::Update_Log_File();
+
twrpAdbBuFifo *adb_bu_fifo = new twrpAdbBuFifo();
adb_bu_fifo->threadAdbBuFifo();