yashsingh1/xdaforums huggingface dataset:
[FYT Android Head Units] IG_Vasilich:
you can use Android KeyEvent constants

87 = KEYCODE_MEDIA_NEXT https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MEDIA_NEXT

88 = KEYCODE_MEDIA_PREVIOUS https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MEDIA_PREVIOUS

85 = KEYCODE_MEDIA_PLAY_PAUSE https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MEDIA_PLAY_PAUSE

also in if comparison

else if (onKey1 == KeyEvent.KEYCODE_MEDIA_NEXT) {

as you do later in code, to keep code more readable (i hate magic numbers :) )
[FYT Android Head Units] surfer63:
I did apply the code with IG_Vasilich's adjustments, but I spoke too early.

Because I did not expect an intermediate change I already applied the code and strings for the extended double-tap and triple-tap to the master-repository, but I did not implement the int_alt function yet.

Either I will disable the new preference settings or somehow make the int_alt function work, but that will be tomorrow evening or Saturday.

I assume I will simply copy the init_alt method for the time being in every hook and better programmers than me can later optimize it.
[FYT Android Head Units] surfer63:
I wanted to start implementing the code this morning in all hooks (the simple but not so efficient way from programming point of view), but is there a reason why you choose for the extra

} else {
if (count3 == 2) {

instead of

} else if (count3 == 2) {

like (for the dvd key):

private static int count3 = 0;
private static int delay3 = 300;

public void init_alt() {

final Context context = (Context) AndroidAppHelper.currentApplication();

count3++;

if (count3 == 1) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 == 1) {
whichActionToPerform(context, dvd_call_option, dvd_call_entry);
count3 = 0;
}
}
},
delay3
);
} else if (count3 == 2) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 == 2) {
whichActionToPerform(context, dvd_call_option_second, dvd_call_entry_second);
count3 = 0;
}
}
},
delay3
);
} else if (count3 == 3) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 == 3) {
whichActionToPerform(context, dvd_call_option_third, dvd_call_entry_third);
count3 = 0;
}
}
},
delay3
);
} else if (count3 >= 4) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 >= 4) {
startActivityByPackageName(context, "org.videolan.vlc");
count3 = 0;
}
}
},
delay3
);
}
}

This makes the code a bit more compact and more easy to overview (I think).

Or am I overlooking or missing something??
[FYT Android Head Units] gtxaspec:
probably an oversight, it should work the same.
[FYT Android Head Units] surfer63:
It works fine now. I uploaded all code to my github. I will add Mitchum67's updated German translation and make a release tonight. Got other things to do for the rest of the day.
[FYT Android Head Units] surfer63:
XSofiaTweaker 1.22 released

I just released version 1.22

next/previous/playpause functions work (gtxaspec)

Make double-tap, triple-tap functionality for keys internal java instead of via an external script (gtxaspec)

Updated German translation (mitchum67)
[FYT Android Head Units] gtxaspec:
I'm away from my car for the next few days, if you guys could try the media keys fix and the new tap options and give feedback =).

Make sure you thank [MENTION=2550900]surfer63[/MENTION] for his amazing work!!!
[FYT Android Head Units] akuma148:
Media keys work great, much faster.

Double tap also works fine, haven't tried triple tap.

But, the mode/source button is not hooking any packages, intents or commands; it defaults to the joying defaults, which switches between radio, Bluetooth, music, etc.
[FYT Android Head Units] surfer63:
For the time being I can't find it. Personally I do not have steering wheel buttons, so I can't test myself here.

- Did it work in the previous version(s)?

The strange thing also is that you get the default behavior back. No matter good or wrong behavior, it should not even come there.

- Can you check the settings and do a reboot? It shouldn't be necessary, but just to try whether the settings mechanism work, but not the immediate update mechanism after having changed the settings.

- Please do the tapping and then send the Xposed logs from the Xposed Installer (top-left menu: Logs -> Use top-right arrow key to send them)
[FYT Android Head Units] ste2002:
Sorry for the delay, I has just asked 4pda's gorelexx to help with Russian translation.

I have my car sold in trade-in, so now I am Joying-less in every sence of the word :o.
[FYT Android Head Units] surfer63:
No joying, no joy?

