log storage: change AB device log storage to /data/recovery
This patchset is now exlcuding /data/cache from backup, and removing it
from the wipe exclusion list to prevent errors on restore and wiping
/data.
This patchset changes the directory from /data/cache to /data/recovery for TWRP
to store logs and other file information. This will help with AB
devices that don't want recovery to mess with /data/cache.
This patchset will make ORS use /data/cache for AB devices.
Remove policy code because we don't need to set a policy for the
recovery directory.
Change-Id: I1d140276314fd34804a72297d6e25a52e58210a0
diff --git a/twrp.cpp b/twrp.cpp
index b84971c..a6b0faa 100755
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -361,7 +361,9 @@
GUIConsole::Translate_Now();
// Run any outstanding OpenRecoveryScript
- std::string cacheDir = TWFunc::get_cache_dir();
+ std::string cacheDir = TWFunc::get_log_dir();
+ if (cacheDir == DATA_LOGS_DIR)
+ cacheDir = "/data/cache";
std::string orsFile = cacheDir + "/recovery/openrecoveryscript";
if ((DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 || SkipDecryption) && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(orsFile))) {
OpenRecoveryScript::Run_OpenRecoveryScript();
@@ -411,6 +413,13 @@
#ifdef TW_INCLUDE_CRYPTO
PartitionManager.Decrypt_Data();
Decrypt_Page(SkipDecryption, datamedia);
+ std::string recoveryLogDir(DATA_LOGS_DIR);
+ recoveryLogDir += "/recovery";
+ if (!TWFunc::Path_Exists(recoveryLogDir)) {
+ bool created = PartitionManager.Recreate_Logs_Dir();
+ if (!created)
+ LOGERR("Unable to create log directory for TWRP\n");
+ }
DataManager::ReadSettingsFile();
#endif
} else {
@@ -450,8 +459,7 @@
// Reboot
TWFunc::Update_Intent_File(Send_Intent);
delete adb_bu_fifo;
- if (!TWFunc::Is_Mount_Wiped("/data"))
- TWFunc::Update_Log_File();
+ TWFunc::Update_Log_File();
gui_msg(Msg("rebooting=Rebooting..."));
string Reboot_Arg;
DataManager::GetValue("tw_reboot_arg", Reboot_Arg);