Change handling of /cache due to AB devices not having cache
Change-Id: Ia9b97ed19eb3d400d9d399255108cac79361bca4
This commit is contained in:
+13
-13
@@ -1237,26 +1237,26 @@ int TWPartitionManager::Wipe_Dalvik_Cache(void) {
|
||||
if (!Mount_By_Path("/data", true))
|
||||
return false;
|
||||
|
||||
if (!Mount_By_Path("/cache", true))
|
||||
return false;
|
||||
|
||||
dir.push_back("/data/dalvik-cache");
|
||||
dir.push_back("/cache/dalvik-cache");
|
||||
dir.push_back("/cache/dc");
|
||||
gui_msg("wiping_dalvik=Wiping Dalvik Cache Directories...");
|
||||
for (unsigned i = 0; i < dir.size(); ++i) {
|
||||
if (stat(dir.at(i).c_str(), &st) == 0) {
|
||||
TWFunc::removeDir(dir.at(i), false);
|
||||
gui_msg(Msg("cleaned=Cleaned: {1}...")(dir.at(i)));
|
||||
}
|
||||
if (Mount_By_Path("/cache", false)) {
|
||||
dir.push_back("/cache/dalvik-cache");
|
||||
dir.push_back("/cache/dc");
|
||||
}
|
||||
|
||||
TWPartition* sdext = Find_Partition_By_Path("/sd-ext");
|
||||
if (sdext && sdext->Is_Present && sdext->Mount(false))
|
||||
{
|
||||
if (stat("/sd-ext/dalvik-cache", &st) == 0)
|
||||
{
|
||||
TWFunc::removeDir("/sd-ext/dalvik-cache", false);
|
||||
gui_msg(Msg("cleaned=Cleaned: {1}...")("/sd-ext/dalvik-cache"));
|
||||
dir.push_back("/sd-ext/dalvik-cache");
|
||||
}
|
||||
}
|
||||
|
||||
gui_msg("wiping_dalvik=Wiping Dalvik Cache Directories...");
|
||||
for (unsigned i = 0; i < dir.size(); ++i) {
|
||||
if (stat(dir.at(i).c_str(), &st) == 0) {
|
||||
TWFunc::removeDir(dir.at(i), false);
|
||||
gui_msg(Msg("cleaned=Cleaned: {1}...")(dir.at(i)));
|
||||
}
|
||||
}
|
||||
gui_msg("dalvik_done=-- Dalvik Cache Directories Wipe Complete!");
|
||||
|
||||
+8
-2
@@ -498,8 +498,14 @@ void TWFunc::Update_Log_File(void) {
|
||||
chown("/cache/recovery/log", 1000, 1000);
|
||||
chmod("/cache/recovery/log", 0600);
|
||||
chmod("/cache/recovery/last_log", 0640);
|
||||
} else if (PartitionManager.Mount_By_Path("/data", false) && TWFunc::Path_Exists("/data/cache/recovery/.")) {
|
||||
Copy_Log(TMP_LOG_FILE, "/data/cache/recovery/log");
|
||||
copy_file("/data/cache/recovery/log", "/data/cache/recovery/last_log", 600);
|
||||
chown("/data/cache/recovery/log", 1000, 1000);
|
||||
chmod("/data/cache/recovery/log", 0600);
|
||||
chmod("/data/cache/recovery/last_log", 0640);
|
||||
} else {
|
||||
LOGINFO("Failed to mount /cache for TWFunc::Update_Log_File\n");
|
||||
LOGINFO("Failed to mount /cache or find /data/cache for TWFunc::Update_Log_File\n");
|
||||
}
|
||||
|
||||
// Reset bootloader message
|
||||
@@ -515,7 +521,7 @@ void TWFunc::Update_Log_File(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (PartitionManager.Mount_By_Path("/cache", true)) {
|
||||
if (PartitionManager.Mount_By_Path("/cache", false)) {
|
||||
if (unlink("/cache/recovery/command") && errno != ENOENT) {
|
||||
LOGINFO("Can't unlink %s\n", "/cache/recovery/command");
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char **argv) {
|
||||
{ // Check to ensure SELinux can be supported by the kernel
|
||||
char *contexts = NULL;
|
||||
|
||||
if (PartitionManager.Mount_By_Path("/cache", true) && TWFunc::Path_Exists("/cache/recovery")) {
|
||||
if (PartitionManager.Mount_By_Path("/cache", false) && TWFunc::Path_Exists("/cache/recovery")) {
|
||||
lgetfilecon("/cache/recovery", &contexts);
|
||||
if (!contexts) {
|
||||
lsetfilecon("/cache/recovery", "test");
|
||||
@@ -174,7 +174,7 @@ int main(int argc, char **argv) {
|
||||
gui_warn("no_selinux=No SELinux support (no libselinux).");
|
||||
#endif
|
||||
|
||||
PartitionManager.Mount_By_Path("/cache", true);
|
||||
PartitionManager.Mount_By_Path("/cache", false);
|
||||
|
||||
bool Shutdown = false, Sideload = false;
|
||||
string Send_Intent = "";
|
||||
|
||||
Reference in New Issue
Block a user