This repository provides everything that is needed to add Android Auto support (with media apps support) to GrapheneOS (Android 13). However, the patch itself does not rely on GrapheneOS, so it should be possible to make this work on a different OS with slight modifications.
The provided patch includes compatibility changes and makes it possible to e.g. watch Netflix on your car screen with the help of Screen2Auto while restricting it's permissions when not connected to a head unit. Furthermore the repo includes optional custom built Google Search App and Google Speech Services stubs.
To make this run, you need to build your own rom. If you are instead looking for a simpler method to run Android Auto (that involves rooting your device), have a look at aa4mg
- Set up your build environment according to the official GrapheneOS build instructions, sync sources (the patch is based on this release) and proprietary files.
- clone this repo into vendor/android-auto:
cd vendor
git clone https://github.com/sn-00-x/android-auto.git
- Apply the patch in root directory:
cd ..
patch -p1 < vendor/android-auto/frameworks-base.patch
- To use the Google Search App and Google Speech Services stubs, add the following line
device/google/$device/device-$device.mk
:
PRODUCT_PACKAGES += gappsstub speechservicestub
- If you want to use Screen2Auto, you need to set it's package name and the sha256 hash of your signing cert in
frameworks/base/core/java/android/app/compat/sn00x/AndroidAutoHelper.java
( PACKAGE_SCREEN2AUTO and SIGNATURES_SCREEN2AUTO in line 54ff). See Install Screen2Auto section below. - To be able to play content protected by DRM, such as Netflix, the device must be missing liboemcrypto.so. Therefor search and comment out the following section in
vendor/google_devices/$device/proprietary/Android.bp
/*
cc_prebuilt_library_shared {
name: "liboemcrypto",
owner: "google_devices",
target: { android_arm64: { srcs: [ "vendor/lib64/liboemcrypto.so" ] } },
compile_multilib: "64",
check_elf_files: false,
prefer: true,
strip: { none: true },
soc_specific: true,
}
*/
Note that without liboemcrypto.so Widevine DRM will fall back to using L3 and Netflix will only stream in SD, but at least can be mirrored to the head unit.
- Continue the build process described in GrapheneOS build instructions
- Be sure to get Android Auto and Maps with correct signatures. When downloading directly from PlayStore (without having preinstalled stubs on your system), the apps may be provided with other signatures. However, those may checked and rejected when connecting to a car. Android Auto must be signed with eeb557fc154afc0d8eec621bdc7ea950 / 9ca91f9e704d630ef67a23f52bf1577a92b9ca5d. Get it e.g. here Google Maps must be signed with 38918a453d07199354f8b19af05ec6562ced5788 / f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83. Get it e.g. here
- Go to phone settings and grant "nearby devices" permission to Android Auto
- Connect to car, follow instructions
- In case your device says there is no app to handle the connection, reboot and try again.
- When an error regarding restricted settings is shown, go to phone settings -> Apps -> Android Auto -> click the three dots in the upper right corner -> Allow restricted settings
- Continue setting up android auto
- In case you run in any problems, replug device
Screen2Auto 3.7 can be obtained from https://inceptive.ru/projects/s2a/download
However Google has blacklisted Screen2Auto (after all it circumvents security restrictions of Android Auto). So you need to find a way to rename the package and sign it with your own cert. I will neither provide a renamed package nor provide any information on how to do this. I don't want Google to blacklist the version I use or change the way they blacklist apps.
Assuming you have a renamed version of Screen2Auto, install it and only grant "System settings recording" when asked for permissions. Screen2Auto needs this permission to modify system settings to be able to e.g. rotate the screen. Leave the other permissions untouched. The patch in this repo handles granting "display over other apps" permission to Screen2Auto only while connected to a head unit.
Make the following changes in Screen2Auto:
- Touch button settings -> Set Double tab to "Launcher"
- Other settings -> Enable "Alternative touch" (but click cancel when asked for enabling Accessibility Service)
If touch does not work for you correctly, try to select another profile under Other settings -> Alternative touch
sources for custom built stubs with build instructions for each of the stubs:
https://github.com/SolidHal/SpeechServices-Package-Spoof
https://github.com/SolidHal/Gapp-Package-Spoof
big thanks to everyone involved in the thread here microg/GmsCore#897