gartnera / headunit

Headunit for Android Auto
GNU Affero General Public License v3.0
339 stars 89 forks source link

Android Auto 3's Data-over-WiFi support #121

Closed jspinella closed 5 years ago

jspinella commented 6 years ago

The Android Auto 3.0 APK is available for download at AndroidPolice.com and supposedly includes the code required for WiFi support.

Apparently most cars don't have WiFi built-in like ours do! How exciting would it be for Mazda's unofficial support for AA be better than the competition's official support?

Happy to help in any way that I can (although I am a web developer w/C# mostly, not much experience with C).

hansaya commented 6 years ago

yes, this looks promising.

ensiform commented 6 years ago

https://9to5google.com/2018/04/13/android-auto-wireless-live-pixel-neuxs/

Feature is live if you have a Google phone with AA 3.1 app. Hopefully it can work with our Mazdas.

blackdetail commented 6 years ago

It looks like sombody figured it out. Sadly, they do not want to share it. https://youtu.be/Vgk3HKjkLmE

viktorgino commented 6 years ago

@blackdetail in the video they use developer mode, its been there for sometime, this new feature seems to be something different.

blackdetail commented 6 years ago

@viktorgino could you please tell me how to connect to AA head unit wirelessly like they did in the video? From what I read on reddit, Google official method is different from what they did in the video. But their method (in tue video) is good enough for me.

viktorgino commented 6 years ago

@blackdetail not sure how to do it from the Mazda GUI, I use it with a different GUI, but on the phone you need to enable developer mode and start AA head unit server:

  1. In the Android Auto app, tap the Hamburger menu.
  2. Tap About.
  3. Tap the About Android Auto header 10 times, until a toast appears that says "Developer mode enabled".
  4. Now you can access developer mode by selecting the overflow menu dots on the top right of the handheld screen. This step is only required the first time you run the companion app.
  5. If the server is not already running, select Start head unit server from the Android Auto menu.
  6. On the device, a foreground service appears in the notification area.

Then I assume you need to change some settings on the head unit in the car so it tries to connect through WiFi

blackdetail commented 6 years ago

@viktorgino Thanks. I had developer mode enabled already. What surprised me is that they used Trezdog's AA (specifically version 1.08). Somehow they have successfully implemented TCP transport in head unit AA.

This happens after OpenAuto implemented TCP transport in their project.

viktorgino commented 6 years ago

@blackdetail the TCP implementation has been there since the very beggining, but its more for developement than every day use, because you have to start the HU server on the phone every time you want to connect. I've personally been using since I've discovered the original project: https://github.com/mikereidis/headunit

aidandj commented 6 years ago

@viktorgino. How do you configure the Mazda head unit to use TCP?

viktorgino commented 6 years ago

@aidandj i'm not sure. I dont actually have a mazda, I use parts of this project for a more universal solution. I use a completely different GUI where there is an option to start it with TCP manually.

aidandj commented 6 years ago

Is that project open source?

viktorgino commented 6 years ago

@aidandj yes: https://github.com/viktorgino/headunit-desktop

Trevelopment commented 6 years ago

We will never be able to use the new "wireless" feature in our Mazdas where you just connect with WiFi without being on developer mode because they are not WiFi Certified. https://www.androidauthority.com/android-auto-wireless-855344/amp/

aidandj commented 6 years ago

Can the current setup be used with developer mode over TCP?

ensiform commented 6 years ago

@Trevelopment I'm guessing that means Wi-Fi Direct is a necessary component. Which our cars probably do not have.

Trevelopment commented 6 years ago

@ensiform its not that, it will only work with a wifi certified device

jspinella commented 6 years ago

I know for my 2017, the WiFi acts as an AP, rather than a client. So my phone would connect to it and expect Internet. Apparently earlier 3rd-gen Mazdas' WiFi is client mode, so you configure it to connect to, say, your phone for Internet.

As Tre said, I believe not all WiFi devices are capable of WiFi Direct, which is probably what AA over WiFi uses.

aidandj commented 6 years ago

https://www.wi-fi.org/product-finder-results?keywords=Mazda&op=Search&form_build_id=form-rZNvWF4souLgIERnO18c1ZdW_xQ0zavuYKO8slNwDGk&form_id=wifi_cert_api_simple_search_form

Quite a few Mazda products certified.

Trevelopment commented 6 years ago

https://www.wi-fi.org/product-finder-results?sort_by=default&sort_order=desc&keywords=cmu is this it right here? that was a good find @aidandj @jspinella you can use it as both if you turn off the AP and turn on the regular wifi you can connect to wit with your phone hotspot but (at least in US models) the wifi receiver is really weak so it is tough to get to connect and stay connected

blackdetail commented 6 years ago

I think Google is referring to a different kind of certification. This is one comment from early user:

"Possibly, however I'm noticing the wifi connection often doesn't show up in my wifi list, nor does it show connected while I'm using it. I'm wondering if the wifi for android auto is hidden by design as it's not a true access point. "

Here: https://www.reddit.com/r/AndroidAuto/comments/8bmf4h/wireless_android_auto_working_kenwood_dmx905s/

I think it is more like the situation with Chromecast. Eventhough my phone is connected to a different wifi and the Chromecast cast device is not connecting to any network at all. The Home app can still detect it and allow me to configure it.

I think there are two approaches like @borconi said here:

https://github.com/f1xpl/aasdk/issues/1#issuecomment-370330033

And our best option might be using TCP connection with Head Unit Server in developer mode.

ensiform commented 6 years ago

@jspinella I am curious how you make the car be an access point? I enabled the WiFi on the car but that is only so the car can get internet as far as I saw, and had troubles connecting to a network at that. Also, wouldn't having phone connect in that way, remove ability for phone to connect to data or another WiFi?

mishan commented 6 years ago

My Mazda 3 runs in AP mode. This may be configurable (it's currently set up in hostapd.conf) Usually wifi devices that can run in AP mode are the most versatile and can run in other modes. To do wifi direct, you need wpa_supplicant p2p mode

https://unix.stackexchange.com/questions/379178/wpa-supplicant-wifi-direct-connection-between-linux-and-android https://w1.fi/wpa_supplicant/devel/p2p.html

You are right -- when I use my car in access point mode (I have not tried other modes but I think it's possible) and connect my phone to it, I lose internet access. Android has some aggressive connection switching behavior you can enable, but don't really want that.

ensiform commented 6 years ago

So I wonder then, the timing with Google releasing the update for wireless and Mazda finally supporting AA/ACP means that the new models + the upgrade option for older will have the hardware changes necessary to make wireless work? Or perhaps upgraded usb ports so we can at least charge and use.

Trevelopment commented 6 years ago

HA!! Don't you know that Mazda disabled Wifi Support for the whole North American region?.. there is no way they are going to make Wifi available in NA ever again even with these new developments and its cute that you still think Mazda is still going to release an official AA. If anything they will release probably FW v60 which will be extremely locked down, no wifi support, and maybe AA or CP with the same USB support we have now if you believe in miracles. I doubt they will allow AA to make its own access point either because that could leave the door open for exploitation of the AP connection through your phone (especially those with rooted devices), that is my guess on the wall they hit while developing AA.

ensiform commented 6 years ago

I wasn't holding my breath, just a thought is all. Chances are you are probably right, they may never advance it further. Will stick with what I have for now. Not sure it's even worth upgrading from v55 right now either.

blackdetail commented 6 years ago

I am still being obsessed with using Android Auto via Wifi on Mazda CMU. It might end up that wireless connection is too slow to be usable but I still want to try.

I did the following:

  1. Installed Wifi ADB on my phone and turn it on.
  2. Turn hotspot on my phone (192.168.43.1) and connect Mazdu headunit (192.168.43.2) to this hotspot.
  3. Start head unit server in AA app on my phone
  4. SSH into Mazda CMU and run the following commands: (1) adb connect 192.168.43.1:5555 (2) adb forward tcp:5277 tcp:5277
  5. Open Android Auto on Mazda headunit. And, nothing happened. Do you have any suggestions?

I want to add something more after all that. If I connect my phone to Mazda, Android Auto will work normally. While I am connect my phone and headunit using USB, if I turn Wifi ADB off, Android Auto on headunit will be disconnected also (USB cable is still connected). I have to disconnect and reconnect USB cable to make Android Auto works again.

Any suggestions on how to make it work via wifi on Mazda using developer mode?

ghost commented 6 years ago

saw new version today, aa-1.09-wifi? anyone tested?

also i found some thai speaking site with aa wifi? https://mzdonline.wordpress.com/2018/04/27/autorun-headunit-wireless/

since no one is replying yet let me sum up my experience

  1. AA over Wifi is usable but no audio over wifi
  2. wifi + bluetooth didn't work for AA over Wifi, it work at first but nope, you need to restart your phone because your phone says android auto is running
  3. you need to disable bluetooth before connecting wifi to your phone or else wpa2 wont connect, i think this is a well know issue
Trevelopment commented 6 years ago

@stalkerandrew That site you found is by a very talented dev and he is the one that added wifi support but it is not implemented in this repo so this is not necessarily the place for this discussion but whatever here is my experience using a Google Pixel 2: If I get WiFi to connect and I start AA the connection will break within 5 minutes every time and will not reconnect so it is unusable this is after 2 weeks of trying every day, twice a day I never got it to connect for more than 5 minutes.

Trevelopment commented 6 years ago

But that is only in my car because it is the North America version of the CMU with my test CMU that is a European version the connection works just fine but I can't really test anything driving with that because its mounted on a board and also speaker connection doesn't work so I can't do much testing on AA with it except for knowing the WiFi connection works. It just pisses me off that the North American version of the CMU has such a terrible WiFi receiver I just sat here trying to connect and I finally did got AA running went to maps and it lagged out. Sigh...

ghost commented 6 years ago

It just pisses me off that the North American version of the CMU has such a terrible WiFi receiver

I'm glad that's not just me.. I had noticed the same thing. No matter what I did I couldn't get a connection to my phone hotspot, wifi network, or laptop. I have a feeling they intentionally disabled it for the US market when they disabled wifi functionality.. I don't suppose anyone has cracked one of these open to look at the antenna? Maybe it's just not connected?

mishan commented 6 years ago

Hm, I wonder if it's actually hardware or regulatory domain settings. Worth looking at. The EU, for example, supports more channels. Most wifi hardware supports either with a software bit to control which regulatory domain to follow.

On Wed, May 30, 2018 at 10:04:48AM -0700, mkeith83 wrote:

 It just pisses me off that the North American version of the CMU has
 such a terrible WiFi receiver
 I'm glad that's not just me.. I had noticed the same thing. No matter
 what I did I couldn't get a connection to my phone hotspot, wifi
 network, or laptop. I have a feeling they intentionally disabled it for
 the US market when they disabled wifi functionality.. I don't suppose
 anyone has cracked one of these open to look at the antenna? Maybe it's
 just not connected?

— You are receiving this because you commented. Reply to this email directly, [1]view it on GitHub, or [2]mute the thread.

References

Visible links

  1. https://github.com/gartnera/headunit/issues/121#issuecomment-393238825
  2. https://github.com/notifications/unsubscribe-auth/AAwIYWn2_DcmwC4ve53PgzqOAngZEaSMks5t3tEwgaJpZM4SJhFc

-- Misha Nasledov misha@nasledov.com GPG: A063 B99A 2BD3 2D48 F2D7 8E68 0F27 4D21 948F 8F06

jspinella commented 6 years ago

@ensiform I just followed the instructions in the AIO desktop app... I had to change a config file that AIO installs to the car (the file contains the car's SSID and password and it won't be enabled without that info in the config). I didn't realize it could act as a client. I don't recall seeing WiFi in the settings where Bluetooth is (in the car infotainment settings), but I could be mistaken.

@mkeith83 I know with earlier models (like 2014-2015), CMUs had interference issues because EMI shielding was missing from some of the components (presumably the CPU, maybe some other chips on the board). With this new WiFi weak signal issue, it sounds more like the antenna isn't connected/doesn't exist. I don't know that anyone has taken their dash apart to confirm. It's likely that the antenna is missing, rather than "there, but not connected". WiFi antennas are cheap, though. Like $2 from China.

mishan commented 6 years ago

That sounds fixable.

On Wed, May 30, 2018 at 10:47:47AM -0700, James Spinella wrote:

[1]@ensiform I just followed the instructions in the AIO desktop app... I had to change a config file that AIO installs to the car (the file contains the car's SSID and password and it won't be enabled without that info in the config). I didn't realize it could act as a client. I don't recall seeing WiFi in the settings where Bluetooth is (in the car infotainment settings), but I could be mistaken.

[2]@mkeith83 I know with earlier models (like 2014-2015), CMUs had interference issues because EMI shielding was missing from some of the components (presumably the CPU, maybe some other chips on the board). With this new WiFi weak signal issue, it sounds more like the antenna isn't connected/doesn't exist. I don't know that anyone has taken their dash apart to confirm. It's likely that the antenna is missing, rather than "there, but not connected".

— You are receiving this because you commented. Reply to this email directly, [3]view it on GitHub, or [4]mute the thread.

References

Visible links

  1. https://github.com/ensiform
  2. https://github.com/mkeith83
  3. https://github.com/gartnera/headunit/issues/121#issuecomment-393255382
  4. https://github.com/notifications/unsubscribe-auth/AAwIYY-tduCuZaVqXS0edDUtf24_xDLsks5t3ttDgaJpZM4SJhFc

-- Misha Nasledov misha@nasledov.com GPG: A063 B99A 2BD3 2D48 F2D7 8E68 0F27 4D21 948F 8F06

blackdetail commented 5 years ago

I am not sure if anybody still working on it. But I want to share something interesting. We all know that AA via WiFi as we are using it (via Dev Mode) gets sluggish if we play music. I always thought that it has something to do with not enough WiFi banwidth. Today, while listening to music using AA via WiFi for like half an hour. Naturally, head unit became super sluggish. I pressed "Exit Car Mode". And AA on head unit turned off and on again in just 2-3 seconds (just like when we unplug and replug USB cable). And guess what, head unit become responsive again. It will get sluggish after listening to music again of course. But I want to say is, the sluggishness might not from not enough WiFi bandwith.

Trevelopment commented 5 years ago

It's not the bandwidth that is the problem it is the electromagnetic interference which can fluctuate greatly especially if you turn it off and on like that.

GrayHatter commented 5 years ago

probably a memory leak in the audio playing code... I've yet to completely figure out how the system plays audio... It's a mess that's for sure. But from poking around in other areas, it does clean up after it self through it's init/raze functions. I suspect un/replugging makes it do it's clean up.

blackdetail commented 5 years ago

Last few day, I tried wifi via dev mode again. The old usual stuff, it gets sluggish after a few minutes listening to music on Spotify. This time, I pressed the pause icon. After a few seconds, the music stopped and the system became responsive again. I hope my info help in some way. Is there anyway to reduce audio/music bitrate in Android Auto?