Skip to content

feat(transport): introduce StreamWearableConnection for Bluetooth and non-socket transports (#2) - #4

Open
Saik2789 wants to merge 1 commit into
microg:masterfrom
Saik2789:feat/stream-wearable-connection
Open

Saik2789 wants to merge 1 commit into
microg:masterfrom
Saik2789:feat/stream-wearable-connection

Conversation

@Saik2789

Copy link
Copy Markdown

Resolves #2

Summary

This pull request introduces StreamWearableConnection, which generalizes Wearable protocol communication over any abstract bidirectional stream (InputStream + OutputStream + Closeable).

This is the prerequisite transport abstraction required for Android Bluetooth RFCOMM / SPP support in microG, as requested in #2 and discussed in microg/GmsCore#4 and microg/GmsCore#2843.

Changes

  1. StreamWearableConnection:
    • Implements length-prefixed piece framing and wire proto serialization/deserialization over InputStream and OutputStream.
    • Supports clean lifecycle shutdown via Closeable.
  2. SocketWearableConnection:
    • Refactored to extend StreamWearableConnection directly, retaining 100% backward compatibility for existing TCP/ADB emulation connections.
  3. Unit Tests:
    • Added StreamWearableConnectionTest verifying bidirectional message exchange, Wire protobuf parsing (Connect and Heartbeat), and clean disconnection over piped streams.
  4. Build System Modernization:
    • Updated gradle wrapper to Gradle 8.13 and switched dependency repository from archived jcenter() to mavenCentral().
    • Used java-library plugin with api configuration so consumers correctly resolve Wire types.

Verification

  • Tested with OpenJDK 17:
    ./gradlew test
    Result: 100% successful, 0 failures.

… Bluetooth support (microg#2)

- Introduce StreamWearableConnection wrapping generic InputStream, OutputStream, and Closeable
- Refactor SocketWearableConnection to extend StreamWearableConnection
- Add comprehensive bidirectional StreamWearableConnectionTest with Wire proto roundtrip
- Update gradle wrapper to 8.13, java-library plugin, and mavenCentral repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bluetooth support

1 participant