Skip to content

Implement support for Android Auto - #3993

Open
maniac103 wants to merge 5 commits into
openhab:mainfrom
maniac103:android-auto
Open

Implement support for Android Auto#3993
maniac103 wants to merge 5 commits into
openhab:mainfrom
maniac103:android-auto

Conversation

@maniac103

Copy link
Copy Markdown
Contributor

Fixes #3041

Fixes openhab#3041

Signed-off-by: Danny Baumann <dannybaumann@web.de>
@maniac103

maniac103 commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

Implementation comments:

  • Min SDK version bump is needed due to some transient dependency (probably pulled in by lifecycle-service) requiring it: Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [androidx.savedstate:savedstate-ktx:1.4.0]
  • AA uses the primary connection
  • Implemented are the following sitemap widgets: text, switch, switch-with-mappings, rollershutter, player, selection
  • Maximum page link nesting depth is 5, including the additional screen for action selection (limitation of AA)
  • Maximum number of sitemap widgets (== length of widget list) may or may not be limited by AA, exact limitation value can differ between cars and/or AA version
  • The sitemap to be used is selected on first startup; for changing the selection one needs to clear the primary server's default sitemap

I'm open for improvement suggestions about

  • default sitemap selection
  • ways of conveying the AA limitations towards the user

I've also thought about using GridTemplate instead of ListTemplate, but there's a couple of drawbacks:

  • grid items don't support inline switches
  • grid items kinda are based on images, but server side icons are not guaranteed to be present (also handling is complicated, as we'd need to pre-fetch them)
  • (widget count limit doesn't seem to be larger for grids either)

Once this is accepted, we probably need a release on the beta track in Play Store, since sideloaded apps don't appear in the AA launcher.

@maniac103

maniac103 commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

Open issue I don't have a good idea for yet: Loading a different sitemap (e.g. after a server change) also counts against the 5 step limit documented here. This means that after moving back and forth a few times, the app will consume more than 5 steps and crash. This problem is worsened by sitemap selection screen (which counts as a separate step each time), but even if we'd do the sitemap selection on the phone the problem is there and just takes a few toggles more to appear.
I have not yet found a way to restart the step counter.

One option to remedy this may be to not listen for server changes, so that after changing servers one needs to reconnect to AA to reflect the change in the AA app. Not sure if this is acceptable?

maniac103 added 2 commits May 7, 2026 10:47
Signed-off-by: Danny Baumann <dannybaumann@web.de>
Signed-off-by: Danny Baumann <dannybaumann@web.de>
@robnielsen

Copy link
Copy Markdown
Contributor

Loading a different sitemap (e.g. after a server change) also counts against the 5 step limit documented here.

Maybe disable loading a different sitemap when moving? https://source.android.com/docs/automotive/driver_distraction/consume#DrivingState

@maniac103

Copy link
Copy Markdown
Contributor Author

Maybe disable loading a different sitemap when moving? https://source.android.com/docs/automotive/driver_distraction/consume#DrivingState

From my understanding,

  • that API is only available for AAOS, not for AA
  • the 5 step limit takes effect no matter whether the car is parked or not, except
  • if adaptive task limits is active, in which case more than 5 steps may be possible when parked, but
  • whether it's enabled is under OEM control, and app behavior on > 5 steps differs hugely between it being enabled or not (delayed display vs. crash)

Given all of those, I think we need to design our UX for the 5 step limit, no matter if parked or not.

@mueller-ma

Copy link
Copy Markdown
Member

We could:

  • Sitemap selections on phone
  • Disallow any sub-pages
  • Don't refresh sitemaps when the configuration is changed on the server

That way we shouldn't hit the limit, but no sub-pages might be an issue for some people.

@maniac103

Copy link
Copy Markdown
Contributor Author

We could:
Sitemap selections on phone

Makes sense - any UI recommendations? The current flow follows what we're doing for the app side, and I don't have a good idea yet that doesn't involve some kind of popup.

Disallow any sub-pages

Doesn't help much, see last point.

Don't refresh sitemaps when the configuration is changed on the server

I think there's a misunderstanding here. My Loading a different sitemap (e.g. after a server change) doesn't refer to server side changes, but to changes in the (connection to the) server. That is, having multiple servers configured in the app and switching between them. We could allow selecting a specific server for AA in the app settings (instead of using the primary server), but that'd be yet another special case in ConnectionFactory, but maybe that's manageable (adding a method to 'ask' ConnectionFactory for a Connection for a specific ServerConfiguration)?

@R0Wi

R0Wi commented Jul 20, 2026

Copy link
Copy Markdown

@maniac103 this is an awesome feature, thank you! I would be highly interested in doing some beta testing and providing feedback. May I kindly ask if it would be possible to provide some debug APK or would I have to build it myself?

@maniac103

Copy link
Copy Markdown
Contributor Author

May I kindly ask if it would be possible to provide some debug APK or would I have to build it myself?

Neither would work for getting it running in your car. For that it needs to be distributed in the Play Store. We can totally do that, I guess (a beta release, that is), but I don't think it makes a lot of sense as long as there's a high probability of crashing whenever the 5 step limit is hit (see above). We'll need some good idea to solve that one.

@rkoshak

rkoshak commented Jul 20, 2026

Copy link
Copy Markdown

One behavior I've noticed in several AA apps I've used is if you interact with the app a bunch of times (e.g. searching for a playlist in YT Music) it eventually pops up a pause preventing further interactions for a time before letting you continue interacting with the screen. I don't know for sure, but this feels realted to that 5 step limit. So maybe something similar would work here.

@mhilbush

Copy link
Copy Markdown

it eventually pops up a pause preventing further interactions for a time before letting you continue interacting with the screen.

I too have seen this after interacting with an app quite a lot. I forget which app it was... might've been Waze, or possibly one of the music apps, Pandora or Spotify.

I don't have many suggestions. One thought was to have a configuration where you can specify the sitemap that you want to use for AA. I expect the sitemap I use in AA will be a lot smaller (and different) than my other sitemaps. Of course if an AA-specific sitemap is not specified it would allow sitemap selection the way it does now.

Signed-off-by: Danny Baumann <dannybaumann@web.de>
Signed-off-by: Danny Baumann <dannybaumann@web.de>
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.

Openhab Android app compatability with AndroidAuto

6 participants