| Layer | On Android | Here | Strategy | Status |
|---|---|---|---|---|
| DEX bytecode | ART's interpreter, JIT and dex2oat | src/android/dex/ to JVM classes, HotSpot's JIT | Translate | Done |
ART internals apps touch (dalvik.system.*, hidden VMRuntime calls) | libart | Small Java shims. The app's loader is a PathClassLoader, whose findLibrary gives the app's native library folder. A loader of another DEX path finds no classes of its own, as the runtime translates only the APK | HLE | As apps reach them |
libcore (java.*, javax.*) | ART's OpenJDK fork | OpenJDK's java.base | Map | Works; Android-only members go to a remap table in the translator when an app reaches one |
Framework (android.*) | framework.jar | Our own subset, src/android/framework/ | Implement where subclassed, else HLE or Off | In progress |
Process start (zygote, ActivityThread, LoadedApk) | zygote and ActivityThread.main | snx.android.Main reads the manifest and starts the components in handleBindApplication's order | Abstract | Done: the factory, the Application, the providers, the launcher activity |
System services (ActivityManager, PackageManager, WindowManager, ...) in system_server | Binder IPC to another process | Plain objects in the process, called directly (snx.android.app.SystemServices) | HLE | The ones the baseline app asks for |
Binder (android.os.Binder, Parcel) | /dev/binder, libbinder | Local binders only; Parcel a Java byte buffer for the apps that marshal through it | HLE | Planned |
| libandroid_runtime (the JNI of the framework) | C++ in the framework | Natives that the runtime registers (android_jvm_register) | HLE | XML parser, assets, text, SQLite done |
| libandroidfw (resources, binary XML, assets) | AssetManager2, ResXMLParser | src/android/res/ (C): binary XML, resource table, configuration match | HLE | Done: binary XML, resources.arsc, themes, style resolution |
libhwui (Canvas, RenderNode, HardwareRenderer, Paint, Path) | Skia over Vulkan or GLES, a RenderThread | Display lists that the Java side records in a byte format, drawn with Vulkan by ScarletNX's renderer (HWUI) | HLE | Shapes, paths, strokes, text, bitmaps and nine-patches drawn, images decoded with FFmpeg; gradients and layers next |
| minikin (text measure and shaping) | minikin and HarfBuzz | HarfBuzz behind snx.android.hwui.Text (src/android/hwui/text.c), which Paint and Canvas call | HLE | Shaping and metrics done |
Fonts (/system/fonts, fonts.xml) | System font files | Noto Sans JP (the subset the Switch runtime already uses), which the build and an install put beside the program in android-fonts/ | Abstract | Done, one family for every typeface |
| SurfaceFlinger, BufferQueue, gralloc, HWC | Composer process and buffer allocator | A window's surface is an SDL window's Vulkan swapchain, or an image of its own without a display | Abstract | Done |
Input (InputDispatcher, InputChannel) | system_server and a socket per window | SDL events made into MotionEvent and KeyEvent on the window's thread: the left mouse button as a finger, a US keyboard. A touch goes to the top window whose frame holds it or that is touch-modal, a key to the top window that takes focus, as InputDispatcher picks them (snx.android.ui.Host) | Abstract | First version |
Native Looper (epoll) | libutils | The main MessageQueue waits in steps of 4 ms and reads SDL's event queue between them | HLE | Done |
Choreographer vsync | DisplayEventReceiver from SurfaceFlinger | A 60 Hz timer; the swapchain's FIFO present holds the main thread to the display | Abstract | Done |
SQLite (android.database.sqlite) | libsqlite and its JNI | Java classes over SQLite's amalgamation, a pinned package (src/android/db/sqlite_jni.c) | HLE | Done |
SharedPreferences, files, databases folders | /data/data/<package> | A folder of the app in the data folder (snx.android.data, or android/<package> in ScarletNX's data folder), with Android's XML format for preferences | Abstract | Done |
Settings provider (Settings.Global, Secure, System) | A content provider in system_server | A table of defaults | HLE | Planned |
| Accessibility, autofill, content capture, input methods | Services in system_server | Managers that report the service is off; text input from the keyboard as key events | Off | Planned |
Network (java.net, the guest's sockets) | The kernel's sockets | ScarletNX's Network setting (network in settings.txt, 0 by default), from the launcher's settings.ini. Java's name resolver (snx.android.net.OfflineResolver) answers the names of Android's /etc/hosts as a device does (localhost is 127.0.0.1 alone). Offline, it answers no other name, its proxy selector refuses other hosts, ConnectivityManager has no network, and the guest's connect, sendto and name lookups reach loopback only | Abstract | Done |
Connectivity, power, alarms, jobs (JobScheduler, AlarmManager) | system_server | Report a connected network and no power saving; jobs run on the main looper, a full battery on power is the sticky broadcast | HLE | Enough for WorkManager |
| Telephony, location, sensors, camera, Bluetooth, NFC, biometrics, Wi-Fi, USB, vibrator, microphone | HALs | Report none present: no camera, location turned off, no Bluetooth or NFC adapter (their managers are null, as on a device without the feature), no fingerprint hardware, Wi-Fi off with the wired host network | Off | Done for the members apps reference |
| Accounts, credentials, ad services, printing, downloads, wallpaper, device policy, app widgets | system_server | No accounts or credentials, ad services unavailable (each call reports an error), a download fails at once, no wallpaper, an unmanaged device | Off | Done for the members apps reference |
Media codecs (MediaCodec, ImageDecoder) | codec2, libstagefright | BitmapFactory and ImageDecoder read PNG, JPEG, WebP, GIF and BMP, and Bitmap.compress writes PNG and JPEG, through FFmpeg (src/android/hwui/image.c). MediaPlayer and SoundPool play audio: FFmpeg decodes MP3, Ogg Vorbis, FLAC, AAC, WAV PCM and ADPCM from memory to 48 kHz stereo, and one SDL audio stream mixes the voices (src/android/runtime/audio.c; a --headless run mixes on SDL's dummy driver at real time). A sound decodes whole when it loads, a player's stream as it plays. MediaCodec creates no codec, MediaPlayer draws no picture, and AudioTrack plays silence in real time | HLE | Images, MediaPlayer's and SoundPool's audio done. Planned: MediaCodec on FFmpeg, and AudioTrack on the same mixer |
Made from docs/platforms/android-apps/interfaces.md at 69237645142c. GPL-3.0-or-later.