diff options
| author | 2022-10-26 19:50:36 +0000 | |
|---|---|---|
| committer | 2022-10-28 17:43:53 +0000 | |
| commit | df278920db2cafa923b3837d44184a54e5cef5e0 (patch) | |
| tree | 4c551bb14226b99467a5f772cc7704885efd7e38 /services/coverage/java | |
| parent | 70ec9d521e856d3a7b216aeec83e233f1e9a58c6 (diff) | |
LockSettingsStorage: make writeFile() use AtomicFile
Although writeFile() is usually used to create new files, there are some
edge cases in which it is used to overwrite files. For example, the
spblob file is overwritten when a protector is upgraded from v1 to v2.
Therefore, writeFile() needs to be atomic to guarantee that data
corruption cannot occur. Fix this by making it use AtomicFile.
This also has the advantage that it should perform better (despite some
overhead associated with AtomicFile) because it avoids an unnecessary
sync that is hidden in the constructor 'new RandomAccessFile(path,
"rws")'. It is only necessary to sync after the data is written.
Bug: 232452368
Bug: 251131631
Bug: 251147505
Test: atest com.android.server.locksettings
Change-Id: Iaf00c58b9a40e757b03d8b93c39af45c3bf3bbcc
Diffstat (limited to 'services/coverage/java')
0 files changed, 0 insertions, 0 deletions