Introduce a LazyJniRegistrar helper class for system server
Currently, system server registers all JNI native method entrypoints
eagerly in SystemServer init. This has generally been fine, but doesn't
allow for any flexibility in the existence of Java classes defining
these entrypoints; it's assumed that all such entrypoints always exist.
The LazyJniRegistrar class allows lazy registration of JNI methods
for classes or services, shifting registration responsibilty to
the Java classes that use these entrypoints. This in turn allows
optional classes or services to be stripped from the build.
Start by migrating only a small subset of classes that may be
considered optional in the near future. Eventually, we might
consider migrating more classes to further streamline init and
avoid cascading initialization overhead.
Bug: 375264322
Test: m + presubmit
Flag: EXEMPT refactor
Change-Id: Ia2a0f52575cd47b0f418bb0439ab3a02d413b6ae
8 files changed