void notifyDexLoad(String loadingPackageName, in List<String> dexPaths, String loaderIsa);
/**
- * Ask the package manager to perform dex-opt (if needed) on the given
- * package if it already hasn't done so.
- *
- * In most cases, apps are dexopted in advance and this function will
- * be a no-op.
- */
- boolean performDexOptIfNeeded(String packageName);
-
- /**
* Ask the package manager to perform a dex-opt for the given reason. The package
* manager will map the reason to a compiler filter according to the current system
* configuration.
import static com.android.server.pm.InstructionSets.getPreferredInstructionSet;
import static com.android.server.pm.InstructionSets.getPrimaryInstructionSet;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getCompilerFilterForReason;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.getFullCompilerFilter;
+import static com.android.server.pm.PackageManagerServiceCompilerMapping.getDefaultCompilerFilter;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getNonProfileGuidedCompilerFilter;
import static com.android.server.pm.PermissionsState.PERMISSION_OPERATION_FAILURE;
import static com.android.server.pm.PermissionsState.PERMISSION_OPERATION_SUCCESS;
public static final int REASON_INSTALL = 2;
public static final int REASON_BACKGROUND_DEXOPT = 3;
public static final int REASON_AB_OTA = 4;
- public static final int REASON_FORCED_DEXOPT = 5;
- public static final int REASON_LAST = REASON_FORCED_DEXOPT;
+ public static final int REASON_LAST = REASON_AB_OTA;
/** All dangerous permission names in the same order as the events in MetricsEvent */
private static final List<String> ALL_DANGEROUS_PERMISSIONS = Arrays.asList(
mDexManager.notifyDexLoad(ai, dexPaths, loaderIsa, userId);
}
- // TODO: this is not used nor needed. Delete it.
- @Override
- public boolean performDexOptIfNeeded(String packageName) {
- int dexOptStatus = performDexOptTraced(packageName,
- false /* checkProfiles */, getFullCompilerFilter(), false /* force */);
- return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED;
- }
-
@Override
public boolean performDexOpt(String packageName,
boolean checkProfiles, int compileReason, boolean force) {
synchronized (mInstallLock) {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
- // Whoever is calling forceDexOpt wants a fully compiled package.
+ // Whoever is calling forceDexOpt wants a compiled package.
// Don't use profiles since that may cause compilation to be skipped.
final int res = performDexOptInternalWithDependenciesLI(pkg,
- false /* checkProfiles */, getCompilerFilterForReason(REASON_FORCED_DEXOPT),
+ false /* checkProfiles */, getDefaultCompilerFilter(),
true /* force */);
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
public class PackageManagerServiceCompilerMapping {
// Names for compilation reasons.
static final String REASON_STRINGS[] = {
- "first-boot", "boot", "install", "bg-dexopt", "ab-ota", "forced-dexopt"
+ "first-boot", "boot", "install", "bg-dexopt", "ab-ota"
};
// Static block to ensure the strings array is of the right length.
+ "(reason " + REASON_STRINGS[reason] + ")");
}
- // Ensure that some reasons are not mapped to profile-guided filters.
- switch (reason) {
- case PackageManagerService.REASON_FORCED_DEXOPT:
- if (DexFile.isProfileGuidedCompilerFilter(sysPropValue)) {
- throw new IllegalStateException("\"" + sysPropValue + "\" is profile-guided, "
- + "but not allowed for " + REASON_STRINGS[reason]);
- }
- break;
- }
-
return sysPropValue;
}
}
/**
- * Return the compiler filter for "full" compilation.
+ * Return the default compiler filter for compilation.
*
* We derive that from the traditional "dalvik.vm.dex2oat-filter" property and just make
* sure this isn't profile-guided. Returns "speed" in case of invalid (or missing) values.
*/
- public static String getFullCompilerFilter() {
+ public static String getDefaultCompilerFilter() {
String value = SystemProperties.get("dalvik.vm.dex2oat-filter");
if (value == null || value.isEmpty()) {
return "speed";