Merge "nfc(api): Fix HCE services metadata name in javadoc." into main
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
index e34bbcf..7772282 100644
--- a/AconfigFlags.bp
+++ b/AconfigFlags.bp
@@ -89,6 +89,7 @@
"com.android.media.flags.editing-aconfig-java",
"com.android.media.flags.performance-aconfig-java",
"com.android.media.flags.projection-aconfig-java",
+ "com.android.net.http.flags-aconfig-exported-java",
"com.android.net.thread.platform.flags-aconfig-java",
"com.android.ranging.flags.ranging-aconfig-java-export",
"com.android.server.contextualsearch.flags-java",
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index e402ddf..e60879e 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -19,6 +19,8 @@
import static android.system.OsConstants.S_IRWXG;
import static android.system.OsConstants.S_IRWXO;
+import static android.net.http.Flags.preloadHttpengineInZygote;
+
import static com.android.internal.util.FrameworkStatsLog.BOOT_TIME_EVENT_ELAPSED_TIME__EVENT__SECONDARY_ZYGOTE_INIT_START;
import static com.android.internal.util.FrameworkStatsLog.BOOT_TIME_EVENT_ELAPSED_TIME__EVENT__ZYGOTE_INIT_START;
@@ -27,6 +29,7 @@
import android.content.pm.SharedLibraryInfo;
import android.content.res.Resources;
import android.os.Build;
+import android.net.http.HttpEngine;
import android.os.Environment;
import android.os.IInstalld;
import android.os.Process;
@@ -144,6 +147,23 @@
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
preloadSharedLibraries();
preloadTextResources();
+
+ // TODO: remove the try/catch and the flag read as soon as the flag is ramped and 25Q2
+ // starts building from source.
+ if (preloadHttpengineInZygote()) {
+ try {
+ HttpEngine.preload();
+ } catch (NoSuchMethodError e){
+ // The flag protecting this API is not an exported
+ // flag because ZygoteInit happens before the
+ // system service has initialized the flag which means
+ // that we can't query the real value of the flag
+ // from the tethering module. In order to avoid crashing
+ // in the case where we have (new zygote, old tethering).
+ // we catch the NoSuchMethodError and just log.
+ Log.d(TAG, "HttpEngine.preload() threw " + e);
+ }
+ }
// Ask the WebViewFactory to do any initialization that must run in the zygote process,
// for memory sharing purposes.
WebViewFactory.prepareWebViewInZygote();