From 5d1814e1b36d4ec98cfff78ee8e1824c6dcad818 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 13 Dec 2018 09:27:04 +0000 Subject: Use the boot class loader as parent of system server loader. ART expects the parent of the system server class loader to be the boot class loader during AOT, so use that at runtime too. bug: 120039104 Test: boot test Change-Id: I164f98d319f875d24baa360a4b3d152e8e2fc4d9 --- core/java/com/android/internal/os/ZygoteInit.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 8bdb000aad0e..c2c6ae6712ab 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -536,9 +536,11 @@ public class ZygoteInit { static ClassLoader createPathClassLoader(String classPath, int targetSdkVersion) { String libraryPath = System.getProperty("java.library.path"); + // We use the boot class loader, that's what the runtime expects at AOT. + ClassLoader parent = ClassLoader.getSystemClassLoader().getParent(); + return ClassLoaderFactory.createClassLoader(classPath, libraryPath, libraryPath, - ClassLoader.getSystemClassLoader(), targetSdkVersion, true /* isNamespaceShared */, - null /* classLoaderName */); + parent, targetSdkVersion, true /* isNamespaceShared */, null /* classLoaderName */); } /** -- cgit v1.2.3-59-g8ed1b