yashsingh1/xdaforums huggingface dataset:
[FYT Android Head Units] surfer63:
You mention:

But the code is:

audioManager.setStreamVolume([B]3, CurrentVolume + 1, 1[/B]);
audioManager.setStreamVolume([B]5, CurrentVolume + 1, 0[/B]);

and also

but the code is:

audioManager.setStreamVolume([B]3, CurrentVolume + -1, 1[/B]);
audioManager.setStreamVolume([B]5, CurrentVolume + -1, 0[/B]);

Can you please explain? The "5" and "3" do not match. "3" in the first line and "5" in the second. Not like your example.
[FYT Android Head Units] RoNeReR:
[MENTION=2550900]surfer63[/MENTION]

My mistake. this is the fixed code. its zero on the end.

the code need to look like this:

audioManager.setStreamVolume(3, CurrentVolume + 1, 1);
int MaxVolume3 = audioManager.getStreamMaxVolume(3);
int MaxVolume5 = audioManager.getStreamMaxVolume(5);
audioManager.setStreamVolume(5, (int) Math.ceil((((double) MaxVolume5) / ((double) MaxVolume3)) * ((double) CurrentVolume)) , 0);

the 3 is the media stream, 5 is notification stream.

for example,

if the max volume of media stream set to 30,

and the max notification stream set to 7

and the CurrentVolume is 15 ( 50 precent of MaxVolume )

7 / 30 * 15 = 3.5

math.ceil(3.5) = 4

find:

audioManager.setStreamVolume(5, CurrentVolume + 1, 0);

replace with:

int MaxVolume3 = audioManager.getStreamMaxVolume(3);
int MaxVolume5 = audioManager.getStreamMaxVolume(5);
audioManager.setStreamVolume(5, (int) Math.ceil((((double) MaxVolume5) / ((double) MaxVolume3)) * ((double) CurrentVolume)) , 0);

find:

audioManager.setStreamVolume(5, CurrentVolume + -1, 0);

replace with:

int MaxVolume3 = audioManager.getStreamMaxVolume(3);
int MaxVolume5 = audioManager.getStreamMaxVolume(5);
audioManager.setStreamVolume(5, (int) Math.ceil((((double) MaxVolume5) / ((double) MaxVolume3)) * ((double) CurrentVolume)) , 0);
[FYT Android Head Units] surfer63:
XSofiaTweaker 1.21 released

Just released version 1.21

improved USB DAC functioning (thanks to RoNeReR)
[FYT Android Head Units] surfer63:
While searching through SofiaServer, I found that all settings from the CarSettings app are stored as properties, like ro.fyt.navi_package, ro.fyt.bright_level_day, ro.fyt.bright_level_night, ro.fyt.amp_type, ro.fyt.amp_enable, etcera, etcetera.

And the PX5 does it exactly the same.

This might come in handy later.
[FYT Android Head Units] carter.w.jason:
[MENTION=2550900]surfer63[/MENTION] how much trouble would it be for you to add some options to XSofiaTweaker? Along with, BT_PHONE, MODE_SRC, could we add Volume +/-, Track +/-, and Mute, to the steering wheel options?

What I'm looking to due is have XSofiaTweaker make these maps null. Then using Physical Button Music Control, I would add back in the original functions and then would have the ability to add double click, triple click options, on top of them.
[FYT Android Head Units] gtxaspec:
I'm working on multiple clicks for XSofiaTweaker. I agree we should hook more buttons. Based on observation, I have a theory that SWI controls are intercetped seperately., For example, the mute on the wheel is different from the mute on the panel of the unit. The same with for example the mode or src button (s). Need to find this code to separate them and add further customization.

---------- Post added at 05:06 PM ---------- Previous post was at 05:05 PM ----------

Did you modify these and test to see if they work? If not I can do that.
[FYT Android Head Units] surfer63:
If XSofiaTweaker supports them, you can add double-tap and triple-tap to it as well. Check the 2nd post of this thread for multi-tap options.
[FYT Android Head Units] carter.w.jason:
[MENTION=2550900]surfer63[/MENTION] PX5 system
[FYT Android Head Units] yuvalmesika:
[MENTION=2550900]surfer63[/MENTION]

Is it possible to set the amp_enable from code?

