1 Building and Testing
David Spitzer edited this page 2026-07-02 16:00:10 -07:00

Building and Testing

Assumes you've done Setup already.

Build the APK

./gradlew assembleDebug

Output: app/build/outputs/apk/debug/app-debug.apk.

Run the unit test suite

./gradlew testDebugUnitTest

As of the M3 milestone this runs 16 tests, all of which run on the plain JVM (via Robolectric where Android framework classes are touched) — no emulator or device needed. That's deliberate: as much of the protocol logic as possible is verified this way before ever touching real hardware, since a car doesn't give you a debugger.

What's covered:

  • FrameHeaderTest / FrameSizeTest — wire-format encode/decode round-trips.
  • UsbBulkTransportTest — full message read/write round-trips, including encryption (via a fake symmetric cryptor) and fragmentation (FIRST/MIDDLE/LAST, including an exact-frame-boundary case).
  • ControlChannelTest — drives a real client-mode SSLEngine standing in for the head unit through an actual TLS 1.3 handshake against ControlChannel, verifying version negotiation, the handshake completing, and AUTH_COMPLETE + SERVICE_DISCOVERY_REQUEST following it.
  • MediaAudioChannelTest — the audio channel's setup/start/stop protocol, and that a real picked audio source (not just the fallback test tone) is what actually streams.

Test reports: app/build/reports/tests/testDebugUnitTest/index.html.

Installing on a device

adb install app/build/outputs/apk/debug/app-debug.apk

Needs a phone with USB debugging enabled, connected via USB to whatever machine is running adb. This is separate from — and not to be confused with — plugging the same phone into a car to test the actual Android Auto connection; those are two different USB connections at two different times (install via computer, then unplug and plug into the car to test).

A note on trusting the tests

Passing tests here mean the code is internally consistent and matches our best understanding of the protocol from aasdk/OpenAuto source and official/leaked documentation. They do not mean a real head unit will accept the connection — see Project Status for what's still unverified against actual hardware.