summaryrefslogtreecommitdiff
path: root/core/java/android/app/ApplicationLoaders.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/app/ApplicationLoaders.java')
-rw-r--r--core/java/android/app/ApplicationLoaders.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index 6a73829da154..ef2db4a0d795 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -16,17 +16,19 @@
package android.app;
+import android.os.Build;
import android.os.Trace;
import android.util.ArrayMap;
import com.android.internal.os.PathClassLoaderFactory;
import dalvik.system.PathClassLoader;
-class ApplicationLoaders {
+/** @hide */
+public class ApplicationLoaders {
public static ApplicationLoaders getDefault() {
return gApplicationLoaders;
}
- public ClassLoader getClassLoader(String zip, int targetSdkVersion, boolean isBundled,
+ ClassLoader getClassLoader(String zip, int targetSdkVersion, boolean isBundled,
String librarySearchPath, String libraryPermittedPath,
ClassLoader parent) {
/*
@@ -80,6 +82,19 @@ class ApplicationLoaders {
}
}
+ /**
+ * Creates a classloader for the WebView APK and places it in the cache of loaders maintained
+ * by this class. This is used in the WebView zygote, where its presence in the cache speeds up
+ * startup and enables memory sharing.
+ */
+ public ClassLoader createAndCacheWebViewClassLoader(String packagePath, String libsPath) {
+ // The correct paths are calculated by WebViewZygote in the system server and passed to
+ // us here. We hardcode the other parameters: WebView always targets the current SDK,
+ // does not need to use non-public system libraries, and uses the base classloader as its
+ // parent to permit usage of the cache.
+ return getClassLoader(packagePath, Build.VERSION.SDK_INT, false, libsPath, null, null);
+ }
+
private static native void setupVulkanLayerPath(ClassLoader classLoader, String librarySearchPath);
/**