mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-14 05:00:27 +00:00
Android: decouple video/audio subsystems from JNI initialization
Allow Android embedders to use SDL without the full video/audio Java layer by gating subsystem-specific code behind SDL_VIDEO_DISABLED and SDL_AUDIO_DISABLED preprocessor flags. This enables applications that only need joystick/gamepad support (e.g. Qt-based apps like QGroundControl) to build SDL without shipping stub Java classes for unused subsystems. Changes: - Split SDLActivity JNI method table into core (lifecycle, hints, permissions) and video (surface, input, clipboard, orientation) - Gate SDLAudioManager and SDLInputConnection JNI registration - Make checkJNIReady() subsystem-aware: no longer requires mAudioManagerClass when SDL_AUDIO_DISABLED - Group method ID resolution by subsystem in nativeSetupJNI() - Guard all video/audio function implementations and declarations - Keep display orientation accessors always available (needed by camera) - Add subsystem-selective SDL.setupJNI(int)/initialize(int) to SDL.java with backwards-compatible zero-arg overloads - Guard SDL_VIDEO_DRIVER_ANDROID and related defines in SDL_build_config_android.h
This commit is contained in:
committed by
Sam Lantinga
parent
8554d1c23c
commit
7a6eed4ec8
@@ -82,6 +82,8 @@ def collect_jni_bindings_from_c() -> dict[str, set[JniMethodBinding]]:
|
||||
if re.match(r"\};", line):
|
||||
in_struct = False
|
||||
break
|
||||
if re.match(r"\s*(#|//)", line):
|
||||
continue
|
||||
n = re.match(r"""\s*\{\s*"(?P<method>[a-zA-Z0-9_]+)"\s*,\s*"(?P<spec>[()A-Za-z0-9_/;[]+)"\s*,\s*(\(void\*\))?(HID|SDL)[_A-Z]*_JAVA_[_A-Z]*INTERFACE[_A-Z]*\((?P=method)\)\s*\},?""", line)
|
||||
assert n, f"'{line}' does not match regex"
|
||||
methods.add(JniMethodBinding(name=n["method"], spec=n["spec"]))
|
||||
|
||||
Reference in New Issue
Block a user