Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit c5375f2f authored by JW Wang's avatar JW Wang
Browse files

Fix that the file is not correctly flushed to the disk

Fix a bug where rollback is corrupted when system_server crasshes
and reboots into RAMDUMP mode.

AtomicFile.finishWrite() calls FileUtils.sync() on the stream internally
which requires the stream is flushed but not yet closed.

pw.close() will close the stream which conflicts the use of
AtomicFile.finishWrite().

Let's remove the use of PrintWriter and flush the stream before calling
AtomicFile.finishWrite() so the file is correctly persisted to the disk.

Bug: 199124163
Test: atest RollbackManagerHostTest#testNativeWatchdogTriggersRollback
      and check no "AtomicFile: Failed to sync file output stream"
      appears in the log messages.
Test: atest CtsRootRollbackManagerHostTestCases \
            CtsRollbackManagerHostTestCases \
            CtsRollbackManagerTestCases

Change-Id: I6c93f20949f6103a7fe28fa2955155cd19df018a
parent 5ced92ca
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment