yashsingh1/xdaforums huggingface dataset:
[Android Head-Units] dyabolikarl:
I had issues like this when i had a dodgy busybox install. Have up you updated busybox?

Also you have if [ "$x" = "" ]

I'm not sure about bash script here (i am a bash / python noob) but in every other language you need to put a double = to compare the variable.

If you type x = 9 it will make x =9 if x ==9 it will ask if it's equal to 9.

So its probably if [ "$x" == "" ]
[Android Head-Units] edit:
I have the exact same issue. Since I know pretty much nothing about scripting or programming it was next to impossible for me to solve the issue so if someone can help up it would be much appreciated.

Also this script on android 5 works this way with all the apps, not hust PowerAmp, when you push the button it starts but it does not know to return to PowerAmp...
[Android Head-Units] surfer63:
That is not entirely correct.

This [ "$x" == "" ] is a bash extension that nowadays most shell interpreters understand, but the [ "$x" = "" ], or simply "$x" = "" is the POSIX compliant version. And if you use the bash version you do need the square brackets around it.

I think the "grep poweramp" in the x=`dumpsys activity activities | grep "Run #" | cut -f 13 -d" "| head -1 | grep poweramp` might need some modification.

First of all. The use of variable=`command(s)` is deprecated and some shell interpreters no longer understand it.

Better use variable=$(command(s)) like: x=$(dumpsys activity activities | grep "Run #" | cut -f 13 -d" "| head -1 | grep poweramp)

I'm not using poweramp, but did anyone actually run this command from a terminal, with and without poweramp running?

like:

x=$(dumpsys activity activities | grep "Run #" | cut -f 13 -d" "| head -1 | grep poweramp)
echo $x

or the old version:

x=`dumpsys activity activities | grep "Run #" | cut -f 13 -d" "| head -1 | grep poweramp`
echo $x

Edit: And therefore also the second command (if still correct) should be

am start $(dumpsys activity activities | grep "Run #" | cut -f 13 -d" " | grep -v launcher | grep -v systemui | grep -v poweramp |head -1)

Edit2: I think this second command needs modification. I will have a look tonight.
[Android Head-Units] tangoman99:
I hadn't thought to run a terminal app on the Head Unit to get some details on what the activities stack looks like. Thanks for that.
[Android Head-Units] allenrb2:
ok, I must be doing something wrong. I'm not a huge linux guy. I extracted the stuff to a folder. Then opened Konsole, and typed ./install.sh 192.168.0.101 then it stared running, but kept saying not found on each step. So I don't think it actually did anything. Am I supposed to install the android sdk first? Sorry for my noobpost, but thanks for any help.
[Android Head-Units] gustden:
You need to have ADB installed for your system. There are lots of great tutorials on the web on how to install and use adb for just about every OS. Hopefully before you install, you understand the steps of the installer well enough that you can undo the changes if you decide to.
[Android Head-Units] allenrb2:
Ok, I didn't think about that before hand for whatever reason. I was dog tired when I got off work this morning, and tried it. I will give it another go whenever I get off in the morning
[Android Head-Units] VWCC_GERMANY:
Could some one help me with that?

Thanks:good:
[Android Head-Units] Sergio45:
I m waitting too.

When i have a good how to i will try this for sure, since its looks really usefull
[Android Head-Units] sonof:
Here's some codes for launching a couple apps:

# BeyondPod

beyondpod="am start mobi.beyondpod/.ui.views.Splash -c android.intent.category.LAUNCHER"

# Blackout

blackout="am start com.fancylancy.android.blackout/.MainActivity -c android.intent.category.LAUNCHER"

# Nopeuskamerat

nopeuskam="am start com.tomtom.speedcams.android.map/com.tomtom.speedcams.android.activities.SpeedCamActivity -c android.intent.category.LAUNCHER"

# YLE Areena

areena="am start com.yle.webtv/fi.yle.areena.appui.AppUiActivity -c android.intent.category.LAUNCHER"

# Radiot.fi

radiotfi="am start fi.radiosoitinsuomi.radiotfi/.MainActivity -c android.intent.category.LAUNCHER"
[Android Head-Units] allenrb2:
Thanks I got tit worked out
[Android Head-Units] allenrb2:
Is there any way to change what is launched by the Navi button? I use Sygic, and don't really need it linked to Torque. Would I just change where it says # Torque

