Skip to content
Commit e11bcc6c authored by Howard Chen's avatar Howard Chen
Browse files

Replace copy-on-write PDB with an empty one

This is follow-up for aosp/1549486. It replaces the copy-on-write PDB
with an empty PDB created by the gsid because exposing the real PDB
in the DSU mode is unnecessary. The empty PDB will triggers formatting
during boot. To support this, we replace all OutputStream operations
with FileChannel operations backed by a RandomAccessFile to avoid
the backing file to be truncated during formatting. This also simplify
the current implementation which mixes OutputStream and FileChannel.
We appened a FileChannel.force() to FileChannel operations because the
PDB can be a raw block or a backing file on a file system. The force
method can make sure the file system cache is flushed.

Bug: 175852148
Test: vts-tradefed run vts -m vts_kernel_net_tests
Test: gts-tradefed run gts -m GtsOemLockServiceTestCases -t com.google.android.oemlock.gts.OemLockServiceTest
Test: cts-tradefed run cts -m CtsPermission2TestCases -t android.permission2.cts.PrivappPermissionsTest

Change-Id: I9aaa2193a3c7a93988590276cdbdf1a21f230cb3
parent 7a2f9c06
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