Preload HttpEngine into the Zygote via an API
In order to speed-up the initialization of HttpEngine, we plan to
preload HttpEngine and all of its components into the Zygote. Currently
the plan is to preload the Impl classes and the shared library but
the current implementation only preload a single impl.
The new API is protected behind a flag and should be gradually
rolled out to ensure that we don't mess with the system health
metrics by enrolling HttpEngine into the Zygote. It's important to
note that HttpEngine's other version (Cronet) is extensively used
by a lot of apps and this would be a net positive for the entire
ecosystem.
Unfortunately, using exported flags in this case is impossible because
ZygoteInit happens before the DeviceConfig has initialized which means
that we have to link the same flag twice, once into tethering and
another into platform. The consequence here is that calling
`HttpEngine.preload()` can lead to NoSuchMethodError even if the flag
condition is enabled. This is protected by catching the exception and
logging it.
Bug: 380349437
Change-Id: I00fb4f751f41ee9459c55e76d58690d7ca4f0b30
2 files changed