[Android Head-Units] gustden:
THIS MOD IS ONLY FOR THE JOYING / 2GB / Sofia models - It is stable and working well .

Please use V4.1 if you have not upgraded to Marshmallow!

History:

V6.4: Update using code base 9/1/2017 Joying Update ( Android 6.0 ) (updated Oct 7)

Changes:

- Meida keys - Removed support for media keys customization. No longer sent to launcher.sh due to slow response time.

- Media keys - Modified code to only send media keys to the active media player.

- Changed reboot timer from 1/2 second to 2 seconds. Should help eliminate random reboots when coming from standby.

- Updated player_app.txt and navi_app.txt to latest from [MENTION=2550900]surfer63[/MENTION]

- Fixed issue with button 33 not working

- Files included:

- V6.4-Sofia-1-C9-Server_NOKILL.zip - Original file with task killer removed

- V6.4-Sofia-1-C9-Server_NOKILL_GVS.zip - Task killer removed, Google Voice Search on 'SRC' key

- V6.4-Custom_Keys-Mods.zip - Complete key modifications ( requires launcher.sh - description below )

V6.3: Update using code base 5/25/2017 Joying Update ( Android 6.0 )

- Files included:

- V6.3-Sofia-1-C9-Server_NOKILL.zip - Original file with task killer removed

- V6.3-Sofia-1-C9-Server_NOKILL_GVS.zip - Task killer removed, Google Voice Search on 'SRC' key

- V6.3-Custom_Keys-Mods.zip - Complete key modifications ( requires launcher.sh - description below )

V6.2: Updated using code base 5/8/2017 Joying Update ( Android 6.0 )

- Added fix for google maps voice output on radio from [MENTION=7329495]xdamember2[/MENTION]

V6.1: Updated code base using 5/8/2017 Joying Update ( Android 6.0 )

V6: Updated code base using 4/27/2017 Joying Update ( Android 6.0 )

Android 5.1.1

V4.1 - Fixed issue with "Google Voice Search" not lowering music volume (3/23/2017) - Android 5.1.1

V4: Updated code base using 3/14/2017 Joying ROM

Changes/Added support for:

- MEDIA KEY - hard key on unit

- BAND KEY - hard key on unit

- ACC_ON - Triggers on key on

- Minor changes to example shell scripts to add cases for MEDIA, BAND, ACC_ON ( launcher.sh )

- FIX/UPDATE - Updated list of NAVI APPS in assets/property/navi_app.txt ( allows more applications to speak during radio )

- Many thanks to [MENTION=2550900]surfer63[/MENTION] for navi app radio fix and windows install script

V3 - Rebuilt using latest Joying ROM dated 2/22/2017 - Includes V1 & V2 steering wheel / key modifications.

Changes/Added support for:

- ACC_OFF - Added support for running actions at key off (case 98 )

- Added case 98 to example scripts to perform "PAUSE" - to stop current music player when key off

V2 Removed killAppWhenSleep(); - Eliminates tasks being killed on sleep

Added support for additional keys / Minor changes to example shell script ( launcher.sh )

- HANG - steering wheel softkey

- DVD - hard key on unit (if available)

- EJECT- hard key on unit (if available)

- CALL/BT softkey - Fixed issue where key would not respond after call disconnect.

V1 Initial version

There is little risk with this mod, but please understand what you are doing, and make backup of the original apk file ( in case you want to revert back ). The installer script does make a backup, but will overwrite the backup if installed more than once.

I also added a simpler "launcher_simple.sh" into the zip, which only changes the functionality of the Source (rotates radio, pandora, spotify ) and Call buttons ( google voice command ). These scripts are working examples of what can be done. If you want the simpler version, just rename "launcher_simple.sh" to "launcher.sh" before installing.

---------------------- Original Post -----------------

I have spent quite a bit of time working on being able to customize the steering wheel keys of my Joying 2GB headunit (JY-UL135N2 / 2GB / Sofia unit). I have made some good progress and thought I would share what I have done so far.

The system package /system/app/Sofia-1-C9-Server-V1.0/Sofia-1-C9-Server-V1.0.apk has been modified to intercept the keys sent by the MCU, and thus able to change the behavior of the key presses. The keys listed below are supported, and will launch a "shell" process, so any action that can be done by the command line can be performed. If your not familiar with the Android command line, you might be surprised how powerful it is. As a side note, this works very fast and efficient. From my testing the overhead of the system call and shell script is almost non-existent, and key presses are registered with no delay. In other words, it is working very nicely.

In addition to the steering wheel button mods, also provided is the ability to launch a command or series of commands when a RESUME is received.

Included is my shell script (example) that can be used as a model for your own customization. The example script included performs the following actions:

CALL/BT PHONE(27) - One press is HOME, 2 presses is BACK, 3 presses brings up Google Voice Commands

MODE/SRC(37) - Rotates through music apps: Radio, Pandora, Spotify, Stock Music App - If it has been longer than 1 minute since the last press it will return you to the last selected music app with first press, then continue with the rotation. ( I'm working on a more intelligent way of doing this, that looks at the process list and will post soon)

NAVI(9) - One press is Torque, 2 presses is google maps

PAUSE/PLAY(85*),NEXT(87*), PREVIOUS(88*), FASTBACK(89*), FASTFWD(90*),HOME(3), BACK(4) - Currently set to perform stock functions. They ARE passed to script so they can be assigned other functions if wanted.

ACC_ON(97) - Executes at ignition switch on. Sample script has a 'play' here to restart music player that was paused at key off.

ACC_OFF(98) - Executes at ignition switch off. I suggest you assign "pause" on this case, to stop current music player. Resolves issue of music player advancing for several minutes after key is turned off.

RESUME(99) - Executes on system resume.

Please note the media control keys marked with a (*) are hardcoded to specific functions within the stock Joying applications. They are only passed through to the shell script when you are NOT using a Joying media application. They will ONLY work as the original keys when you are within the Joying media applications.

Remember, the apk is just handing codes to you, what you do with them after that is up to you! I have tried to comment the example script enough to be understandable to someone with basic programming knowledge.

Attached is a zip file with the updated Sofia-1-C9-Server-V1.0.apk, launcher.sh ( my example script), and install script. The launcher.sh script must be placed in the /data directory ( /data/launcher.sh ), as it is hardcoded in the apk file.

The install script is a shell/linux script, but you can easily copy/paste the adb commands if your using windows.

[NOTE: Please update to the latest version of busybox! I found some bugs in the version included by Joying that caused several issues.]