From d5fbcc1ba9f5ff81ca67e80b552ee02d285ef536 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Wed, 11 Apr 2018 14:38:09 -0700 Subject: Remove the old log files if cache space is insufficient for OTA We set the limit of the max stash size to 80% of cache size. But the cache space can still be insufficient for the update if the log files occupy a large chunk of /cache. So remove the old logs for now to make room for the update. Bug: 77528881 Test: unit tests pass Change-Id: Ia8bcb0ace11f8164ad9290bfb360e08e31d282cb --- otautil/cache_location.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'otautil/cache_location.cpp') diff --git a/otautil/cache_location.cpp b/otautil/cache_location.cpp index 8ddefec5e..6139bf17b 100644 --- a/otautil/cache_location.cpp +++ b/otautil/cache_location.cpp @@ -19,6 +19,7 @@ constexpr const char kDefaultCacheTempSource[] = "/cache/saved.file"; constexpr const char kDefaultLastCommandFile[] = "/cache/recovery/last_command"; constexpr const char kDefaultStashDirectoryBase[] = "/cache/recovery"; +constexpr const char kDefaultCacheLogDirectory[] = "/cache/recovery"; CacheLocation& CacheLocation::location() { static CacheLocation cache_location; @@ -28,4 +29,5 @@ CacheLocation& CacheLocation::location() { CacheLocation::CacheLocation() : cache_temp_source_(kDefaultCacheTempSource), last_command_file_(kDefaultLastCommandFile), - stash_directory_base_(kDefaultStashDirectoryBase) {} + stash_directory_base_(kDefaultStashDirectoryBase), + cache_log_directory_(kDefaultCacheLogDirectory) {} -- cgit v1.2.3