torque="am start org.prowl.torque/org.prowl.torque.landing.FrontPage" to Sygic's path in the launcher.sh file?
[Android Head-Units] dayanandgp:
Hi, I have been following your thread closely since I am frustrated with suspend and poweramp not resuming back. I think you have done best job for this headunit till now ? I just got couple of questions if somebody could answer.

When you say steering keys, do you mean the add on unit that needs to be purchased or the OEM steering wheel keys? I have 131N2 unit on Passat with steering control. So as I understood your script was for the unit with hard keys and mine is without a hard keys. Will the script work just for " resume" use case? All I am interested is resuming of all apps particularly poweramp on wakeup.

Thanks in advance for the answer!!
[Android Head-Units] wanb1i:
Will wireless adb app work with this?

Any chance you could provide a step-by-step for us non-coders that would LOVE to have this in our systems?

---------- Post added at 02:26 PM ---------- Previous post was at 02:12 PM ----------

I'm ok with the Steering wheel PTT key the way you fixed them initially, but would love to fix the resume issues. Anyway to get a modded apk that just fixes that?
[Android Head-Units] dayanandgp:
Actually I would assume that commenting out the other part of code except case : 99 of resume would do. However would love to have standalone file just so that I don't mess anything else. Can we please please have this? :angel: I mean just the script to do resume...
[Android Head-Units] Kurt Lund:
I totally agree. Would be extremely thankful if we could get an APK to fix the resume problem. Thank you very much in advance.

Regards

Kurt
[Android Head-Units] joshnat:
I've been spending some time getting my head around the launcher.sh.

I've got a VW-specific model that has a couple keys that don't do anything. I see that [MENTION=3076686]gustden[/MENTION] has identified the keys for DVD and Eject, which hopefully I can reassign to another function. I tried in the past to capture the key events for the DVD and Eject buttons with this app: https://play.google.com/store/apps/...ntdisplay&hl=en&rdid=aws.apps.keyeventdisplay but Android wasn't seeing them, so I wonder if this apk and script will even see those non-functional button presses?

In the attached photo, you can also see that there are buttons for EQ and Media, which I would also like to reassign (these do launch Joying apps, but are not useful to me). I assume I just need the key number and then can use the script to reassign those to other apps? For example, I'd rather have EQ control Google Voice or CALL/BT PHONE than to launch the Joying EQ app, which I need very rarely.

Oh, one more thing: the right-hand knob/button sends play/pause and next/back. However, whenever I use it and the app that's playing (usually Pandora) isn't in the foreground, Google Play Music starts up and starts playing. Any idea how to prevent this? I keep Google Play Music so I can access my own music via the cloud. I also run Subsonic, but sometimes (more often than I'd like) my server goes down and my only option is Google Play Music.
[Android Head-Units] gustden:
The button & steering wheel keys are actually read by the MCU and perform actions in the Joying code and do not use "key events". It is looking at the data from the MCU to see if a key was pressed. It is a specific case for each one, and the only codes being passed to the shell script are the ones documented.

There is a good chance that the keys I have mapped ( DVD, Eject, & others ) would work on your unit, but the other buttons would remain as they are now. Does your unit actually have a DVD?

To prevent the toggling effect with the music players on pause/play, you need to issue a ( pause ) to the current player before moving to the next one, if you stop it with a pause/play it will toggle back to play when the next pause/play is received, even in the background.

If you look as the launcher.sh program, when moving to the next music player I issue a "pause" , and will not start playing when it is in the background and the next pause/play is received.
[Android Head-Units] gustden:
I have been getting many requests, both here and PMs asking for different combinations of things.

Everything from additional buttons to map, to the stock apk with the kill processes removed. My intent is to just share what I have developed for my own use, and if somebody else finds it is beneficial, they are more than welcome to use it. However, if I get multiple requests for the same thing, I will do my best to provide in my spare time.
[Android Head-Units] dayanandgp:
Hi, I believe many of us are frustrated with the resume part of this headunit since it's creating issues for Google maps, music players, Tasker etc.

This was the reason atleast why I made a kind request:)... Maybe if you can sing clean up the script file to do the resume function it might help somebody who is not aware of coding. To be honest I don't even have hard keys on unit and I don't really wish to remap anything on steering wheel keys... But this resume thing really frustrated me on this unit...

It would be appreciated with a beer from my side :D
[Android Head-Units] VWCC_GERMANY:
[MENTION=3761964]allenrb2[/MENTION] could you please provide a step-by-step as you did the install a few hours ago? Thanks

