Link nativewindow instead of android on Android

Merged
UT
18d ago
+1-1

The layer links libandroid.so but uses nothing from it on release (its only Android import is __android_log_print, from liblog). Inside a Wine guest, libandroid's ~200 system dependencies look up their own libraries through LD_LIBRARY_PATH, so they bind to imagefs libraries with the same name. On Samsung (libsqlite needs BoringSSL's libcrypto) and Xiaomi HyperOS (libjpeg-hyper needs the system libjpeg) that fails to link, the Vulkan loader cannot load the layer, and LSFG silently does nothing.

This links nativewindow instead. It has no effect on release, which needs neither, but android-gen8-fixes calls AHardwareBuffer_allocate / AHardwareBuffer_release, and those live in libnativewindow.so. Its 31-library tree shares no names with imagefs.

Tested on a POCO F6 with libandroid forced to fail the way it does on Samsung (stub libsqlite.so first on LD_LIBRARY_PATH), Blazing Chrome with LSFG armed:

  • current layer: dlopen fails (cannot locate symbol "sqlite3_extended_errcode" referenced by libandroid_runtime.so) and the layer never runs
  • this change: the layer is mapped into the game process

Built with scripts/build/android.sh's flags (NDK r27d) plus -ffile-prefix-map for the source path. Dynamic exports are identical to the layer currently shipped in GameNative.