summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Narayan Kamath <narayan@google.com> 2015-05-28 11:23:57 +0100
committer Narayan Kamath <narayan@google.com> 2015-05-29 14:48:07 +0100
commit623b58b2cfcb778f52d2393bc4093ee721c3f16c (patch)
tree49082e221b6dfaf0820cae6b0ed2085da58d6c3a
parent34cca12bbda96ea8aad86b0455eb61e4674a4616 (diff)
Avoid inspecting packages twice to deduce ABIs for moves / installs.
In the case of moves, we can use the existing ABIs from settings because a move will not result in an ABI change. For new installs, we can just use the ABI we deduced for compiling (dex2oat) the package. bug: 21144503 Change-Id: I35e2e8abd47f547b6252271fc6b41d30719c4298
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 35317965618d..f9bfe721b5af 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -303,6 +303,7 @@ public class PackageManagerService extends IPackageManager.Stub {
static final int SCAN_TRUSTED_OVERLAY = 1<<9;
static final int SCAN_DELETE_DATA_ON_FAILURES = 1<<10;
static final int SCAN_REQUIRE_KNOWN = 1<<12;
+ static final int SCAN_MOVE = 1<<13;
static final int REMOVE_CHATTY = 1<<16;
@@ -6347,16 +6348,19 @@ public class PackageManagerService extends IPackageManager.Stub {
if ((scanFlags & SCAN_NEW_INSTALL) == 0) {
deriveNonSystemPackageAbi(pkg, scanFile, cpuAbiOverride, true /* extract libs */);
} else {
- // TODO: We need this second call to derive in two cases :
- //
- // - To update the native library paths based on the final install location.
- // - We don't call dexopt when moving packages, and so we have to scan again.
- //
- // We can simplify this and avoid having to scan the package again by letting
- // scanPackageLI know if the current install was a move (and deriving things only
- // in that case) and by "reparenting" the native lib directory in the case of
- // a normal (non-move) install.
- deriveNonSystemPackageAbi(pkg, scanFile, cpuAbiOverride, false /* extract libs */);
+ if ((scanFlags & SCAN_MOVE) != 0) {
+ // We haven't run dex-opt for this move (since we've moved the compiled output too)
+ // but we already have this packages package info in the PackageSetting. We just
+ // use that and derive the native library path based on the new codepath.
+ pkg.applicationInfo.primaryCpuAbi = pkgSetting.primaryCpuAbiString;
+ pkg.applicationInfo.secondaryCpuAbi = pkgSetting.secondaryCpuAbiString;
+ }
+
+ // Set native library paths again. For moves, the path will be updated based on the
+ // ABIs we've determined above. For non-moves, the path will be updated based on the
+ // ABIs we determined during compilation, but the path will depend on the final
+ // package path (after the rename away from the stage path).
+ setNativeLibraryPaths(pkg);
}
if (DEBUG_INSTALL) Slog.i(TAG, "Linking native library dir for " + path);
@@ -11645,6 +11649,7 @@ public class PackageManagerService extends IPackageManager.Stub {
if (args.move != null) {
// We did an in-place move, so dex is ready to roll
scanFlags |= SCAN_NO_DEX;
+ scanFlags |= SCAN_MOVE;
} else if (!forwardLocked && !pkg.applicationInfo.isExternalAsec()) {
// Enable SCAN_NO_DEX flag to skip dexopt at a later stage
scanFlags |= SCAN_NO_DEX;