Gesendet von meinem ALE-L21 mit Tapatalk
[Android Head-Units] allenrb2:
On the head unit I opened the terminal emulator, and entered this:

su

setprop service.adb.tcp.port 5555

stop adbd

start adbd

Then on my laptop I opened a terminal in the folder I had the files in, and entered:

./install.sh 192.168.0.104

- you would put the ip address of your head unit in place of mine

then it ran the script, and told me to restart the head unit after all steps completed

I too would like just the regular apk, with the kill process removed. I don't have any problems with the standard key mapping
[Android Head-Units] sonof:
If you only want resume then you could always just use launcher.sh that has nothing but a command to pass on key presses. Everything else should stay default this way. I haven't tested the code below but there is no need for gustden to make another variant of the apk when all the functionality is there already.

For those who wish to use as little abd as possible, you could always root the device and then use Root Browser to change the files with a nice GUI instead of command line. That's what I do since it is easier to just take a SD card with me to the car and copy the files manually. Remember to change the file permissions to the same as the original files have when you replace them.

#
# This script is designed to customize the commands issued from steering wheel
# keys and is an example of what can be done. Not all programs/actions have
# been tested, but this should serve as a guide to your own custom script.
#
# All output from this script goes to /dev/null, however the system call is
# shown in the 'adb logcat' as a debug statement with the tag MCUKEY. If
# you want to preserve script output you may want to consider a
# wrapper script to capture. When this script is run by the system, access to
# /sdcard is not available. Hence you may want to use /data to store anything
# such as counts or command output.
#
# USEFUL LAUNCH COMMDANDS defined as variables
#

# Goto Home screen
home="input keyevent 3"

# Back
back="input keyevent 4"

# key is the only argument received and actions are based on the key number
key=$1

case $key in

3) # HOME ( KEY 3 ) 1x press Home
$home
;;

4) # BACK ( KEY 4 ) 1x press Back
$back
;;

*) # Pass any other media keys as keyevent ( 85-PlayPause, 88-Prev, 86-Stop, 89-FB, 90-FF, 87-Next, 87-Pause, 126-Play )
input keyevent $key
;;
esac

exit 0
[Android Head-Units] sonof:
If you want to change the behavior of the additional buttons like EQ you need to follow the instructions in this post:

https://xdaforums.com/showpost.php?p=70754168&postcount=8

Then provide gustden with the key codes and hope he has the time to include them into the apk.

You cannot just use the key numbers as it will not do anything without modifying the apk first.
[Android Head-Units] tangoman99:
OK - so I ran the code

echo $(dumpsys activity activities | grep "Run #")

And I got the following output:

Run #5: ActivityRecord{c2485d1 u0 jackpal.androidterm/.Term t347} Run #4: ActivityRecord{badf408 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.KixEditorActivity t346} Run #3: ActivityRecord{7f844de u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.doclist.activity.DocListActivity t345} Run #2: ActivityRecord{e91c28b u0 com.estrongs.android.pop/.view.FileExplorerActivity t343} Run #1: ActivityRecord{137f468 u0 com.maxmpz.audioplayer/.PlayerUIActivity t338} Run #0: ActivityRecord{907c4ce u0 com.google.android.apps.maps/com.google.android.maps.MapsActivity t337} Run #1: ActivityRecord{ccdccfd u0 com.android.launcher4/.Launcher t336} Run #0: ActivityRecord{659415b u0 com.android.systemui/.recents.RecentsActivity t339}

Poweramp it seems is called maxmpz.audioplayer

So I changed the above code to:

# Toggle between Poweramp and last app
x=`dumpsys activity activities | grep "Run #" | cut -f 13 -d" "| head -1 | grep maxmpz`
if [ "$x" = "" ]
then
$poweramp
else
am start `dumpsys activity activities | grep "Run #" | cut -f 13 -d" " | grep -v launcher | grep -v systemui | grep -v maxmpz |head -1`
fi
;;

It doesn't work - well the call to start poweramp works, but it doesn't restore the last app on a second press.

Running

echo $(dumpsys activity activities | grep "Run #" | cut -f 13 -d" " | grep -v launcher | grep -v systemui | grep -v maxmpz |head -1)

inside the Terminal emulator returns the Terminal application - Difficult to test this code as I obviously cant run it while poweramp is the foreground app, so it could be that it is not excluding poweramp from the list and so whether poweramp is foreground or not, this code always switches to poweramp?
[Android Head-Units] surfer63:
Sorry. Still 1½ km from my car and it was terrible weather last night :)

You write that the output from your first command

echo $(dumpsys activity activities | grep "Run #")

is:

Run #5: ActivityRecord{c2485d1 u0 jackpal.androidterm/.Term t347}
Run #4: ActivityRecord{badf408 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.KixEditorActivity t346}
Run #3: ActivityRecord{7f844de u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.doclist.activity.DocListActivity t345}
Run #2: ActivityRecord{e91c28b u0 com.estrongs.android.pop/.view.FileExplorerActivity t343}
Run #1: ActivityRecord{137f468 u0 com.maxmpz.audioplayer/.PlayerUIActivity t338}
Run #0: ActivityRecord{907c4ce u0 com.google.android.apps.maps/com.google.android.maps.MapsActivity t337}
Run #1: ActivityRecord{ccdccfd u0 com.android.launcher4/.Launcher t336}
Run #0: ActivityRecord{659415b u0 com.android.systemui/.recents.RecentsActivity t339}

The cut -f 13 -d" " after the Run pipe should split every line in 13 fields where a space in the line is the delimiter (-d" ").

The grep -v commands search for the mentioned strings and remove the lines containing these strings, which in this case would remove the launcher, maxmpz and systemui line

However, if I split above lines on the spaces I do not get 13 "fields". I get 3 to 5 fields.

So there is no 13th field. I assume that is the error. I also assume the output of the dumpsys command changed going from Android 5 to Android 6.

And finally, the head -1 command only displays the top line. So that will be indeed the active application which is the jackpal terminal.

In this case the command should have been:

echo $(dumpsys activity activities | grep "Run #" | cut -f 13 -d" " | grep -v launcher | grep -v systemui | grep -v jackpal)

where the maxmpz from poweramp is now replaced by that from the jackpal terminal (and I removed the head -1).

This would have delivered

Run #4: ActivityRecord{badf408 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.KixEditorActivity t346}
Run #3: ActivityRecord{7f844de u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.doclist.activity.DocListActivity t345}
Run #2: ActivityRecord{e91c28b u0 com.estrongs.android.pop/.view.FileExplorerActivity t343}
Run #0: ActivityRecord{907c4ce u0 com.google.android.apps.maps/com.google.android.maps.MapsActivity t337}

The head -1 would then deliver

Run #4: ActivityRecord{badf408 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.KixEditorActivity t346}

That is Google Docs, so it should have brought Google Docs to focus again.

Does that make sense in this case?
[Android Head-Units] tangoman99:
Ahah! I'm new to Linux commands, but not to coding - I'd looked up the cut command, and was confused - hand't considered this was written for Android 5 and things may have changed. Weird thought that it seems to work for Google Maps!

And finally, the head -1 command only displays the top line. So that will be indeed the active application which is the jackpal terminal.

In this case the command should have been:

echo $(dumpsys activity activities | grep "Run #" | cut -f 13 -d" " | grep -v launcher | grep -v systemui | grep -v jackpal)

where the maxmpz from poweramp is now replaced by that from the jackpal terminal (and I removed the head -1).

This would have delivered

Run #4: ActivityRecord{badf408 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.KixEditorActivity t346}
Run #3: ActivityRecord{7f844de u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.doclist.activity.DocListActivity t345}
Run #2: ActivityRecord{e91c28b u0 com.estrongs.android.pop/.view.FileExplorerActivity t343}
Run #0: ActivityRecord{907c4ce u0 com.google.android.apps.maps/com.google.android.maps.MapsActivity t337}

The head -1 would then deliver

Run #4: ActivityRecord{badf408 u0 com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.editors.kix.KixEditorActivity t346}

That is Google Docs, so it should have brought Google Docs to focus again.

Does that make sense in this case?[/QUOTE]

You've still got the "-f 13" in there though - should that be "-f 3" now?

I'll try some more variants in the terminal emulator now i understand what the code is doing

Many thanks!
[Android Head-Units] tangoman99:
On a separate note, has anyone had any issues running Tasker on the unit? I find that when the unit goes to sleep, Tasker appears to be killed, so on resume, I have to manually restart it in order to respond to any triggers. Can I use the script to restart it automatically or should I prevent it from sleeping in the first place somehow?
[Android Head-Units] newell63:
Hi everyone.

I ve read that on android 6.0 we have a delay of 1 or 2 secondes after pressing a key and on 5.1.1 there is no delay.

Someone can confirm ?

A fix for it ?

Because i'm on 5.1.1 and before update i would like to know.

Many thanks
[Android Head-Units] surfer63:
There is indeed a delay of 2-3 seconds on 6.0.1.

You confirm yourself now that on 5.1.1 there is no delay.

At this moment there is no fix. Nobody knows what causes it.
[Android Head-Units] newell63:
No i can't confirm because i would like to know it before update to 6.0 or stay in 5.1.1.

I will install the mod throught your app and see in 5.1.1
[Android Head-Units] edit:
I have 2 units, one with 5009 and latest android 5, the other with 6021 and android 6 - 7july release.

On the Android 5 I have half a second lag while on the android 6 I have close to 3 seconds lag.

The delay/lag is present for the steering wheels buttons (NEXT, PREV, Mute, Pause) but NOT for the VOL+/VOL-

The delay/lag is also present for unit hardware buttons (BAND, MEDIA, DVD, EJECT...).

The delay/lag was present for all android 6 releases.
[Android Head-Units] luciusfox:
Are you actually using this hack? If not, then it would be normal, but with no-kill installed, it *should* work fine.

When I emphasize *should* because I don't use tasker. I prefer to write my own receivers to handle events.

---------- Post added at 05:21 PM ---------- Previous post was at 05:14 PM ----------

He confirmed 6.0.

The fact that you have *observed* that 5.1 has no delay is your confirmation for 5.1. So yes, you *can* and *have* confirmed.

It isn't entirely true what he says about it not being known why it happens in 6.0.

It has to do with calling the script.

There is a function added "onItemSelectedp" to module/main/HandlerMain.class, which generates a command string, gets a Runtime, and then exec's the command. There is a fairly large delay in that process in Android 6.0.

And while it is an "easy" solution, it is also pretty ugly and has a lot of overhead.
[Android Head-Units] edit:
Can you help us with a fix please?
[Android Head-Units] x3rb3ru$:
Anybody tested if the custom keys still work with the newest Joying release (September 2017)?
[Android Head-Units] Wilk7:
Removed, Hardware related and doesn't belong in this Software threat.
[Android Head-Units] luciusfox:
I'm not sure what your point is... this thread is about a software modification for handling the key presses, not a hardware modification to make them.
[Android Head-Units] jorxru:
Hi [MENTION=3076686]gustden[/MENTION]

First thanks for your work, you could put this application of speed camera in your apk:

Very interested in it, works at the same time as maps or other navigation application, thank you very much
[Android Head-Units] Wilk7:
Removed my wrongly placed post. Will appreciate if you can edit my section out also.

My point was, my car came without steering wheel switches, therefor I bought the Joying Steering Wheel Switch Unit, but for me it is ugly (The picture on their website showed a lack Unit, but the one I received is white, and that is my problem they say). So I bought second hand Steering wheel switches from a BMW and modified it with a resistor network as I pointed out in my misplaced post. So now I do have external Hardware switches that is profiled with the Joying Soft keys. Because of this and the limitation of the Joying Software keys function I am on this threat to enhance the functionality of my newly installed hardware switches.

Regards
[Android Head-Units] warata:
First of all thanks gustden.My JOYING-SOFIA has become a superior HU over PX5 because of your NO KILL mod.

But I do not know about Custom_Keys-Mods yet.How can I add back and home key to the steering control?
[Android Head-Units] ker2gsr:
i second this request
[Android Head-Units] warata:
As you may already know, I confirmed that Sofia-1-C9-Server-V1.0(No Kill modded) also works with september1 firmware.

Everyone do not be afraid to update them!:D
[Android Head-Units] gustden:
Update for Sept 1, 2017 Joying release

I just updated the first post of this thread with the update for Sept 1, 2017 release. https://xdaforums.com/android-auto/android-head-units/joying-2gb-steering-wheel-key-t3543390

I did remove the ability to customize the media keys, since a 2 second delay was present when trying to skip forward, pause, etc.

I also modified the Joying code so they the "media keys" should only be sent to the "active" media player. The joying code was doing a broadcast to all media players. It seems to be working good on my unit.

New files posted:

- 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 )

Let me know if you see any problems.
[Android Head-Units] dyabolikarl:
Couple questions.

Is this ONLY for the sept release?

Will my old Launcher.sh work without mods.