yashsingh1/xdaforums huggingface dataset:
[Android Head-Units] gustden:
I put in debugging code that parses the data stream from the MCU and dumps the first 4 bytes of EVERY message that is received from the MCU (skipping checksum info). Simply replace the original file (make a copy first ) and reboot. When looking for the keys, I suggest you do not use the radio, as it sends a constant flood of messages, such as RDS updates.

Even when the radio is off, there are still messages constantly being sent. If you filter on the debug messages MCUKEY in adb, and press the button in question a few times quickly, you should see a consistent pattern. I was able to identify the 'HANG' key in a couple minutes using this method. You should see something like this in the logcat:

D/MCUKEY ( 693): MCUKEYINPUT: B1=1 B2=0 B2=5 B2=224

D/MCUKEY ( 693): MCUKEYINPUT: B1=1 B2=7 B2=16 B2=0

D/MCUKEY ( 693): MCUKEYINPUT: B1=1 B2=0 B2=0 B2=49

D/MCUKEY ( 693): MCUKEYINPUT: B1=1 B2=7 B2=16 B2=0

D/MCUKEY ( 693): MCUKEYINPUT: B1=1 B2=3 B2=34 B2=0

In this case the HANG key is in bold ( 1, 7, 16, 0 ) messages. IF the DVD and eject keys are sent, they should definitely show up here. Not every key is sent by the MCU, if it is not relevant to the current state of the system. For example the media buttons are not sent when the radio is on, since the MCU is in control of the radio, however it does send the results such as a frequency change resulting from the button press.

It is possible that the MCU knows there is no DVD present and suppresses the messages. From looking at the code, it may be the action of a disc being ejected that is sent from the MCU, with the eject button press handled internally by the MCU. Your more likely to find the press of the DVD button than the eject button, but may find both.

When your done searching, you want to put back the original file and reboot. If you find the codes, I can certainly add them to trigger the shell script and you can take whatever action you want with them.
[Android Head-Units] sonof:
Thank you! I will try this the first thing next week when I get back home from a weekend trip.
[Android Head-Units] vassandrei:
Question: if I remove a customization from the script file for a key, the key should then perform its default functions, correct?
[Android Head-Units] gustden:
The keys being passed to the shell script (launcher.sh) is hard-coded in the APK file and is just sent to the script. If you remove it from the script, the key would no longer do anything.

If you want to keep the stock functionality of a specific button, it should be fairly easy to duplicate it in the shell script. For example:

BT/CALL button: "am start com.syu.bt/com.syu.bt.BtAct"

NAVI: By default, I think NAVI just toggles between a Navi app, and the previous activity on the stack.

The code below should behave the same as the original for both the NAVI an BTPHONE buttons ( assuming your using google maps )

case $key in
9) # NAVI
x=`dumpsys activity activities | grep "Run #" | cut -f 13 -d" "| head -1 | grep maps`
if [ "$x" = "" ]
then
$maps
else
am start `dumpsys activity activities | grep "Run #" | cut -f 13 -d" " | grep -v launcher | grep -v systemui | grep -v maps |head -1`
fi
;;
27) # BTPHONE/PTT
am start com.syu.bt/com.syu.bt.BtAct
;;

Play/Pause: you can just remove the 85 case, it would just hit the default case and pass "input keyevent 85" which is identical in functionality.
[Android Head-Units] vassandrei:
brilliant! thank you so much!

Last thing: I want to have viper4android launch on resume (in the background ideally). where can I find the "app identifier" to put in the shell script?
[Android Head-Units] gustden:
I made a slight change to the 'CODE' section of my previous post, so if you copy it make sure you get the edited version. I tested it and made a couple of changes.

There are several ways to get the package name and activity.

What I typically do is start the application on the unit and do the following in adb:

> adb shell

> dumpsys activity activities | grep "Run #"

This shows you a list of the activities ( package/activity ) in the task list with most recent at the top.

You should be able to pick it out pretty easily. If it is the app that I found with google, this should work to start it.

> am start com.vipercn.viper4android_v2/.activity.ViPER4Android

In most cases, you can just give the package name when using 'am start' with no need for the activity. It will default to the 'LAUNCHER' activity in the package. I usually always give the activity, just to be safe. I would sleep for a couple seconds to give it time to initialize and then $home to take you back to the Home screen. So whole command would look like this. It is easy to test using adb.

