Add a new module-only API to preload HttpEngine
This is supposed to be used only from the Zygote during the
initialization phase to preload HttpEngine. Currently, the
implementation only preloads a single class which is used to initialize
the backend for HttpEngine.
Bug: 380349437
Change-Id: If3ebcb37e51104a69473491e9f230d1b043c7bd0
diff --git a/framework/Android.bp b/framework/Android.bp
index 0334e11..4353213 100644
--- a/framework/Android.bp
+++ b/framework/Android.bp
@@ -156,6 +156,7 @@
java_defaults {
name: "CronetJavaDefaults",
srcs: [":httpclient_api_sources"],
+ static_libs: ["com.android.net.http.flags-aconfig-java"],
libs: [
"androidx.annotation_annotation",
],
@@ -212,6 +213,7 @@
},
aconfig_declarations: [
"com.android.net.flags-aconfig",
+ "com.android.net.http.flags-aconfig",
"com.android.networksecurity.flags-aconfig",
],
}
diff --git a/framework/api/module-lib-current.txt b/framework/api/module-lib-current.txt
index cd7307f..0129e5c 100644
--- a/framework/api/module-lib-current.txt
+++ b/framework/api/module-lib-current.txt
@@ -247,3 +247,11 @@
}
+package android.net.http {
+
+ public abstract class HttpEngine {
+ method @FlaggedApi("android.net.http.preload_httpengine_in_zygote") public static void preload();
+ }
+
+}
+