Don't check if forward locked apps are used by others
Forward locked apps don't share their code so there is no point moving
from profile guided to full compilation.
Bug: 27334750
Bug: 26080105
Change-Id: I195d48504435bc66e890470f04056c4279d0bb2f
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 5ceb65f..4ca615d 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -138,9 +138,8 @@
boolean isProfileGuidedFilter = DexFile.isProfileGuidedCompilerFilter(targetCompilerFilter);
// If any part of the app is used by other apps, we cannot use profile-guided
// compilation.
- // TODO: This needs to be refactored to be also checked when the target mode is
- // profile-guided.
- if (isProfileGuidedFilter) {
+ // Skip the check for forward locked packages since they don't share their code.
+ if (isProfileGuidedFilter && !pkg.isForwardLocked()) {
for (String path : paths) {
if (isUsedByOtherApps(path)) {
checkProfiles = false;