Fix temporary directory path in Android.
We should use /data/misc/update_engine/tmp instead of /data/local/tmp.
Bug: 24478450
TEST=Delta update nolonger permission denied.
Change-Id: I9a8096e602320195d30147971def5145bd82d775
diff --git a/common/utils.cc b/common/utils.cc
index cfd8db0..0796459 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -56,6 +56,7 @@
#include "update_engine/common/clock_interface.h"
#include "update_engine/common/constants.h"
+#include "update_engine/common/platform_constants.h"
#include "update_engine/common/prefs_interface.h"
#include "update_engine/common/subprocess.h"
#include "update_engine/omaha_request_params.h"
@@ -141,7 +142,13 @@
}
base::FilePath temp_dir;
+#ifdef __ANDROID__
+ temp_dir = base::FilePath(constants::kNonVolatileDirectory).Append("tmp");
+ if (!base::PathExists(temp_dir))
+ TEST_AND_RETURN_FALSE(base::CreateDirectory(temp_dir));
+#else
TEST_AND_RETURN_FALSE(base::GetTempDir(&temp_dir));
+#endif // __ANDROID__
*template_path = temp_dir.Append(path);
return true;
}