Can you turn it on/off based on CPU temperature from your xposed module?

Maybe we can control the fan with the Xposed module
[FYT Android Head Units] surfer63:
Yes, it would be possible to set the setting from the XSofiaTweaker, but I do not know whether this setting requires a reboot.
[FYT Android Head Units] gtxaspec:
hi [MENTION=2550900]surfer63[/MENTION]. I have gotten multiple button clicks to work in XSofiaTweaker... see example below:

call init() in the hook method of the key.

public void init() {

count2++;

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

new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count2 == 1) {
//run var 1
//startActivityByPackageName(context, "com.waze");
whichActionToPerform(context, dvd_call_option, dvd_call_entry);
count2 = 0;
} else {
if (count2 == 2) {
//run var 2
startActivityByPackageName(context, "com.audioaddict.di");
count2 = 0;
} else {
if (count2 == 3) {
//run var 3
startActivityByPackageName(context, "org.videolan.vlc");
count2 = 0;

} else {
if (count2 >= 4) {
//we run var 3...since we clicked more than 3 times...right??
startActivityByPackageName(context, "org.videolan.vlc");
}
count2 = 0;
}
}
}
}
},
//set delay here
600
);
}

works for me, and you can adjust the delay depending on how fast you would like to double tap. every time init() is called, it records the count and if matched against the statements, it launches the app selected. As far as UX goes...I leave that input to you. I do believe the delay should be adjustable in the user interface, and you could even expand to four clicks if wishes. let me know what you think. It's been working for me for the past few days testing. If you have a better implementation that would be great as well, i really can't stand the delay using launcher.sh

---------- Post added at 08:51 PM ---------- Previous post was at 08:32 PM ----------

Good concept, but why not leave the fan on 24/7? My amp is controlled by the amp cont signal, so it may not work for all. We should try to find the fan_en pin on the SoM.
[FYT Android Head Units] carter.w.jason:
I've been meaning to ask what this open header is. Any ideas? My searching brings up a post at 4pda but can't find it once I get there. Have fans on the way, was thinking of using amp cont, but I bought 5V fans. Would it be a bad idea to just tap the USB headers with no fuse breaker?
[FYT Android Head Units] gtxaspec:
Pic?
[FYT Android Head Units] carter.w.jason:
opps, it's been a long day
[FYT Android Head Units] gtxaspec:
That header is for composite video out.
[FYT Android Head Units] RoNeReR:
[MENTION=3243337]yuvalmesika[/MENTION]

if u really want to control the fan, u can buy something like this.

https://www.ebay.com/itm/12V-PWM-PC...710412&hash=item41c81b734e:g:uGsAAOSwBjdaPbYI
[FYT Android Head Units] gtxaspec:
improved version, less delay ( i hate lag! )

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) {
startActivityByPackageName(context, "com.audioaddict.di");
count3 = 0;
}
}
},
delay3
);

} else {
if (count3 == 3) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 == 3) {
startActivityByPackageName(context, "org.videolan.vlc");
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
);
}
}

}
}
}

Really fast on my unit... I can't notice the delay anymore when it's set to 200ms...
[FYT Android Head Units] surfer63:
This is really a great improvement, but I do not see yet how to implement it, to which keys and how to setup which apps need to be called on the several key taps per key.

Or did you mean this only for the mode/src key on the steering wheel?
[FYT Android Head Units] gtxaspec:
This method works for any button. Implementing it in the user interface will be the challenge.

Each key needs to have an option to select either 1 2 or 3 tap action per key, and then an option to assign the type of call, and then enter the command to launch.

So, example, you want your mode button on the wheel to have 3 actions, 3 taps. Done. And then you want the eject button on the panel to do 3 different actions...done! :)
[FYT Android Head Units] gtxaspec:
so, example