I still wonder whether joying is some strange chinese "translation" of joy, enjoy, enjoying, or something like that.
[FYT Android Head Units] ste2002:
I interpret it as follows: "Joy" - everyone knows what it is, and "ing" suffix brings some activity/process. So Joying for me was the process of having joy - almost kidding. Not any more though: factory fit HU is old fashioned: no smartlink, android auto or apple carplay, proprietry navi with no TMC in my city...
[FYT Android Head Units] akuma148:
I had 1.21 installed before and the mode/source button was working fine with that. For 1.22, I wasn't able to install it over 1.21 for some reason, it kept saying App not installed after pressing install in xposed, so I had to uninstall 1.21 and install 1.22 manually.

If I don't hook anything, the steering wheel functions always defaulted to the Joying defaults, but once I hook something, then XSofiaTweaker would take over. Yes, I've rebooted a few times and nothing seems to hook the mode/source button. I even tried to copy exactly what I hooked for the BT Phone button (which is working correctly) and it still doesn't work. There must be something missing in the coding, just for this button. I'll try to send you the logs when I have a chance.

Thanks for the help.
[FYT Android Head Units] gtxaspec:
I'll test tonight

---------- Post added at 05:50 AM ---------- Previous post was at 05:49 AM ----------

Will you replace with Android HU???
[FYT Android Head Units] ste2002:
Not right away - VW's HU (RNS-850) is a very solid device deeply integrated into auto's electronics - I can not abandon 4-camera around picture in parking mode, extensive car info etc. It's also a car warranty issue.

There is an option to purchase some Android box which interfaces itself into RNS via AUX/Media IN - I've seen already a couple of those. Some have Android 6, but still not very impressive.

---------------------- add-on -----------------

Factory VW HU - it is also properly working FM radio and Bluetooth - basic automotive functions for me together with Navi.
[FYT Android Head Units] gtxaspec:
confirmed, the mode/src button doesn't work. i'll look at the code...looks like it's not hooking at all...also it seems logging is commented out in the repo...so of course nothing in the logs.
[FYT Android Head Units] surfer63:
logging is indeed switched off, as everything worked OK.

And absolutely nothing has changed in the hook method for mode_src for the last 2 months. That's also why I don't understand.

I wanted to add a slider "log debug messages on/off" in one of the next releases especially for this purpose.

Obviously I switched off the logging for the mode/src button too early.
[FYT Android Head Units] KlaverBoer:
I've just tested version 1.22. I assigned two actions to the steeringwheel phone button. 1 click opens the google voice search intent and the second click opens the bluetooth phone app. So that works great.
[FYT Android Head Units] gtxaspec:
[MENTION=2550900]surfer63[/MENTION], regarding the MODE/SRC not working, if you remove the if statement from the method:

//if ((mode_src_call_option != "") && (mode_src_call_entry != "")) {

then the hook works, it seems related to these entries.

possibly related to:

05-08 09:05:24.348 27461 27461 D XSofiaTweaker-SettingsFragment: Invalid setting encountered
05-08 09:05:24.348 27461 27461 D XSofiaTweaker-SettingsFragment: updated key is mode_src_key_entry
[FYT Android Head Units] surfer63:
Thanks for spotting that. For the "mode_src_*" options I corrupted a few "mode_src_key_call_entry" in "mode_src_key_entry" and "mode_src_key_key_entry".

I will release a bugfix in 1-3 hours.
[FYT Android Head Units] surfer63:
XSofiaTweaker 1.23 released

And a bugfix release.

Correct typos in mode_src button settingsFragment

re-enable debugging messages
[FYT Android Head Units] gtxaspec:
[MENTION=2550900]surfer63[/MENTION],

errors still persist with latest repo:

05-08 23:09:18.577 9813-9813/org.hvdw.xsofiatweaker D/XSofiaTweaker-SettingsFragment: Invalid setting encountered

updated key is mode_src_key_entry

updated string is com.waze

maybe some of the xml in preferences.xml needs to be updated?
[FYT Android Head Units] surfer63:
I will check again. The problem is that I can't test myself and it compiles fine.
[FYT Android Head Units] gtxaspec:
just tested some changes, figured it out:

android:key="mode_src_key_entry"

needs to be changed to

android:key="mode_src_key_call_entry"

in preferences.xml for all three key's.
[FYT Android Head Units] surfer63:
#@! :mad:

That's what I mentioned in my post Yesterday. Somehow I either overlooked it in preferences or I did not save my changes.

Thanks again. Tonight another bug-fix.
[FYT Android Head Units] joshnat:
[MENTION=2550900]surfer63[/MENTION] I've been reading your progress with double and triple taps in Xsofiatweaker. I'm still using the Sofiaserver mod in JET since I have keys with doubles and triples. Have you implemented that yet? I'm not sure how to access it if so.

