summaryrefslogtreecommitdiff
path: root/services/core/java/com/android/server/pm/PackageDexOptimizer.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/core/java/com/android/server/pm/PackageDexOptimizer.java')
-rw-r--r--services/core/java/com/android/server/pm/PackageDexOptimizer.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 6cfe093df6d0..af0a20ddf337 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -936,15 +936,12 @@ public class PackageDexOptimizer {
String classLoaderContext, int profileAnalysisResult, boolean downgrade,
int dexoptFlags, String oatDir) {
final boolean shouldBePublic = (dexoptFlags & DEXOPT_PUBLIC) != 0;
- final boolean isProfileGuidedFilter = (dexoptFlags & DEXOPT_PROFILE_GUIDED) != 0;
- boolean newProfile = profileAnalysisResult == PROFILE_ANALYSIS_OPTIMIZE;
-
- if (!newProfile && isProfileGuidedFilter && shouldBePublic
- && isOdexPrivate(packageName, path, isa, oatDir)) {
- // The profile that will be used is a cloud profile, while the profile used previously
- // is a user profile. Typically, this happens after an app starts being used by other
- // apps.
- newProfile = true;
+ // If the artifacts should be public while the current artifacts are not, we should
+ // re-compile anyway.
+ if (shouldBePublic && isOdexPrivate(packageName, path, isa, oatDir)) {
+ // Ensure compilation by pretending a compiler filter change on the apk/odex location
+ // (the reason for the '-'. A positive value means the 'oat' location).
+ return adjustDexoptNeeded(-DexFile.DEX2OAT_FOR_FILTER);
}
int dexoptNeeded;
@@ -962,6 +959,7 @@ public class PackageDexOptimizer {
&& profileAnalysisResult == PROFILE_ANALYSIS_DONT_OPTIMIZE_EMPTY_PROFILES) {
actualCompilerFilter = "verify";
}
+ boolean newProfile = profileAnalysisResult == PROFILE_ANALYSIS_OPTIMIZE;
dexoptNeeded = DexFile.getDexOptNeeded(path, isa, actualCompilerFilter,
classLoaderContext, newProfile, downgrade);
} catch (IOException ioe) {