am start com.vipercn.viper4android_v2/.activity.ViPER4Android ; sleep 2 ; $home
[Android Head-Units] akuma148:
Thanks for this, it's working great on my Joying (JY-UL135N2 ).

My only issue is that the CALL/BT PHONE (27) button is assigned to my "Pick Up/Call Out" button on my steering wheel. So I can't use it to pick up calls. I actually have another dedicated button on my steering to activate voice commands, so I'd rather assign the CALL/BT PHONE function to that. Do you happen to know how to find out what numbers corresponds to each button press?
[Android Head-Units] gustden:
I make and receive so few voice calls, It wasn't worth having a steering wheel button dedicated for the dialer/call pickup . I just tap the screen to answer and use google voice to make calls.

If you want to have a button answer a call, there *should* be a way to do it given the right command. I will play around with it more. Worse case I can just back out the changes for the (27) , and send you an updated apk.
[Android Head-Units] akuma148:
I used the joying steering wheel control app and switched the dialer/call pickup to my voice button and that works, but my dialer/call pickup doesn't do anything. Please let me know if you want me to test anything. Thank you.
[Android Head-Units] sonof:
Luckily the eject key was also found! :) Here are the codes:

DVD:

D/MCUKEY ( 691): MCUKEYINPUT: B1=1 B2=0 B2=16 B2=80

EJECT:

D/MCUKEY ( 691): MCUKEYINPUT: B1=1 B2=161 B2=2 B2=91

Looking forward to the modified apk. If you happen to take donations I'd be willing to give you a beer. Thank you.

Model number for reference: JY-AL003N2
[Android Head-Units] gustden:
Here is an updated apk file that should catch the code you listed. In the zip there is a file "keys.txt" and also updated APK file. The keys.txt is a complete list button codes for both the soft-keys ( steering wheel ) and hard-keys (on unit ) that the new apk sends to the script. This is a beta of V2.0 which I added:

3 - HOME ( On unit hard key )

4 - BACK ( On unit hard key )

28 - HANG/CALL END ( Steering wheel softkey)

31 - DVD ( On unit hard key )

32 - EJECT ( On unit hard key )

The HOME/BACK keys are sending the keycodes for the home/back actions. You don't need to map them in a script, as long as you have a default that passes keycodes at the end of the script.

*) input keyevent $key

;;

I have used it the last couple of days and it is working fine for me, but can't test the dvd or eject.

Let me know if it registers the keys.
[Android Head-Units] thedru13:
sorry for the dumb question but do you need to root the unit to use this?
[Android Head-Units] nico84:
Is there a way to run a shell script when I switch ignition off and illumination on or off?
[Android Head-Units] surfer63:
Same for me. Feel free to upload
[Android Head-Units] Polluti0n:
Attached is the modified march 5th no-kill apk. I also included Surfer63's TTS modifications. This does not include steering wheel customization script or the install script. It should be installed just like any of the previous versions.

-Polluti0n
[Android Head-Units] KamaL:
I just installed it and it seems to be working fine. I need to test it further though.

Finally I can keep Dashcam from doitright running all the time in the background without the need to open it on each startup.

For some reason the windows bat file didn't work, even after removing those 3 lines.

I connected through adb and simply did a copy/paste of each line and it worked :)

Thanks [MENTION=3076686]gustden[/MENTION] [MENTION=2550900]surfer63[/MENTION] [MENTION=1344086]Polluti0n[/MENTION] and all other developers for the amazing work!!
[Android Head-Units] surfer63:
It contains one stupid copy&paste "typo". I use 98% of the time linux. I wrote a bat file for another apk and copy&pasted the current adb part of the linux shell script into the bat file below the heading, as the adb commands are exactly the same apart from the first command:

linux

adb connect $1

versus the windows

adb connect %1

Attached a correct bat file.
[Android Head-Units] Yury_D:
Hi!

This is a great mod but I can't get it working on my JY-UL135N2 2G unit with 5 March FW...

I installed it as described, after reboot I got "Optimizing 1 App" message but nothing happened - it works as before...

I tried to start the launcher.sh script by /data/#sh launcher.sh and got some input help list...

Can you advice please what shall I check?

BRG Yury
[Android Head-Units] aarick:
What's the chance someone could look at making this for the px5 units?
[Android Head-Units] surfer63:
I did mail my "patch" to Joying and mentioned the importance of the Google TTS engine addition to this file as that enables the integration of the Google app (Google voice app) and thereby voice feedback on your unit while the radio plays (although they still need to fix the issue between the Google app and the UI03).

Unfortunately Joying doesn't want to accept the fix. Obviously Google voice integration is not important for them as long as they have their Chinese Baidu voice integration. They want to sell to the entire world but only enable Baidu voice and Baidu like Chinese apps for their 1 billion users, and not the apps which are used by the 5 billion users in the rest of the world (I'm only slightly exaggerating right now ;)). That navi_app.txt is filled with many chinese apps and only iGO and Google Maps in addition. My remark that Tomtom, Sygic, Navigon (and many more commercial and free navi apps that I added) are widely used ,does not seem to be important to them.

I'm really trying to be patient in the ongoing mail discussion as you never know whether they simply don't understand what I mean, but I'm getting a little tired of it right now as they simply don't want to implement it.
[Android Head-Units] gtxaspec:
I believe the developers of the MCU software are :

http://www.carsql.com/

Shenzhen Youth Union Technology

I have contacted them on the telephone via a Chinese speaking colleague, they are developers that create the software ( and hardware? )

Joying are just re-sellers, I believe they receive support from SYU, as they are clients, but Joying does not develop the firmware or hardware themseleves; they only request the units to be customized to their specifications. Also, SYU and carsql.com is mentioned throughout various files in the firmware. Attempting to contact them would make more sense.
[Android Head-Units] surfer63:
Thanks for mentioning this.

I just checked their site, but my chinese is a bit rusty :).

Also Google translate has some issues with it, also due to the many images containing text (as image).

The "Contact us" link (Google's translation) doesn't work. If you look at the page source you can see that the HTML css code changes your mouse pointer to the "hand pointer" but without a real link behind it.

So how do they want you to contact? Or do they only give you the idea that you can contact them?

Do you, by any chance, have an english (or german, french, danish, dutch(native)) entry for me? Otherwise it stops here for me.

edit: Their BBS (Community translated) is only filled with spam.
[Android Head-Units] kaderekusen:
Crazy Chinese people :) don't be suprised
[Android Head-Units] wanb1i:
So, do I understand that you have a mod that makes Google Voice Response work on the 2gb sophia units? Is that something you are willing to share with us along with install instructions?
[Android Head-Units] surfer63:
Yes, sure. See this post for the apk for the 22 February ROM.

See here reactions from others.

And here is the NoKillversion with Google TTS patch by [MENTION=1018046]pollution[/MENTION] for the 5 March ROM.

The instructions are simply the same as for the CUSTOM apps from gustden from the first post..

Linux install script from gustden's zip on the first page.

windows bat file here

You need to have adb on your system.

I'm working on a "joying root assist" script for windows and for linux to give the user the option to install a superuser apk, install one of the Sofia Server apk's (this thread), modify screen density, install the modded Bluetooth app, etc.
[Android Head-Units] wanb1i:
Thanks for the quick response!

I'm still on the 12/8 rom because I use Nova and the latest updates are mostly UI. I'm afraid to update to the March rom because of reports of bad Bluetooth. But I guess I'll have to bite the bullet if I want this. To bad there's no way to do a nandroid on these units.

I'll post my results when I get it done.
[Android Head-Units] gtxaspec:
The bottom right of the carsql page has several contacts and their phone numbers listed.
[Android Head-Units] wanb1i:
I've downloaded the March update and I'm wondering if there is a reason that I can't just put your Sophia apk in the update package in place of the one that's there and then just update the device?

Nevermind, I see that can't be done on deeper inspection.

---------- Post added at 11:25 AM ---------- Previous post was at 11:13 AM ----------

