ffi #jni_main R.1: manifest synthesis + default parent → android.app.Activity
When `Compilation.lowering_jni_main_decls` is non-empty, `createApk` synthesises a manifest whose `<activity android:name>` points at the user's `#jni_main` class (dotted form of the foreign path), sets `android:hasCode="true"` so Android loads the bundled classes.dex, and drops the `android.app.lib_name` meta-data (that's the NativeActivity- specific autoload mechanism — Java-driven Activities load the .so via `System.loadLibrary` from a Java static initializer slice R.3 will emit). The legacy NativeActivity path stays as the fallback when no `#jni_main` decl is present. `jni_java_emit.zig`'s default superclass moves from `android.app.NativeActivity` to `android.app.Activity` — the former requires native_app_glue's `ANativeActivity_onCreate` to be in the .so, which the next slice (R.2) will stop linking by default. Verified end-to-end on the slice 2 smoke APK: `aapt2 dump xmltree` shows `android:name="co.swipelab.sxjnimain.SxApp"` + `hasCode="true"`, and `dexdump -l plain` confirms SxApp now extends `Landroid/app/Activity;`. 99-android-egl-clear's APK still uses the NativeActivity manifest as before (legacy path intact for R.2-R.5).
This commit is contained in:
@@ -43,7 +43,10 @@ pub const Options = struct {
|
||||
/// Used to resolve `*Foo` cross-class refs in method signatures.
|
||||
classes: ?*const std.StringHashMap([]const u8) = null,
|
||||
/// Default superclass when the user doesn't write `#extends ...;`.
|
||||
default_extends: []const u8 = "android.app.NativeActivity",
|
||||
/// `android.app.Activity` is the standard base for Java-driven
|
||||
/// Activities — `NativeActivity` is the legacy NDK path that
|
||||
/// requires native_app_glue's `ANativeActivity_onCreate`.
|
||||
default_extends: []const u8 = "android.app.Activity",
|
||||
};
|
||||
|
||||
/// Emit a `.java` source for the given foreign-class decl. Result is
|
||||
|
||||
Reference in New Issue
Block a user