if ((bt_phone_call_option != "") && (bt_phone_call_entry != "")) {
//	findAndHookMethod("module.main.HandlerMain", lpparam.classLoader, "mcuKeyBtPhone", new XC_MethodHook() { Is not correct one ??
findAndHookMethod("util.JumpPage", lpparam.classLoader, "btPageDialByKey", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
Context context = (Context) AndroidAppHelper.currentApplication();
XSharedPreferences sharedPreferences = new XSharedPreferences("org.hvdw.xsofiatweaker");
sharedPreferences.makeWorldReadable();
bt_phone_call_option = sharedPreferences.getString(MySettings.BT_PHONE_CALL_OPTION, "");
bt_phone_call_entry = sharedPreferences.getString(MySettings.BT_PHONE_CALL_ENTRY, "");
XposedBridge.log(TAG + " mcuKeyBtPhone pressed; bt_phone_call_option: " + bt_phone_call_option + " bt_phone_call_entry : " + bt_phone_call_entry);
//whichActionToPerform(context, bt_phone_call_option, bt_phone_call_entry);
init_alt();
param.setResult(null);
}
});
}

then you have this method

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_one(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_two(context, dvd_call_option, dvd_call_entry);
count3 = 0;
}
}
},
delay3
);
} else {
if (count3 == 3) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 == 3) {
whichActionToPerform_three(context, dvd_call_option, dvd_call_entry);
count3 = 0;
}
}
},
delay3
);
} else {
if (count3 >= 4) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
if (count3 >= 4) {
whichActionToPerform_three(context, dvd_call_option, dvd_call_entry);
count3 = 0;
}
}
},
delay3
);
}
}
}
}
}

something along those lines....

or you could include the contents of init_alt within the hook method... need to brainstorm on some of the variables and such..

the UI could be as follows:

user clicks on "Assign app or action to hardware buttons..."

options for NAVI key (example:

Settings for the NAVI key:

1. NAVI Key: Number of actions

sub menu once clicked: (options) 1,2,3 (user then goes back to the previous menu which now expands to:

2. NAVI KEY: First action

sub menu once clicked:

1. NAVI Key First Call Method

2. NAVI Key First String to be used

3. NAVI KEY: second action...etc etc etc

see what you think. having almost instant response on multiple clicks really brings the unit to life. i have every button on the panel, AND all my SWI buttons hard coded with 3 actions per button...love it!!! we just need to figure out how to implement the UI so it's accessible to everyone!
[FYT Android Head Units] surfer63:
Yes, that was exactly my concern :). How to prevent a completely cluttered interface.

It's not that I don't want to implement it. I really see the benefits of implementing this in the module, and leaving the old script. But it needs some careful application design (and that coupled to my limited java skills). Currently I use the standard Preferences.xml and Android java automatically creates the Settings interface. Implementing this will also require programming the Settings interface.

If you look at Malaysks (and friends) modules: They have an extremely limited Settings screen and do everything from an ascii "init file" residing on /sdcard in a utils folder. It would be quite easy to create an editor screen (as an Activity) to do that for this as well. So users would use the editor screen and easily configure their settings. Power users could directly modify the config file. With regard to my skills I see that as the only option currently, unless some java wizard will join (or take over :))

Another reason I mention this config editor, as I had in mind to do the same for the current launcher.sh (or whatever you want to call it), as until now we still needed that one for the multi-tap options (as explained in the 2nd post of this thread under "multi tap options").
[FYT Android Head Units] gtxaspec:
Let me do a mock up in XSofiaTweaker and I will share my progress. Then if it's good we can implement.
[FYT Android Head Units] surfer63:
OK, now I understand what you want.

Now we have one layer of subscreens: On/Off actions, Hardware key actions, Steering wheel actions, ACC_ON/ACC)Off/Resume actions, and Info screen.

The sub-screen Hardware keys now contains BAND (call option and action string), MEDIA (call option and action string), DVD (call option and action string), etc

Now these options will become one single selection option opening another subscreen themselves.

So the BAND preferences screen will now contain 3x a "call option and action string". When option 2 and 3 remain empty, only single-tap is supported. If option 3 remains empty, only double-tap is supported.

If that is what you mean, I can easily implement that. It will just result in a big, long Preferences.xml, but who cares.

Maybe I will also split into separate preferences xmls with separate SettingActivity and SettingsFragment screens (which is actually the way forward on Android > 4.x).

So let me know if that is what you mean and I will build that (so you can focus on the Custom ROM :))

I thought you wanted something complicated (for me that is) with checkboxes, multiple options via popups, etc.
[FYT Android Head Units] gtxaspec:
I think you got it =) that will allow each hardware and SWI to have 3 actions!

