diff options
author | 2022-12-23 18:18:27 +0000 | |
---|---|---|
committer | 2023-02-13 15:17:18 +0000 | |
commit | 3041b6dc0121cf96f1ca6d4224dd5fbfcd82c990 (patch) | |
tree | 3ccda81cd886f1c40dbffe0a0ed18fc22bd8002e /artd/file_utils.cc | |
parent | 6b76916a01a8375532a7c003fbc70d90e79b85db (diff) |
Implement ART Serivces GC that cleans up obsolete files.
Bug: 254013425
Test: m test-art-host-gtest-art_artd_tests
Test: atest ArtServiceTests
Test: -
1. adb shell pm art cleanup
2. See files being cleaned up.
3. adb shell pm art cleanup
4. See nothing being cleaned up.
5. adb shell pm art optimize-packages bg-dexopt
6. adb shell pm art cleanup
7. See nothing being cleaned up.
Ignore-AOSP-First: ART Services.
Change-Id: If6a495b58657e007a49863c055d0fbafb4417ce1
Diffstat (limited to 'artd/file_utils.cc')
-rw-r--r-- | artd/file_utils.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/artd/file_utils.cc b/artd/file_utils.cc index 53fe9f9625..0ce782a7e9 100644 --- a/artd/file_utils.cc +++ b/artd/file_utils.cc @@ -81,6 +81,9 @@ Result<void> NewFile::CommitOrAbandon() { std::error_code ec; std::filesystem::rename(temp_path_, final_path_, ec); if (ec) { + // If this fails because the temp file doesn't exist, it could be that the file is deleted by + // `Artd::cleanup` if that method is run simultaneously. At the time of writing, this should + // never happen because `Artd::cleanup` is only called at the end of the backgrond dexopt job. return Errorf( "Failed to move new file '{}' to path '{}': {}", temp_path_, final_path_, ec.message()); } |