Set the update locations to default in CacheLocation's constructor

Otherwise the applypatch executable will fail to back up the source
file to /cache when patching the recovery image.

Bug: 74198354
Test: run applypatch from boot to recovery
Change-Id: I6e5b9cd06d6ed0b26066b779a348437ecf984b92
This commit is contained in:
Tianjie Xu
2018-03-08 12:34:19 -08:00
parent 56160b2b03
commit b4e3a370bf
3 changed files with 5 additions and 13 deletions

View File

@@ -25,8 +25,7 @@ CacheLocation& CacheLocation::location() {
return cache_location;
}
void CacheLocation::ResetLocations() {
cache_temp_source_ = kDefaultCacheTempSource;
last_command_file_ = kDefaultLastCommandFile;
stash_directory_base_ = kDefaultStashDirectoryBase;
}
CacheLocation::CacheLocation()
: cache_temp_source_(kDefaultCacheTempSource),
last_command_file_(kDefaultLastCommandFile),
stash_directory_base_(kDefaultStashDirectoryBase) {}

View File

@@ -27,9 +27,6 @@ class CacheLocation {
public:
static CacheLocation& location();
// Reset the locations to their default values.
void ResetLocations();
// getter and setter functions.
std::string cache_temp_source() const {
return cache_temp_source_;
@@ -53,7 +50,7 @@ class CacheLocation {
}
private:
CacheLocation() {}
CacheLocation();
DISALLOW_COPY_AND_ASSIGN(CacheLocation);
// When there isn't enough room on the target filesystem to hold the patched version of the file,

View File

@@ -169,10 +169,6 @@ int main(int argc, char** argv) {
}
ota_io_init(za, state.is_retry);
// Initialize the cache_temp_source, last_command_file and stash_directory_base to their default
// locations.
CacheLocation::location().ResetLocations();
std::string result;
bool status = Evaluate(&state, root, &result);