diff options
| author | Dimitry Ivanov <dimitry@google.com> | 2016-04-20 16:02:00 -0700 |
|---|---|---|
| committer | Dimitry Ivanov <dimitry@google.com> | 2016-04-27 11:42:29 -0700 |
| commit | 89dad3360ea6ae2fa0c4eb70a760b8d6bcb98b82 (patch) | |
| tree | 80f74a5ba105f55883f90931ea9aa32384a42788 /core/java | |
| parent | b1ef62bb3834af6bdf8017e56b2cc614a566229e (diff) | |
Create linker namespace for the system server classloader
Bug: http://b/27702070
Change-Id: I12c9448e877202937cf558de75042bcb46f6a933
(cherry picked from commit eb5866d4b05b6c000385be4a536544e27ca13335)
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/os/ZygoteInit.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 78b5d61d3f1a..a4794a3e8291 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -475,7 +475,9 @@ public class ZygoteInit { } else { ClassLoader cl = null; if (systemServerClasspath != null) { - cl = new PathClassLoader(systemServerClasspath, ClassLoader.getSystemClassLoader()); + cl = createSystemServerClassLoader(systemServerClasspath, + parsedArgs.targetSdkVersion); + Thread.currentThread().setContextClassLoader(cl); } @@ -489,6 +491,23 @@ public class ZygoteInit { } /** + * Creates a PathClassLoader for the system server. It also creates + * a shared namespace associated with the classloader to let it access + * platform-private native libraries. + */ + private static PathClassLoader createSystemServerClassLoader(String systemServerClasspath, + int targetSdkVersion) { + String librarySearchPath = System.getProperty("java.library.path"); + + return PathClassLoaderFactory.createClassLoader(systemServerClasspath, + librarySearchPath, + null /* libraryPermittedPath */, + ClassLoader.getSystemClassLoader(), + targetSdkVersion, + true /* isNamespaceShared */); + } + + /** * Performs dex-opt on the elements of {@code classPath}, if needed. We * choose the instruction set of the current runtime. */ |
