diff options
| author | Mathieu Chartier <mathieuc@google.com> | 2017-09-25 23:28:52 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-09-25 23:28:52 +0000 |
| commit | f006217aaa8a5e9feff2815e89311599bb7f025d (patch) | |
| tree | d3aac521bc06fecb6f90bc1a416a3fdf525e8eec | |
| parent | c2840f9f9f64de6b3fb4dd78ac493fa3776e662e (diff) | |
| parent | 364ea009c08e052561d6479cd74b9bfd779f65a1 (diff) | |
Merge "Revert "Add preopt profile logic for compiling during first boot"" into oc-mr1-dev am: 213b5c742f
am: 364ea009c0
Change-Id: Icfd1899886b051931ffeeffc68023c0c6676b719
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index d54ed611b4ef..050d9f00071a 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3315,24 +3315,6 @@ public class PackageManagerService extends IPackageManager.Stub removeCodePathLI(dstCodePath); return null; } - - // If we have a profile for a compressed APK, copy it to the reference location. - // Since the package is the stub one, remove the stub suffix to get the normal package and - // APK name. - File profileFile = new File(getPrebuildProfilePath(pkg).replace(STUB_SUFFIX, "")); - if (profileFile.exists()) { - try { - // We could also do this lazily before calling dexopt in - // PackageDexOptimizer to prevent this happening on first boot. The issue - // is that we don't have a good way to say "do this only once". - if (!mInstaller.copySystemProfile(profileFile.getAbsolutePath(), - pkg.applicationInfo.uid, pkg.packageName)) { - Log.e(TAG, "decompressPackage failed to copy system profile!"); - } - } catch (Exception e) { - Log.e(TAG, "Failed to copy profile " + profileFile.getAbsolutePath() + " ", e); - } - } return dstCodePath; } @@ -9757,7 +9739,7 @@ public class PackageManagerService extends IPackageManager.Stub * and {@code numberOfPackagesFailed}. */ private int[] performDexOptUpgrade(List<PackageParser.Package> pkgs, boolean showDialog, - final String compilerFilter, boolean bootComplete) { + String compilerFilter, boolean bootComplete) { int numberOfPackagesVisited = 0; int numberOfPackagesOptimized = 0; @@ -9768,8 +9750,6 @@ public class PackageManagerService extends IPackageManager.Stub for (PackageParser.Package pkg : pkgs) { numberOfPackagesVisited++; - boolean useProfileForDexopt = false; - if ((isFirstBoot() || isUpgrade()) && isSystemApp(pkg)) { // Copy over initial preopt profiles since we won't get any JIT samples for methods // that are already compiled. @@ -9783,28 +9763,11 @@ public class PackageManagerService extends IPackageManager.Stub if (!mInstaller.copySystemProfile(profileFile.getAbsolutePath(), pkg.applicationInfo.uid, pkg.packageName)) { Log.e(TAG, "Installer failed to copy system profile!"); - } else { - useProfileForDexopt = true; } } catch (Exception e) { Log.e(TAG, "Failed to copy profile " + profileFile.getAbsolutePath() + " ", e); } - } else { - PackageSetting disabledPs = mSettings.getDisabledSystemPkgLPr(pkg.packageName); - // Handle compressed APKs in this path. Only do this for stubs with profiles to - // minimize the number off apps being speed-profile compiled during first boot. - // The other paths will not change the filter. - if (disabledPs != null && disabledPs.pkg.isStub) { - // The package is the stub one, remove the stub suffix to get the normal - // package and APK names. - String systemProfilePath = - getPrebuildProfilePath(disabledPs.pkg).replace(STUB_SUFFIX, ""); - File systemProfile = new File(systemProfilePath); - // Use the profile for compilation if there exists one for the same package - // in the system partition. - useProfileForDexopt = systemProfile.exists(); - } } } @@ -9833,14 +9796,6 @@ public class PackageManagerService extends IPackageManager.Stub } } - String pkgCompilerFilter = compilerFilter; - if (useProfileForDexopt) { - // Use background dexopt mode to try and use the profile. Note that this does not - // guarantee usage of the profile. - pkgCompilerFilter = - PackageManagerServiceCompilerMapping.getCompilerFilterForReason( - PackageManagerService.REASON_BACKGROUND_DEXOPT); - } // If the OTA updates a system app which was previously preopted to a non-preopted state // the app might end up being verified at runtime. That's because by default the apps // are verify-profile but for preopted apps there's no profile. @@ -9849,9 +9804,9 @@ public class PackageManagerService extends IPackageManager.Stub // filter (by default 'quicken'). // Note that at this stage unused apps are already filtered. if (isSystemApp(pkg) && - DexFile.isProfileGuidedCompilerFilter(pkgCompilerFilter) && + DexFile.isProfileGuidedCompilerFilter(compilerFilter) && !Environment.getReferenceProfile(pkg.packageName).exists()) { - pkgCompilerFilter = getNonProfileGuidedCompilerFilter(pkgCompilerFilter); + compilerFilter = getNonProfileGuidedCompilerFilter(compilerFilter); } // checkProfiles is false to avoid merging profiles during boot which @@ -9862,7 +9817,7 @@ public class PackageManagerService extends IPackageManager.Stub int dexoptFlags = bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0; int primaryDexOptStaus = performDexOptTraced(new DexoptOptions( pkg.packageName, - pkgCompilerFilter, + compilerFilter, dexoptFlags)); switch (primaryDexOptStaus) { |
