Add Godot Android service integration - #1138
Draft
linuxificator wants to merge 8 commits into
Draft
Conversation
Add a fixed-size AF_UNIX/SOCK_SEQPACKET transport for local AMY wire messages, including peer credential checks, bounded queueing, cleanup safeguards, standalone regression tests, and focused CI.
Add a generic Android AAR service that renders AMY through Oboe/AAudio and accepts ordinary AMY wire packets over the private Unix transport. Include the minimal C-scale hello-world app plus Android build and emulator integration CI.
Document the generic Android AAR, Oboe backend, private SOCK_SEQPACKET client contract, readiness semantics, build requirements, and hello-world example.
Measure the raw AMY render stream and exact signed-16-bit buffer handed to Oboe during the Android hello-world integration test. Retain both WAVs and level statistics in CI, require byte-for-byte AMY-to-Oboe identity, healthy peak level, and no full-scale clipping. Use AMY V10.0 for the audible hello-world. AMY's V control is a 0..10 bus/master scale and the final mixer applies a 0.1 factor, so the previous V2.0 setting was only 20% linear gain (about -14 dB relative to V10.0). Validated at -2.721 dBFS peak with zero clipping and zero AMY-to-Oboe sample differences in Android AMY run 32630088165.
Make the Java hello-world a transport-only client. MainActivity no longer imports or starts AmyService and no longer loads a JNI/native client library. It uses Android LocalSocket SOCK_SEQPACKET directly and sends only ordinary AMY wire packets to filesDir/amy.sock. Move service startup to an AAR-owned ContentProvider lifecycle hook, remove the hello-world C++/CMake client wrapper, and move test-only audio capture arming into CI so the example remains free of service/test control logic.
Add a transport-only Java AmyClient helper to the Android service AAR and teach the shared Godot Amy.gd wrapper to use it on Android. Android keeps the same high-level Dictionary-to-wire API as desktop/web, but sends each generated wire message over the app-private SOCK_SEQPACKET amy.sock transport. The Godot process does not load or compile the AmySynth GDExtension on Android and does not start or stop AmyService.
Add a small Godot Android example that uses only the shared Amy.gd Dictionary API. The example packages the Android service AAR through a Godot export plugin and deliberately excludes the AmySynth GDExtension and AMY source from Android exports. Add Android CI that exports ARM64 and x86_64 APKs, enforces a single AMY native implementation in the APK, and proves the high-level Amy.gd -> private socket -> :amy service -> Oboe audio path on an emulator. The emulator acceptance test deliberately ignores unrelated Godot renderer/UI failures once the AMY transport is established; it still fails on socket transport errors or missing/non-matching audio.
Document the Android service/socket architecture, platform-specific API surface, prebuilt AAR packaging, safe backend readiness handling, and startup sequencing. Clarify that the private ContentProvider requests service startup, the native service publishes amy.sock only after Oboe's first realtime callback, and Amy.gd tolerates an absent socket for approximately 10 seconds while retrying connection.
linuxificator
force-pushed
the
upstream/godot-android
branch
from
August 23, 2026 19:16
d163680 to
f77cf93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency: stacked on #1136
This PR depends on #1136 (
Add Android Oboe backend and AMY wire socket transport) and should not be merged before #1136 is accepted.The branch is built directly on the current #1136 head,
a12c19bfdd9936dcb10ab8b8e39214041dd56cd9. The Godot contribution itself is exactly three commits on top of that head. Until #1136 is merged intomain, GitHub will necessarily show the #1136 commits in this PR as well because a Shorepine PR cannot use a branch from the fork as its base.For the incremental Godot review, the relevant stack is:
63f07daa— Add Android transport backend to Godot Amy API0f100c27— Add Godot Android hello-world and CIf77cf938— Document Godot Android service integrationSummary
Adds Android support to the existing high-level Godot
Amy.gdAPI without running or compiling a second AMY engine in the Godot process.On Android the path is:
The same
message(Dictionary)wire generator used by the existing Godot API remains authoritative. Android only changes the transport/backend after a wire message has been built.Android client boundary
The Godot application:
AmyService;AmySynthGDExtension on Android;amy-serviceAAR in the same APK/UID and sends wire messages through its private socket.AmyClientis a small pure-Java adapter around Android's publicLocalSocket(SOCKET_SEQPACKET)API. It contains no synth/DSP code and owns no service lifecycle.The existing desktop GDExtension and web/WASM backends remain unchanged in architecture.
Godot example and packaging
Adds
godot/android-hello-world, which demonstrates:Amy.send(Dictionary)API rather than direct test-only socket calls;amy.gdextension,godot/bin, AMY source, and any second AMY native client library.The source-tree
prepare.shbuilds/stages debug and release AARs for development/CI. Downstream Godot applications can package a prebuilt AAR instead; they do not need to rebuild AMY as part of every Godot project.Validation
The cleaned three-commit stack was validated in a fork-local PR directly against the exact #1136 head, so the test diff contained only these Godot changes.
Validated code head before the documentation-only startup clarification:
2f1522b5cc772bb3093068f2e298a64627f5bbec. Current head:f77cf9389a800a69396170f502f8c6b380ca2329.Successful validation runs:
32659597021: all build/import/export/packaging checks passed; emulator connectedAmy.gdtoamy.sock, sent Dictionary-generated AMY wire, and the captured AMY render/Oboe audio analyzer passed.32659597044: socket transport, AAR/hello-world build, Android emulator end-to-end test, and AMY/Oboe audio analysis all passed.The Godot emulator test is intentionally scoped to the AMY integration contract rather than Godot's renderer. The x86_64 preset omits the optional Canvas UI, and unrelated Godot/SwiftShader renderer failures are not authoritative once the AMY path is established. The test still requires:
:amyservice and Oboe backend to start;Amy.gdto connect to the private socket;Documentation
Updates
docs/godot.md,android/README.md, and the Android Godot example documentation to make the platform boundary explicit, including:backend_ready/backend_errorhandling;AmySynthGDExtension in Android exports;AmyAutoStartProviderrequests the separate:amyservice, the native service publishesamy.sockonly after Oboe has delivered its first realtime callback, andAmy.gdtreats a missing socket as expected during startup and retries for approximately 10 seconds before emittingbackend_error.This PR is intentionally left as Draft while #1136 is reviewed/accepted.