---------- Post added at 06:27 PM ---------- Previous post was at 06:13 PM ----------

I think you got it =) that will allow each hardware and SWI to have 3 actions!
[FYT Android Head Units] surfer63:
I built in all the settings. That was a lot of work even though 70% is copy&paste with slight modification.

I'm now thinking about your init_alt() method. I really don't want to copy the method/function into every hook so I will look at some parametrisable method.
[FYT Android Head Units] gtxaspec:
Awesome work!! Please don't forget to expand the eject button (based off your multipref branch that I saw) as well, and if you can add a way to specify the delay variable so people can adjust the time between taps if you are able!! Thx again
[FYT Android Head Units] surfer63:
I removed the Eject button, as till now nobody even tested it.

And in case you have a DVD I assume you want to use the Eject button to really eject the CD/DVD.
[FYT Android Head Units] gtxaspec:
Ouch! I tested it! I thought I confirmed it to you since you even updated the read me on XSofiaTweaker as such :)

Eject is my most used button on my unit... Seriously lol. and I do know someone with the eq button as well that remaps it as well.

I think due to the variety of models and buttons every button should be able to be remapped at some point ;)
[FYT Android Head Units] surfer63:
I'm sorry. You are right. I maintain texts at 3 places and missed the essential one.

I will reactivate the Eject option and expand it. The code was still there. I only deactivated it in the preferences.xml.

Also on Wednesday as I'm away the next to 2 days.
[FYT Android Head Units] gtxaspec:
Lol no worries I have the same logistical issues as well. Enjoy the trip!!
[FYT Android Head Units] IG_Vasilich:
my HU has eject button , but no DVD drive, so - this is the real-life example why people want to remap it :)
[FYT Android Head Units] Need4Camaro:
[MENTION=2550900]surfer63[/MENTION]

Hi, I am completely confused as to how to download and install the XSofiaTweaker mod.

I went to http://repo.xposed.info

and then to XposedInstallerFramework: http://repo.xposed.info/module/de.robv.android.xposed.installer

and lastly to http://xdaforums.com/showthread.php?t=3034811 and downloaded the XposedInstaller_3.1.5.apk

but it also says I need to install xposed*.zip from https://dl-xda.xposed.info/framework/ and flash it into recovery via TWRP which I don't have a clue as to how to do.

Am I on the right track atleast? What do I need to do from here?
[FYT Android Head Units] IG_Vasilich:
btw, does this module support remapping of "mute" button/action? can it have different handling depending on where it comes from (my HU has hardware "MUTE" button and it also mutes volume when pressing on the "volume" knob)? I would like to use button for something different, still having the possibility of muting sound when pressing volume knob.

Thanks.
[FYT Android Head Units] gtxaspec:
Xposed installer is built in to the custom ROM, you just need to browse the repo IN the app. Don't replace the installer with Different verison.
[FYT Android Head Units] WILD9:
To anyone that's used the External DAC mods, are Bluetooth calls routed through the DAC as well? does it still mute other outputs during calls?

edit:

Nevermind, sorry I missed this by RoNeReR:
[FYT Android Head Units] surfer63:
translations of XSofiaTweaker

[MENTION=1806192]mitchum67[/MENTION], [MENTION=8578937]ste2002[/MENTION], [MENTION=2447121]tOz666[/MENTION] (and others):

I added all double-tap, triple-tap options to the strings. Please help translate in your languages. Currently we have English, German, Russian, Spanish and Dutch (which I can do myself), which need to be completed again.

