From 9438528d99a404ce10e567bbbb5f0cc9519fb5da Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Tue, 12 Jul 2016 13:56:34 +0100 Subject: [PATCH] Compile core-apps according to their own "reason" for A/B If the core apps are not preopted in the B OTA, and REASON_AB_OTA is not speed (by default is speed-profile) they will be interepreted/JITed. This in itself is not a problem as we will end up doing profile guided compilation. However, some core apps may be loaded by system server which doesn't JIT and we need to make sure we don't interpret-only. Bug: 30032273 Change-Id: Idb11b1c01c4c4ceba043feb3a9ccc6958035d3b7 (cherry picked from commit 565621328dd4fc2e179a34494d0f8b8dc1b1eae9) --- .../java/com/android/server/pm/OtaDexoptService.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/pm/OtaDexoptService.java b/services/core/java/com/android/server/pm/OtaDexoptService.java index 01b3dc28b50e3..02c6472b2f88f 100644 --- a/services/core/java/com/android/server/pm/OtaDexoptService.java +++ b/services/core/java/com/android/server/pm/OtaDexoptService.java @@ -213,9 +213,19 @@ public class OtaDexoptService extends IOtaDexopt.Stub { // Use the package manager install and install lock here for the OTA dex optimizer. PackageDexOptimizer optimizer = new OTADexoptPackageDexOptimizer( collectingInstaller, mPackageManagerService.mInstallLock, mContext); + // Make sure that core apps are optimized according to their own "reason". + // If the core apps are not preopted in the B OTA, and REASON_AB_OTA is not speed + // (by default is speed-profile) they will be interepreted/JITed. This in itself is not a + // problem as we will end up doing profile guided compilation. However, some core apps may + // be loaded by system server which doesn't JIT and we need to make sure we don't + // interpret-only + int compilationReason = nextPackage.coreApp + ? PackageManagerService.REASON_CORE_APP + : PackageManagerService.REASON_AB_OTA; + optimizer.performDexOpt(nextPackage, nextPackage.usesLibraryFiles, null /* ISAs */, false /* checkProfiles */, - getCompilerFilterForReason(PackageManagerService.REASON_AB_OTA)); + getCompilerFilterForReason(compilationReason)); mCommandsForCurrentPackage = collectingConnection.commands; if (mCommandsForCurrentPackage.isEmpty()) {