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: Ib06bf7c1e04259bff1e20db70f843371902e62fc
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index ad14bc2..5712538 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)) {
@@ -697,7 +703,10 @@
gui_msg("decrypt_cmd=Attempting to decrypt data partition or user data via command line.");
if (PartitionManager.Decrypt_Device(pass, atoi(userid.c_str())) == 0) {
// set_page_done = 1; // done by singleaction_page anyway
- std::string orsFile = TWFunc::get_cache_dir() + "/openrecoveryscript";
+ std::string logDir = TWFunc::get_log_dir();
+ if (logDir == DATA_LOGS_DIR)
+ logDir = "/data/cache";
+ std::string orsFile = logDir + "/openrecoveryscript";
if (TWFunc::Path_Exists(orsFile)) {
Run_OpenRecoveryScript_Action();
}