diff options
| author | 2019-06-27 13:29:02 -0700 | |
|---|---|---|
| committer | 2019-06-27 13:29:02 -0700 | |
| commit | d2faa6a80db08fb6c04988a4a76e4c958546dfd9 (patch) | |
| tree | 4c0199485bf45861ffa56238503713dd8a678a62 | |
| parent | 1e1d89d66c3aa718026388d7802815b4d097e27f (diff) | |
| parent | d8a48663c680584416ad81d332f11e11269fd79a (diff) | |
Merge "Removing an extra installd call." am: 9db70d29a1
am: d8a48663c6
Change-Id: I689b46f567fa47fef9bb4a9bdd5d1c38ebeb3c68
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageDexOptimizer.java | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java index 65947511bc1d..75ff1c214930 100644 --- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java +++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java @@ -269,10 +269,7 @@ public class PackageDexOptimizer { return DEX_OPT_SKIPPED; } - // TODO(calin): there's no need to try to create the oat dir over and over again, - // especially since it involve an extra installd call. We should create - // if (if supported) on the fly during the dexopt call. - String oatDir = createOatDirIfSupported(pkg, isa); + String oatDir = getPackageOatDirIfSupported(pkg); Log.i(TAG, "Running dexopt (dexoptNeeded=" + dexoptNeeded + ") on: " + path + " pkg=" + pkg.applicationInfo.packageName + " isa=" + isa @@ -638,7 +635,7 @@ public class PackageDexOptimizer { } /** - * Creates oat dir for the specified package if needed and supported. + * Gets oat dir for the specified package if needed and supported. * In certain cases oat directory * <strong>cannot</strong> be created: * <ul> @@ -646,29 +643,19 @@ public class PackageDexOptimizer { * <li>Package location is not a directory, i.e. monolithic install.</li> * </ul> * - * @return Absolute path to the oat directory or null, if oat directory - * cannot be created. + * @return Absolute path to the oat directory or null, if oat directories + * not needed or unsupported for the package. */ @Nullable - private String createOatDirIfSupported(PackageParser.Package pkg, String dexInstructionSet) { + private String getPackageOatDirIfSupported(PackageParser.Package pkg) { if (!pkg.canHaveOatDir()) { return null; } File codePath = new File(pkg.codePath); - if (codePath.isDirectory()) { - // TODO(calin): why do we create this only if the codePath is a directory? (i.e for - // cluster packages). It seems that the logic for the folder creation is - // split between installd and here. - File oatDir = getOatDir(codePath); - try { - mInstaller.createOatDir(oatDir.getAbsolutePath(), dexInstructionSet); - } catch (InstallerException e) { - Slog.w(TAG, "Failed to create oat dir", e); - return null; - } - return oatDir.getAbsolutePath(); + if (!codePath.isDirectory()) { + return null; } - return null; + return getOatDir(codePath).getAbsolutePath(); } static File getOatDir(File codePath) { |