The current version of JET is showing a blank screen for Sofiaserver mods on the test version of gtx 9v4 so I'm not sure how to use either approach (Xsofiatweaker or Sofiaserver mod with launcher.sh).
[FYT Android Head Units] KlaverBoer:
I would like to open the recent apps screen with a button click. Does someone know the command for how to realize that?

I run a lot of apps in full screen mode. On my unit its very hard to open the recent apps icon in the notification bar.
[FYT Android Head Units] gtxaspec:
com.android.systemui/.com.android.systemui.recent.RecentsActivity

---------- Post added at 08:09 PM ---------- Previous post was at 07:42 PM ----------

Don't use Sofia server mods with the v9a4 test...no bueno. Download xsofiatweaker from the Xposed repository. Then look at the keys and you'll see the options there.
[FYT Android Head Units] joshnat:
Yes, that's what I'm doing, but I like to have the ability to double and triple press buttons. I can't see how to do that in the current xsofiatweaker. I know you and [MENTION=2550900]surfer63[/MENTION] have been working on it, but I don't see it in the interface.
[FYT Android Head Units] gtxaspec:
You must have an old version. Clear the cache on the Xposed installer and try again
[FYT Android Head Units] KlaverBoer:
[MENTION=520205]gtxaspec[/MENTION] Thanks for your quick reply. I just tried the command right away. But it didn't work.
[FYT Android Head Units] gtxaspec:
Make sure you select intent not package or system call for type
[FYT Android Head Units] KlaverBoer:
I've tried it with the intent option.
[FYT Android Head Units] joshnat:
Drrp. I did have an old version. Now trying to convert the strings from launcher.sh to xsofiatweaker. Can't seem to get this one to work: "input keyevent KEYCODE_APP_SWITCH" for recents. Whoops, looks like you answered the same question above. I'll try that command.
[FYT Android Head Units] surfer63:
Make it a system call with "input keyevent 187" or better "input keyevent KEYCODE_APP_SWITCH"

edit: Something weird going on. This question was already answered, but only after having entered my own answer about 4 posts in between appeared (and I opened the site "fresh").
[FYT Android Head Units] KlaverBoer:
[MENTION=2550900]surfer63[/MENTION] That system call works like a charm. Thanks again.
[FYT Android Head Units] Astur_Torque:
why?

I'm using your lastest rom with Sofia xposed mods... do you mean modified app?
[FYT Android Head Units] DBestman:
For some reason, the latest version of XSofiaTweaker shown in my Xposed Installer is version 1.19. I tried clearing Xposed's cache but that didn't change anything. Any clues?
[FYT Android Head Units] surfer63:
On the modules page do a "swipe down" to refresh.
[FYT Android Head Units] surfer63:
XSofiaTweaker 1.24 released

And again a bug fix

Really fix mode_src button configuration this time
[FYT Android Head Units] joshnat:
I've successfully moved my launcher.sh config to Xsofiatweaker. There is a bit of lag compared to the old method, and the double and triple pushes sometimes don't register correctly. Just FYI.

By the way, I used intents or system calls for all the buttons, not package names.
[FYT Android Head Units] surfer63:
System calls are by default slower as you first need to open a shell and then execute the command.
[FYT Android Head Units] gtxaspec:
Systems calls will have the same lag as launcher.sh

There should not be more lag than the old launcher.sh unless you are using system calls.

[MENTION=2550900]surfer63[/MENTION], are you able to add an option to specify the delay variable?

I know some might want to change the delay, on preference.

Which buttons don't register correctly? On my unit, all work perfectly, with delay set at 200ms.

Canbus buttons have issues, but I am looking in to it. Please give us more info.
[FYT Android Head Units] surfer63:
Yes, I will do that this weekend.
[FYT Android Head Units] joshnat:
Is there a place in the module to set delay for multiple press? Maybe I missed it.

I think I'm only using one system call, to call the recents button. Otherwise everything else is based on intent, but the lag feels about the same.
[FYT Android Head Units] gtxaspec:
I'll get the exactrecents intenti use... No delay for me.. stand by
[FYT Android Head Units] akuma148:
Mode/source is working perfect now! Thanks for the quick fix.

These double and triple presses are really useful also. Does anybody know the commands for "Home" and "Back"