The Install.bat script mentions a "Launcher.sh" file, I don't see that file mentioned in your instructions above. Is that file needed? If so, where do I find that?
[Android Head-Units] gustden:
I would be great if we could modify the update package, but all attempts I have made would not load :(

Any ideas on how the Allapp.pkg file is stored? It might be encrypted, but not sure why they would go through the trouble.

These two things make it impossible to create any custom ROM.
[Android Head-Units] gtxaspec:
On my site I have the tools to unpack and repack allapp.pkg, mirrors.gtxlabs.com under tools
[Android Head-Units] surfer63:
Yes, there is a way using busybox, on the head unit, and adb on your pc.

You have to identify the partitions that you want to backup and the size of those partitions.

That is actually completely off-topic for this thread and actually quite a lot of work, and I have not done it yet for these units, but maybe I write it out and create a new thread for it.

---------- Post added at 04:55 PM ---------- Previous post was at 04:50 PM ----------

For the steering wheel mod you need it. For the NoKill you don't.

Please read back through the topics starting at page 15. Also read the first post of this thread. Everything is explained.

---------- Post added at 04:58 PM ---------- Previous post was at 04:55 PM ----------

For the Allapp.pkg you can use the "ApkPack.exe" tool to unpack/pack. There is a Chinese and Russian version but it is actualy quite simple and I can share a google 1-page doc I created (in case I forget myself :)) on how to use the tool.

The 5009_20.zip file is signed. You will never be able to resign it exactly as it was. You need a recovery tool that can overwite systems instead of updating them like now. The recovery wants the "joying signing" in the zip (or whatever company signs them).
[Android Head-Units] wanb1i:
Reading further down the page, Joying indicated that they may use a different CPU than the Sofia for Marshmallow, unless I'm misreading their post. That would seriously SUCK!

"When release px5 and android 6?? In march?? Because sofia dont upgrade to Android 6?

Like · Reply · February 23 at 2:54am

Joying

Joying android intel sofia can be update android 6. we doesn't make sure which chip we will using android 6."
[Android Head-Units] surfer63:
Well. Here it is: exes and pdf
[Android Head-Units] Polluti0n:
I was trying to build a rom for myself a few weeks ago. The first problem was of course the signature on the android base package (5009_20.zip). When the signature verification failed I replaced the package I modified with the one that comes bundled in the Joying firmware. At this point the HU installed the base package without problems.

I then extracted the allapp.pkg using the English version of the apkpack.exe (which I have attached). I modified the allapp.pkg by replacing the server apk, Bluetooth apk, and the aosp settings apk. Once I swapped out those apks I recompiled the allapp.pkg and went out to the car to flash. At this point the HU installed the base package just fine but when it got to the allapp.pkg it gave me some error about "generation failed". Before it said generation failed I did see the command prompt installing all the apks I included in the bundle.

The device then hung on the command prompt with a message of "generation failed". I held in the power button and the HU restarted and booted to android but was not stable. I then had to reflash the factory firmware and do all of the mods through ADB.

I believe the generation failed message is being generated by "generate/dalcheckfile.bin" in the firmware package.

I just thought that I would share my rom creating experience with you guys. We really need a custom recovery.

On a side note I think surfer63 has the right idea about creating an install script. I think the best way would be to create a batch file that pushes everything to the device, then activates a install.sh the moves the files, alters build.prop, and assigns permissions. I have attached a zip for rooting the device that would be pretty easy to alter to achieve a one step install for root, server, Bluetooth, dpi, aosp settings, and ok google from any screen.

Please let me know if you want any help creating the install script. I would be happy to volunteer what little time I have.

-Polluti0n
[Android Head-Units] gtxaspec:
skip the dalcheckfile.bin, i believe you don't even need it present. you should be able to delete it and flash successfully. some versions of the rom don't even include it. i do believe this file is a pregenerated dalvik cache...???
[Android Head-Units] surfer63:
Thanks a lot for that one. Have been searching the internet for it but couldn't find it anywhere.

I think so too. The generation step creates the ODEX files. Inside the allapp.pkg and the zip files is also a file that provides the apks that need to be generated, so did you remove/add apks?

Is that the new 2.79-SR3 supersu or the previous 2.78 version already "floating around" since september 2016. I was just about to install & test the new 2.79, but in case you already packaged that one it will save me some testing (and possible errors)

---------- Post added at 02:24 PM ---------- Previous post was at 02:18 PM ----------

You are right. If you simply push the apks to the unit, the unit will do the step on first reboot like if you push a single modded sofiaServer.apk or a sigle modded bluetooth apk to the unit. And if you don't reboot, which isn't necessary in some cases, it will be optimized on first start of the apk, which will then of course take longer.

It doesn't make a difference at all. Either you spend 10 minutes watching the generation/optimization during the ROM install, or during the first reboot after.

I guess they do it during installation as most people accept it when it is done during installation, but are scared when it takes so long to boot. ("oh help, it takes 10 minutes to boot. What is wrong?")
[Android Head-Units] gustden:
Thanks for posting. I was just downloading the tools to modify the allapp.pkg and see if it would install with the 3-14 ROM. Glad I seen this, before spending time trying to get it to work.
[Android Head-Units] bogdi1988:
It would be awesome if we could modify their upgrade package to not do the device wipe :)
[Android Head-Units] surfer63:
Or make a backup before the upgrade and restore it immediately afterwards.

In one of my previous posts I referred to the option using adb and busybox to make backups. That might be an option to backup/restore the data partition in case a custom rom can't be created.

Creating such a ROM will be very difficult due to the signing. I have read somewhere about a modified TWRP recovery image for a Sophia 3GR tablet. If that one could be modified for the head units it would be much easier to create custom roms.

But I don't care too much about that. Having a (scripted) backup/restore option would be sufficient for me.

And another script to install apks and some more extras.

W.r.t. to the 5009_20 zip file.

If you unzip it you will find in the "META-INF/com/google/android" the updater script for the system partition.
[Android Head-Units] Polluti0n:
I replaced the server apk, bluetooth apk, and settimgs apk. After overwriting the originals I recompiled the package. I was packaging on Windows 10 though and got a pop-up when apkpack.exe completed. However this pop-up was in Chinese and I could not translate it. I then decompiled apkpack.exe in visual studios to further translate, but was unsuccessful in translating the executable any more.

This is just the 2.78 version. I just thought the install script would be a good base to modify to install all the modded apks and tweak the build.prop.
[Android Head-Units] surfer63:
OK. I have that same script which I want to test with the new 2.79 SuperSu.

I already wrote a script that modifies the density in the build.prop. I did some testing but I actually preferred the standard 160DPI.

Edit: And by the way there are two ways to change the density.

Modify it in the build.prop

use the "wm" command.
[Android Head-Units] WILD9:
Sorry for the off topic post but this seems to be where all the smart people are currently at ;)

Someone has managed to get USB DAC working on a Joying Sofia unit but volume control is not working currently :

https://xdaforums.com/showpost.php?p=71465690&postcount=20

This could be a breakthrough for anyone looking for higher sound quality but looks like he could do with some help if anyone is interested.
[Android Head-Units] wanb1i:
So I downloaded & installed the March update, then replaced the Sofia apk. The "resume" appears to be working and the ROM & Bluetooth are working. But the PTT button now rotates through just about all the stock apps with each consecutive push. I didn't install the "launcher.sh", as I didn't really want that function. However, now that I have it, it's kinda nice. I searched /data for a launcher.sh and there's none there, so I assume this is a "Base" function built into the modified sofia apk. I found the 1/29/17 version of the example launcher.sh and would like to replace some of these apps with apps that I use (like PowerAmp and Hybrid Assistant). I don't know where to find the information needed to start/play/pause these apps like the example used for Pandora below:

# Pandora

pandora="am start com.pandora.android/com.pandora.android.Main --activity-single-top --activity-brought-to-front"

# Press position on touchscreen for play/pause, small swipe was more reliable

pandora_press="input swipe 550 580 555 585 500";

Where do I find this information? This looks way complex and I'm not sure I'm able to do it. Is there a relatively easy way to just set the PTT button back to accessing "Ok Google"? Is it this?

# Google Voice Command

gvc="am start com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.VoiceSearchActivity"

Also, you mentioned that Google Voice Response was working with this mod, but it doesn't work on my unit. Does it need some additional app installed or something? :confused:

Your help is deeply appreciated! ;)
[Android Head-Units] gustden:
Which apk did you download? if it doesn't include the steering key mods you don't need launcher.sh . I haven't seen anyone make the Google voice response work. What was found recently is adding apps so they can talk over music sources, such as the radio.