Put PackageInstaller in the drivers seat.
openWrite() and openRead() are very flexible APIs, but their design
means they can't take advantage of the recent FileUtils.copy()
optimizations that leverage in-kernel copying.
So add new write() and read() methods where the untrusted caller
hands an FD into the OS, and then PackageInstaller drives the actual
copying process, allowing it to use FileUtils.copy() to speed
up the copying process. (Local benchmarks are showing a 24% speed
improvement.)
We still create a FileBridge to protect the session while an active
copy is happening.
Test: bit FrameworksCoreTests:android.os.FileUtilsTest
Test: vogar --mode app_process --benchmark frameworks/base/core/tests/benchmarks/src/android/os/FileUtilsBenchmark.java
Bug:
71932978,
25510838
Change-Id: Icc237b4c0f80d5d24b74a30f238b7fe505b856ce