How to hack Android Auto to display custom content | Opensource.com

How to hack Android Auto to display custom content

Reimplement the Android Auto protocol to cast movies and additional applications on automotive head unit displays.

Driver's hands on the steering wheel of a car
Image credits : 

Photo by Erik Witsoe on Unsplash

x

Subscribe now

Get the highlights in your inbox every week.

Google's Android Auto application casts content from a smartphone to a car's head unit display. Officially, that content includes navigation (e.g., Google Maps and Waze), media players (e.g., VLC, Spotify), and messaging apps. The application is useful, but it would be even better if you could show a film on your head unit's display or use it as an interface to a custom onboard computer that manages multiple cameras, GPS, and so on.

This article will demonstrate Android Auto Client-Server (AACS), an early-stage application I'm developing to do these tasks.

How to hack Android Auto

There are two approaches for displaying other content on the head unit's screen: you can hack the Android Auto application, or you can reimplement the protocol from scratch. The first approach seems simpler but is somewhat risky: it may use Google's intellectual property and therefore be subject to legal action, and it may break with new Android Auto versions (especially since Google actively works to make that happen).

Therefore, reimplementing the protocol from scratch is the safer approach for the long run. One such implementation of the Android Auto protocol is OpenAuto, a head unit emulator by Michal Szwaj. However, this article utilizes the other side of the communication interface—the mobile device side of the protocol.

Android Auto Client-Server (AACS)

AACS currently consists of three core modules and one external module that run on ODROID N2, an ARM-based single-board computer:

  1. AAServer is an implementation of Android Auto Protocol (AAP) that communicates with the car's head unit. It handles encrypted AAP-over-USB communication and exposes it over a Unix socket for use by other modules.
  2. AAClient is an AAP implementation that communicates with a phone that may be connected to ODROID N2 and forwards all traffic to AAServer. By using AAClient, you do not need to choose whether to connect your mobile or ODROID N2—you can connect both simultaneously.
  3. AAVideoSink is a GStreamer sink that sends video from a GStreamer Gst pipeline to AAServer. Combined with other Gst elements (such as ximagesrc), it allows you to cast any application to your car's head unit.
  4. GetEvents is an application that connects to AAServer and forwards touch events from the car's head unit touch screen to the selected application window using X Server's XTest extension.

Try it out

To try AACS, you need the following hardware:

  1. An ODROID N2 with power supply
  2. An SD card (16GB should be enough to start; 32GB is recommended) with a USB SD card reader
  3. A USB Type-A to Micro USB cable
  4. A cigarette lighter plug to 2.1/5.5mm plug cable (to power the ODROID in the car)
  5. A GPS USB receiver (I've tested the u-blox 7); this is not required to test AACS, but it's useful

Once you have the hardware:

  1. Grab the latest AACS release.
  2. Concatenate the files, unpack them, and copy the results to an SD card:
    $ cat \
    aacs_image_20201029.img.xz.aa \
    aacs_image_20201029.img.xz.ab \
    aacs_image_20201029.img.xz.ac \
    aacs_image_20201029.img.xz.ad | \
    unxz | dd of=/dev/sdX bs=1M
  3. Move the card to the ODROID N2. Make sure the ODROID is connected to the web by Ethernet and turn it on.
  4. Get the ODROID's IP address and connect to it through Virtual Network Computing. The password is odroid.
  5. You should see the OsmAnd start screen. Download appropriate maps and other files, then turn off the ODROID.
  6. Go to your car, change the car's date to somewhere between July 3, 2014, and April 6, 2020 (these are the certificate validity dates).
  7. Connect USB and power to your ODROID. Try connecting to the ODROID from the head unit with Android Auto. After roughly 30 seconds, you will see a control video on the head unit, and a few minutes more, you will see navigation (OsmAnd).

Development status

Please be aware that this is not production-quality software yet. It is closer to a proof of concept, so I would like to invite others to participate in its development.

Currently, the software has the following limitations:

  1. It was tested on only one head unit—an LG unit in a 2019 SEAT Ateca—and should be tested AACS with other head units.
  2. The only application that is available out of the box is OsmAnd running on Anbox. It would be great to have other applications available on AACS for things such as managing cameras (recording, road sign recognition), phone call support (multiple phones connected over Bluetooth), paid parking zone applications, etc.
  3. It was tested only on ODROID N2. If you port it to other single-board computers, please submit patches.
  4. It supports only input and video channels. It would be great to have support for audio, voice input, and other channels.

If the project looks interesting to you, join me on Github to submit ideas, patches, report issues, or help promote the project.

A person looking at a phone

Take as many shots as you want; gphoto2 makes transferring photos from your device to your Linux computer quick and easy.
collection of hardware on blue backround

The Linux command line on iOS? Yes, you can.

Topics

About the author

Tomasz Grobelny -