Merge "persist logs: remove persist from available log directories in partitions." into android-10.0
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <pthread.h>
|
||||
#include "infomanager.hpp"
|
||||
|
||||
#define PERSIST_SETTINGS_FILE "/persist/.twrps"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class DataManager
|
||||
|
||||
@@ -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);
|
||||
|
||||
+3
-6
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -325,9 +325,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"));
|
||||
@@ -449,6 +446,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TWFunc::Update_Log_File();
|
||||
|
||||
twrpAdbBuFifo *adb_bu_fifo = new twrpAdbBuFifo();
|
||||
adb_bu_fifo->threadAdbBuFifo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user