ffi #jni_main R.5: retire legacy NativeActivity surface

Deletes the entire NativeActivity / native_app_glue / ALooper stack
that the previous Android entry path was built around:

  - `examples/99-android-egl-clear.sx` — the demo of the legacy path.
  - `library/modules/platform/android.sx` — `AndroidPlatform.init`,
    `run_frame_loop`, `sx_android_bootstrap`, `g_android_app`, plus
    the ALooper / AInputEvent / ANativeActivity / AConfiguration
    foreign decls that fed them. The JNI helpers (`sx_load_javavm_fn`,
    `sx_android_get_env`, `sx_query_safe_insets_jni`, the
    `ANATIVEACTIVITY_*` offsets) were tied to the ANativeActivity*
    delivered to `android_main` — they're stale now that the OS hands
    sx code a Java Activity directly via `onCreate(JNIEnv*, jobject)`.
  - `library/vendors/sx_android_jni/sx_android_jni.c` — the input-
    handler installer (`sx_android_install_input_handler`), which
    poked NDK app-pointer field offsets that no longer exist.

`library/modules/platform/android_jni.sx` (the `Activity`/`Window`/
`View`/`WindowInsets` `#jni_class` registry used for safe-insets
dispatch) survives — it's standalone declarative bindings useful from
any `#jni_main` onCreate body. Docstring updated to drop the
"imported from android.sx" framing.

131 host / 4 cross / zig build test all green. End-to-end smoke APK
still produces the expected JNI-mangled symbol +
SxApp-extends-Activity dex.

External consumers (chess) will need to migrate their entry from the
`AndroidPlatform.run_frame_loop` model to the `#jni_main` model
(Java-side Activity drives lifecycle; onSurfaceChanged / Choreographer
drive frames via JNI callbacks). That migration is downstream work.
This commit is contained in:
agra
2026-05-20 15:17:24 +03:00
parent 3300bfb0df
commit 619d524bac
5 changed files with 10 additions and 737 deletions

View File

@@ -1,11 +1,11 @@
// Declarative JNI class bindings used by the Android platform module's
// safe-insets dispatch chain. Imported under a named namespace from
// `modules/platform/android.sx` so the bare class names (`Activity`,
// `Window`, `View`, `WindowInsets`) don't pollute the top-level
// namespace when consumers flat-import the platform module — `View`
// in particular collides with `modules/ui/view.sx`'s protocol.
//
// Inside the platform module these are referenced as `Jni.Activity`,
// Declarative JNI class bindings for the standard Android system-bar
// inset chain (`Activity.getWindow → Window.getDecorView → View
// .getRootWindowInsets → WindowInsets.getSystemWindowInset{Top,Left,
// Bottom,Right}`). Intended to be imported under a named namespace
// (e.g. `Jni :: #import "library/modules/platform/android_jni.sx"`) so
// the bare class names don't pollute the top-level namespace —
// `View` in particular collides with `modules/ui/view.sx`'s protocol.
// Inside the namespace these are referenced as `Jni.Activity`,
// `Jni.Window`, etc. The compiler registers the decls both qualified
// and bare in `foreign_class_map`, so cross-class refs in method
// signatures (`getWindow :: (self: *Self) -> *Window`) still resolve