Strategies

StrategyMeaningCost
TranslateThe app's own code, made into host code by a translator and a JITNone at run time once cached
MapAn Android interface that a host interface already gives, nearly one to one (libcore's java.* onto OpenJDK)A remap table for the differences
HLEThe runtime answers the interface itself, below the level Android implements it at. Nothing of Android's implementation runsThe interface's behavior, as apps see it
AbstractA whole subsystem collapsed onto one host facility (every window an SDL window, every surface a Vulkan swapchain)The subsystem's few entry points
ImplementOur own Java code, as Android's does it, because apps subclass it or depend on its exact logic (View, TextView layout)Real code, kept minimal
OffA service that reports itself absent or disabled, which apps must already handle (accessibility, autofill, telephony)A stub

An interface is HLE'd or abstracted unless the app can see the difference. Apps subclass View and Activity, so their logic is implemented. Apps never see system_server, binder transactions, SurfaceFlinger or gralloc, so those collapse. Where a native library does the work (SQLite, HarfBuzz, libdeflate), the Java side is a thin wrapper over it through JNI, not a copy of the library in Java.


Made from docs/platforms/android-apps/interfaces.md at 69237645142c. GPL-3.0-or-later.