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/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 05bac0c..5e7091b 100755
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -62,10 +62,16 @@
#define SCRIPT_COMMAND_SIZE 512
int OpenRecoveryScript::check_for_script_file(void) {
- std::string orsFile = TWFunc::get_cache_dir() + "/recovery/openrecoveryscript";
+ std::string logDir = TWFunc::get_log_dir();
+ std::string orsFile;
+ if (logDir == DATA_LOGS_DIR)
+ orsFile = "/data/cache";
+ else
+ orsFile = logDir;
+ orsFile += "/recovery/openrecoveryscript";
if (!PartitionManager.Mount_By_Path(orsFile, false)) {
- LOGINFO("Unable to mount %s for OpenRecoveryScript support.\n", TWFunc::get_cache_dir().c_str());
- gui_msg(Msg(msg::kError, "unable_to_mount=Unable to mount {1}")(TWFunc::get_cache_dir()));
+ LOGINFO("Unable to mount %s for OpenRecoveryScript support.\n", logDir.c_str());
+ gui_msg(Msg(msg::kError, "unable_to_mount=Unable to mount {1}")(logDir.c_str()));
return 0;
}
if (TWFunc::Path_Exists(orsFile)) {
@@ -669,7 +675,7 @@
gui_msg("decrypt_cmd=Attempting to decrypt data partition via command line.");
if (PartitionManager.Decrypt_Device(pass) == 0) {
// set_page_done = 1; // done by singleaction_page anyway
- std::string orsFile = TWFunc::get_cache_dir() + "/openrecoveryscript";
+ std::string orsFile = TWFunc::get_log_dir() + "/openrecoveryscript";
if (TWFunc::Path_Exists(orsFile)) {
Run_OpenRecoveryScript_Action();
}