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
This commit is contained in:
Mohannad Farrag 2024-11-22 07:50:30 +00:00
commit 5023143dcf
2 changed files with 10 additions and 0 deletions

View file

@ -156,6 +156,7 @@ java_library {
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 @@ java_sdk_library {
},
aconfig_declarations: [
"com.android.net.flags-aconfig",
"com.android.net.http.flags-aconfig",
"com.android.networksecurity.flags-aconfig",
],
}

View file

@ -247,3 +247,11 @@ package android.net {
}
package android.net.http {
public abstract class HttpEngine {
method @FlaggedApi("android.net.http.preload_httpengine_in_zygote") public static void preload();
}
}