OSDN Git Service

Put PackageInstaller in the drivers seat.
authorJeff Sharkey <jsharkey@android.com>
Fri, 2 Feb 2018 18:27:21 +0000 (11:27 -0700)
committerJeff Sharkey <jsharkey@android.com>
Fri, 2 Feb 2018 18:32:56 +0000 (11:32 -0700)
commit0451de6254eadafe371df9ba38e2af0f6191c09d
tree24db7d72128f707f06e8c6519406638ea6ada713
parent45c97df89d6c9d8b5252ba9fc27c41e75c81254d
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: 7193297825510838
Change-Id: Icc237b4c0f80d5d24b74a30f238b7fe505b856ce
core/java/android/content/pm/IPackageInstallerSession.aidl
core/java/android/content/pm/PackageInstaller.java
services/core/java/com/android/server/pm/PackageInstallerSession.java
services/core/java/com/android/server/pm/PackageManagerShellCommand.java