Merge "Pass system server class loader context when asking GetDexOptNeeded"

This commit is contained in:
Calin Juravle
2020-02-15 01:18:03 +00:00
committed by Gerrit Code Review

View File

@@ -647,17 +647,18 @@ public class ZygoteInit {
String classPathForElement = ""; String classPathForElement = "";
boolean compiledSomething = false; boolean compiledSomething = false;
for (String classPathElement : classPathElements) { for (String classPathElement : classPathElements) {
// System server is fully AOTed and never profiled // We default to the verify filter because the compilation will happen on /data and
// for profile guided compilation. // system server cannot load executable code outside /system.
String systemServerFilter = SystemProperties.get( String systemServerFilter = SystemProperties.get(
"dalvik.vm.systemservercompilerfilter", "speed"); "dalvik.vm.systemservercompilerfilter", "verify");
String classLoaderContext =
getSystemServerClassLoaderContext(classPathForElement);
int dexoptNeeded; int dexoptNeeded;
try { try {
dexoptNeeded = DexFile.getDexOptNeeded( dexoptNeeded = DexFile.getDexOptNeeded(
classPathElement, instructionSet, systemServerFilter, classPathElement, instructionSet, systemServerFilter,
null /* classLoaderContext */, false /* newProfile */, classLoaderContext, false /* newProfile */, false /* downgrade */);
false /* downgrade */);
} catch (FileNotFoundException ignored) { } catch (FileNotFoundException ignored) {
// Do not add to the classpath. // Do not add to the classpath.
Log.w(TAG, "Missing classpath element for system server: " + classPathElement); Log.w(TAG, "Missing classpath element for system server: " + classPathElement);
@@ -678,8 +679,6 @@ public class ZygoteInit {
final String compilerFilter = systemServerFilter; final String compilerFilter = systemServerFilter;
final String uuid = StorageManager.UUID_PRIVATE_INTERNAL; final String uuid = StorageManager.UUID_PRIVATE_INTERNAL;
final String seInfo = null; final String seInfo = null;
final String classLoaderContext =
getSystemServerClassLoaderContext(classPathForElement);
final int targetSdkVersion = 0; // SystemServer targets the system's SDK version final int targetSdkVersion = 0; // SystemServer targets the system's SDK version
try { try {
installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName, installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName,