summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Todd Kennedy <toddke@google.com> 2017-05-17 15:16:04 -0700
committer Todd Kennedy <toddke@google.com> 2017-05-18 07:16:02 -0700
commit9ba6afa31eaf84d43e3bdd6449ded56e7856e811 (patch)
tree51fbd382e51f7f8f9c2b7d18cc288205a49db31a
parent9e6ef496bc2cdd01576a571eff86ebce100cba54 (diff)
don't dex when installing an instant app
Bug: 38259387 Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest Test: install an instant app, see that it doesn't dex Test: install a full app, see that it does dex Change-Id: Id7dc749954d0be24bbd80da2ef0f43e39f77993e
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 39639a2fd27a..52e24007c41a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -17445,17 +17445,24 @@ public class PackageManagerService extends IPackageManager.Stub
}
}
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
- // Do not run PackageDexOptimizer through the local performDexOpt
- // method because `pkg` may not be in `mPackages` yet.
- //
- // Also, don't fail application installs if the dexopt step fails.
- mPackageDexOptimizer.performDexOpt(pkg, pkg.usesLibraryFiles,
- null /* instructionSets */, false /* checkProfiles */,
- getCompilerFilterForReason(REASON_INSTALL),
- getOrCreateCompilerPackageStats(pkg),
- mDexManager.isUsedByOtherApps(pkg.packageName));
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ // dexopt can take some time to complete, so, for instant apps, we skip this
+ // step during installation. Instead, we'll take extra time the first time the
+ // instant app starts. It's preferred to do it this way to provide continuous
+ // progress to the user instead of mysteriously blocking somewhere in the
+ // middle of running an instant app.
+ if (!instantApp) {
+ Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
+ // Do not run PackageDexOptimizer through the local performDexOpt
+ // method because `pkg` may not be in `mPackages` yet.
+ //
+ // Also, don't fail application installs if the dexopt step fails.
+ mPackageDexOptimizer.performDexOpt(pkg, pkg.usesLibraryFiles,
+ null /* instructionSets */, false /* checkProfiles */,
+ getCompilerFilterForReason(REASON_INSTALL),
+ getOrCreateCompilerPackageStats(pkg),
+ mDexManager.isUsedByOtherApps(pkg.packageName));
+ Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
+ }
// Notify BackgroundDexOptService that the package has been changed.
// If this is an update of a package which used to fail to compile,