Native code

An APK's lib/arm64-v8a/*.so are AArch64 code for bionic, recompiled as the GNU ABI runtime recompiles Linux programs (GNU ABI). Their imports from Android's native libraries are hooks, as the Switch runtime's NVN hooks are (src/nx/gpu/nvn):

LibraryStrategy
bionic (libc, libm, libdl)Map the C library onto the host's where the ABI agrees; HLE __system_property_get, bionic's TLS slots and dlopen of the APK's own libraries. System calls that remain go to the GNU ABI layer
liblogHLE onto the runtime's log
libandroid (ANativeWindow, AAssetManager, ALooper, AConfiguration, AHardwareBuffer, ASurfaceTexture)HLE onto the same objects the Java side uses: a window is the SDL window's surface, an asset an APK member, a hardware buffer a Vulkan image
libvulkanThe host's Vulkan, with VK_KHR_android_surface and VK_ANDROID_external_memory_android_hardware_buffer answered by the hooks above
libEGL, libGLESv1_CM, libGLESv2, libGLESv3HLE onto Vulkan: all drawing in ScarletNX is Vulkan. GLES 1.1's fixed function is done, and Java's EGL10 shares the native EGL's objects (Native bridge, "EGL and GLES"). GLES 2 and 3 have no config yet, so engines take Vulkan
libzThe build's own zlib, called as it is on an LP64 host
libjnigraphics (AndroidBitmap)HLE onto android.graphics.Bitmap's pixels
libOpenSLES, libaaudioAbstract onto SDL's audio
libmediandkHLE onto FFmpeg
libbinder_ndkOff: no other process to reach

JNI between the JVM and the recompiled code goes through a bridge that converts the AArch64 calling convention, as the Switch runtime's RtAPI does. The baseline app needs none of this: its only native library, libandroidx.graphics.path.so, is AndroidX's path iterator for Android 13 and older, which Android 14 and later do in the framework.


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