Drop REASON_FORCED_DEXOPT.
This can already be configured with the default compiler filter.
Also remove unused performDexOptIfNeeded.
bug:35794392
Test: device boots, forced dexopt works.
Change-Id: I14fc86c4783b2d7ac9cf8972b6619ba303e79659
(cherry picked from commit e103256c1f)
This commit is contained in:
@@ -473,15 +473,6 @@ interface IPackageManager {
|
||||
*/
|
||||
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
|
||||
|
||||
@@ -96,7 +96,7 @@ import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
|
||||
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;
|
||||
@@ -536,9 +536,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
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(
|
||||
@@ -8580,14 +8579,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
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) {
|
||||
@@ -8864,10 +8855,10 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
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);
|
||||
|
||||
@@ -26,7 +26,7 @@ import dalvik.system.DexFile;
|
||||
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.
|
||||
@@ -54,16 +54,6 @@ public class PackageManagerServiceCompilerMapping {
|
||||
+ "(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;
|
||||
}
|
||||
|
||||
@@ -103,12 +93,12 @@ public class PackageManagerServiceCompilerMapping {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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";
|
||||
|
||||
Reference in New Issue
Block a user