Also, on the old gustden mod and default joying, when pressing the Navi button it would launch your default Navi app, then pressing the Navi button again would switch back to the previous app that was running before opening the Navi, allowing you to switch back and forth between the Navi app and whatever was running with just the Navi button. Does anybody know the command for that? I'll try the gustden code when i get home, but just wanted to see if there's another way.
[FYT Android Head Units] gtxaspec:
[MENTION=2362256]RoNeReR[/MENTION]

trying to figure out a way to link the android system volume to the SoM BD controller's volume... any idea's? maybe figuring out how to hook the android system volume to run a command to increase the volume via i2c command...ideas?.

that way people can change the volume normally if needed via tasker or any other app.
[FYT Android Head Units] RoNeReR:
i dont understand what u mean.

there is two "volumes"

joying volume ( control the internal amp)

android stock volume ( the stock volume bar in the setting (like all android devices))

the joying volume use like external device.
[FYT Android Head Units] IG_Vasilich:
i think he has asked about joying volume.

Usage example: Launcher/app that checks the vehicle speed (via GPS) and adjusts volume acc. to speed, e.g. +10% after >70 km/h, +10% after >100 km/h, etc. (in my original HU from Honda/Panasonic this function was named SVC - Speed volume control). Some launchers tried to implement it, but android stock volume control works bad it such scenarios, so it needs to be a real control over MCU.

Do you know how to control that "joying volume"? some system calls, or intents, or anything else?
[FYT Android Head Units] RoNeReR:
u dont need to control joying volume for this stuff.

if u use the switch channel 4 , the stock volume not turn up to max automatic. so its can be control via tasker.

the joying volume its just the master volume.

for example if u set the stock volume to 50% and the joying volume to 36 (Max), the full volume will be 50% .
[FYT Android Head Units] IG_Vasilich:
i don't understand what you mean with switch 4 ?
[FYT Android Head Units] RoNeReR:
there is mod in this xposed module, allows you to unmute channel 4, which is used for Google voice feedback and disable the auto maximize the stock volume
[FYT Android Head Units] gtxaspec:
Problem is only when I set to Max or near max, there is slight hiss in my system, which is why the Android master should move along with the joying master.
[FYT Android Head Units] RoNeReR:
I will look for a way to do it on friday morning, i will take out the headunit to home for testing.. So if i open to asks

What is the point of control the joying volume? What u want to succeed. Maybe there is simple workaround
[FYT Android Head Units] IG_Vasilich:
[MENTION=2550900]surfer63[/MENTION]

i had a short look to XSofiaTweaker module source code. I see that for mute button you hook to "mcuKeyVolMute" method, and assume that this method will be called from SofiaServer somewhere? i am still dreaming to split functions of my volume knob press event and dedicated hardware MUTE button event = now both these actions lead to same function - toggle mute (I am still on stock ROM).

another question - how is it possible (if at all) to set "Source/mode" button to cycle between different programs (as it does in stock ROM)? i would like to keep that function, just it would be nice to customize the app list that will be started after each press (e.g. i never use BT streaming, but have DAB+ radio app). Is it somehow possible to do it via shell script - then we need the possibility to read press count (maybe even cycled, but this can be achieved in script) to check what function should be called for this particular press... or we can do it internally and give the user the input field where each string means calling app...
[FYT Android Head Units] joshnat:
[MENTION=2550900]surfer63[/MENTION] my VW-specific unit has an EQ button. Is it possible to add this to Xsofiatweaker for customization, as I'm now using Viper instead of the stock EQ.
[FYT Android Head Units] surfer63:
The higher functions of the volume knob and the mute button both call the "mcuKeyVolMute" method. We hook that "mcuKeyVolMute" method as that is what Gustden did. In your case we should hook the higher functions, but at least the Volume button is a combined method (that among others also calls "mcuKeyVolMute") and requires more programming than just hooking it.

There is an mtcd xposed module (XMTC) that does this cycling (and some more), just like the standard Joying. I already had a look at it, but is is a "higher stage" of java I currently do not master, also using an external carrousel library to cycle the entries but I don't understand yet the "linking" from saved settings to the carrousel library. Next to that: I don't have steering wheel buttons. For that reason it is automatically lower on my priority list. But [MENTION=520205]gtxaspec[/MENTION] already mentioned he was looking at such a button cycling method.

The EQ button is already hooked, but I currently disabled it for use. The point is that this button has some nasty side effects, which I can't explain right now.

Like I explained on http://repo.xposed.info/module/org.hvdw.xsofiatweaker AND on https://github.com/hvdwolf/XSofiaTweaker: "The EQualizer button works but has the side effect that it blocks all hardware keys for 1-2 minutes, then mutes all audio channels (1-3 seconds), and then re-enables all hardware buttons and sound."
[FYT Android Head Units] gtxaspec:
I'm getting a unit with an eq button to borrow... I'll see if I can debug and get the eq to work...

---------- Post added at 09:35 PM ---------- Previous post was at 08:37 PM ----------

Can you be more specific? Are you talking about mute on your steering wheel, as well as the button on the unit?
[FYT Android Head Units] IG_Vasilich:
No, in this case i am talking about

1. hardware Volume knob with push function on my HU. Pressing the knob toggles the mute.

2. hardware button "MUTE" on my HU. Pressing it toggles the mute.

so this mute toggle function is duplicated on hardware, and i am still hoping to have a possibility to remap hardware "MUTE" button to do something else (e.g. start navigation program, as HU doesn't have dedicated "NAVI" button), still keeping the mute toggle function when pressing on hardware volume knob.

And if we are touching these possibilities - i have hardware "MODE" button on my HU, and also have steering wheel button "MODE" (no CAN bus- just resistive interface). Is it possible to have different functions for these buttons? (Not that i really need this, but interesting to know...)

P.S. yes one of the ways to split SWI buttons from hardware HU buttons is to map SWI button to some unused function. It is still good to know whether is it possible to distinct the HU and SWI buttons mapped to same function...

Thanks in advance for digging into that...
[FYT Android Head Units] surfer63:
[MENTION=2946605]IG_Vasilich[/MENTION]:

One thing though. The methods are only hooked as both the call_option as well as the text are filled in the settings.

You can't "empty" or nullify the call-option, but if you leave the text string empty, XSofiaTweaker will not hook the method but skip it and use the standard Joying functionality.

So you should be able to get the default Joying behavior back for the Source/Mode button.

Maybe I should add a call-option like "Default Joying behavior", next to "by package name", "by intent (package name/intent)", "by system call (terminal command or script)". That might make it more clear even though functional/technical not necessary.
[FYT Android Head Units] IG_Vasilich:
what sense does it make to hook any function and leave it at default behavior?

BTW, in current code on GitHub the default string for mute (preferences.xml, line 576) is the copy of string for home. Not sure what we need to put there, as i believe that my idea to write "input keyevent 164" will call this function again in loop.
[FYT Android Head Units] gtxaspec:
I'm working on a bunch of stuff...one of them is to separate the steering wheel from the panel buttons...stay tuned.
[FYT Android Head Units] RoNeReR:
for the eq button, i think u hook the wrong method,

try to change to mcuKeyAudio method

find this:

findAndHookMethod("util.JumpPage", lpparam.classLoader, "eq", new XC_MethodHook() {

replace with:

findAndHookMethod("module.main.HandlerMain", lpparam.classLoader, "mcuKeyAudio", new XC_MethodHook() {
[FYT Android Head Units] IG_Vasilich:
will you work on XSofiaTweaker XPosed module ? or on your ROM ?

In first case i probably could help somehow...

---------- Post added at 14:31 ---------- Previous post was at 14:06 ----------

[MENTION=2362256]RoNeReR[/MENTION] [MENTION=2550900]surfer63[/MENTION]

not sure who is the author of that function, that is why i will ask here:

findAndHookMethod("module.main.HandlerMain", lpparam.classLoader, "mcuKeyVolMute", new XC_MethodHook() {

XSofiaTweaker.java

lines378 and 386

audioManager.adjustStreamVolume(6,...

In Android reference documentation there is no audio stream with number 6. Closest match i can imagine is STREAM_DTMF = 8. Was it intended to use it there? or is this stream 6 specific to Joying android?

same unit, lines 380-386:

audioManager.adjustStreamVolume(0, 101, 0);

101 = ADJUST_TOGGLE_MUTE. In that part of code you want to mute all channels. Wouldn't it be better to use ADJUST_MUTE instead to have defined behavior?

If you believe that this thread isn't the correct place to clear such things - let me know :)
[FYT Android Head Units] RoNeReR:
u right, 6 is not a stream channel and this line can be removed.

maybe only use the 101 because with this option if u click the mute key again the sound unmute.

i will test it tomorrow, when i take the unit to home.
[FYT Android Head Units] IG_Vasilich:
so we don't need to use 8 instead?

for that is the upper part of code (lines 372-378) with 100 = ADJUST_UNMUTE there...