The programming behind all the double tap, triple-tap is not done yet. (gtx made a very good working basis, but I don't want to copy the method for every hooked key)

Other translators are welcome. For instructions see the bottom of this page: https://github.com/hvdwolf/XSofiaTweaker
[FYT Android Head Units] DBestman:
With XSofiaTweaker, is it normal to have a delay if I use a shell script to carry on a key press command?

For example, this super-simple script to start the radio app takes a good 2 seconds before the app starts.

#!/system/bin/sh

am start com.syu.radio/com.syu.radio.Launch

Thanks!
[FYT Android Head Units] gtxaspec:
Yes the delay is an ANDROID limitation. Don't use the shell script! Use the intent function! Instant response.
[FYT Android Head Units] DBestman:
OK Thanks. My objective was to write a script that cycles through my different audio applications, a little like what the default SRC button does, but with my apps.

Any way to do this in an efficient way?
[FYT Android Head Units] surfer63:
For this moment: look at the 2nd post of this thread which contains some kind of HowTo. The double and triple-tap are described there.

gtxaspec wrote a java method in the meantime that does the same. I wrote for all hardware buttons (except HOME) and a few steering-wheel buttons the config settings.

Now I will start looking to implement gtxaspec's method only once for every hooked key, and not embedded in every hooked key. But the counter is a bit of a trouble maker there, unless I simply assume users will not double-tap one key and then single-tap another one.
[FYT Android Head Units] DBestman:
Sorry if I don't quite understand what you mean, but the method detailed in the second post uses a shell script. Thus I'll still be experiencing a delay... right?
[FYT Android Head Units] gtxaspec:
Have you tried to use variables that are set in each hook? Set the variable on the hook, and the init_alt method reads them at each button press.

Also, I was thinking to implement a feature where you select 3 or 4 apps and it cycles through them in XSofiaTweaker, natively, so you don't experience a delay in execution. Stay tuned for this.
[FYT Android Head Units] surfer63:
Yes, but in that case they should be returned to the hook. And they also need a reset time-out as a user indeed presses one key twice, and by accident a another key the third time. Will it then start the double-tap app from the first key and the single-tap app from the second key?

I know the gustden script also defined the loops per key, but it could go wrong there as well as his counters were "globally" defined by default.

But maybe I should not want to catch every wrong typed key by a user. If they type wrong one in a hundred time they exit the app, and do it again. It even happens with single taps on apps on your screen.
[FYT Android Head Units] gtxaspec:
If you press one key twice...it will launch whatever is specified within the 200ms time period...right? If they press another button, then it will launch whatever is on that button...that is the intended scenario...

1. Double tap button 1 to launch Waze

2. I decide I want to launch something else, play music, so I single press button 2

3. Waze launches, and then play music launches.

This is how it works when hard coded in my test setup, and I think this is how the process should work (this is how other apps and devices seem to work that support multiple button presses)
[FYT Android Head Units] DBestman:
Aha! This is exactly what I need!
[FYT Android Head Units] gtxaspec:
hi [MENTION=2550900]surfer63[/MENTION], i have solved the bad functions of the track next/previous/playpause. it now works correctly:

/* Correct the mediaKey function in app/ToolkitApp.java
* Gustdens modified code only sends media keys to the active media player
* The original code uses an intent and "every" media player listening will react. */
findAndHookMethod("app.ToolkitApp", lpparam.classLoader, "mediaKey", int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
int onKey1 = (int) param.args[0];
Context context = (Context) AndroidAppHelper.currentApplication();
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

if (onKey1 == 88) {
Log.d(TAG, "PREV");
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PREVIOUS);
mAudioManager.dispatchMediaKeyEvent(event);
KeyEvent event2 = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PREVIOUS);
mAudioManager.dispatchMediaKeyEvent(event2);
}

if (onKey1 == 87) {
Log.d(TAG, "Next");
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_NEXT);
mAudioManager.dispatchMediaKeyEvent(event);
KeyEvent event2 = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_NEXT);
mAudioManager.dispatchMediaKeyEvent(event2);
}

if (onKey1 == 85) {
Log.d(TAG, "play/pause");
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
mAudioManager.dispatchMediaKeyEvent(event);
KeyEvent event2 = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
mAudioManager.dispatchMediaKeyEvent(event2);
}

param.setResult(null);
}
});

[MENTION=309187]edit[/MENTION] for you! =D

also, I see that the OK google anywhere fix is always enabled, should we not have this in a user selectable toggle? or do we always want it enabled?

i'll work on the int_alt method next to work properly with the settings.
[FYT Android Head Units] surfer63:
Thanks a lot. I will apply it tonight and try to release it tonight.

And with regard to OK Google: I thought this was a bug, and a bug needs to be fixed, no matter whether a user does use or doesn't use that specific part of code.

Am I wrong?

It is of course super simple to apply a selectable toggle to enable/disable it.

Please let me know your view on this, same for the meaning of other users of course.