[Android Head-Units] realzoulou:
I came across this thread by chance when I was searching for info why in DAB-Z the SWC prev/next buttons stopped working for me after I changed my HU to a Flyaudio Intel Airmont based device. I digged quite deep and found out strange things that I wanted to share with you.

Not sure however, if this info here is of a generic type, or if it is only applicable to the firmware that I have on my unit.

So, why do 3rd player apps not react on steering wheel controls SWC prev and next, although the preinstalled FM and Music app work fine ?!?

1) Battery Optimization in Android >= 8.0 (#1)

In Android 8.0, Google added some battery optimization techniques. One out of these "improvements" is that system-generated implicit broadcast intents are delivered to apps only when the user has added an exception for this specific app. More info can be found here.

The system app "com.syu.ms" is such a system app and translates the CAN bus (or discretely wired) SWC code received from the MCU to the Android MEDIA_BUTTON intent KeyEvent code. Note: SYU based stock FM, Music, ... apps are handled differently (not using broadcasts at all) and therefore are not affected and work fine.

In a system-wide logcat this is visible as

Background execution not allowed: receiving Intent { act=android.intent.action.MEDIA_BUTTON flg=0x10 (has extras) } to com.zoulou.dab/android.support.v4.media.session.MediaButtonReceiver

Workaround

:

Most Android systems (except my Flyaudio one, damn) allow to define an exception for an app in Settings->Apps->(Select any arbitrary app)->Battery->Battery optimization. Then use drop down to select "All apps". Then select the app that you want to define the exception for. Another dialog will appear to select "Optimize" or "Don't optimize". Choose "Don't optimize". I also noticed that the naming and the way to this setting may vary from device to device and Android version.

After step 1) you might still find the app of your choice not responding to SWC controls.

2) Another Google Android 8.0 battery optimization (#2), specifically "context-registered receivers"

Before Android 8, an app developer could simply add the MEDIA_BUTTON intent to the AndroidManifest.xml "receiver" section and this enabled the app to receive this type of broadcast intents.

With Android 8.0 (and higher) this is no longer the case for "implicit" intents = those that are broadcasted with "sendBroadcast" API.

com.syu.ms uses sendBroadcast API to pass the MEDIA_BUTTON intent and so Android again does not delivery the MEDIA_BUTTON intent to the app.

Workaround

:

Ask the app developer for an updated app. No chance to fix this on your own, except you know how to patch smali code of this app.

Some users report that SWC prev/next reaction in the 3rd party app is swapped. You press NEXT, but the player app goes BACK (and vice versa).

[MENTION=2946605]IG_Vasilich[/MENTION]: I found the root cause for this, too, again in com.syu.ms. I strongly believe that the first line of code below is buggy. It should compare against 0, not 1. The property is usually not set at all, and so the comparison finds 0 != 1 and selects the else path. And so NEXT turns into PREV !!

if (ToolkitApp.getSystemProperty("persist.fyt.canbus_key_next", 0) == 1) {
canbusKeyNext(action);
return;
} else {
canbusKeyPrev(action);
return;
}