[FYT Android Head Units] surfer63:
XFytTweaker HowTo

(previously XSofiaTweaker)

Every button or event (acc_on/off) has a "Call method" and a "String to be used".

Currently there are 3 options to "start something" with the "Call method"

by package name

by intent (package name / intent)

by system call (terminal command(s) or script)

by package name: This is NOT the name of the apk but the internal package name. How do you get this "package name"?

Use the "List all Installed apps" option in the main screen of the settings. It shows the app icon, the app name and the package name. This package name is what you need. You can select it and copy & paste it into the field.

use the "Display my installed apps (with package name)" option from the JET apk from the top-left menu.

Search in play.google.com for the app you want to start. Say you want to start the navigation app "Magic Earth" and you have selected that one in the play store (in a browser, not the android app). In the address bar you will then see "https://play.google.com/store/apps/details?id=com.generalmagic.magicearth". The bold part behind the "id=" is your package name.

by intent: Every app has a "launch" intent to start the app. Some apps can also be started with other intents to immediately start a specific function. Google Search can be started with the launch intent, but you can also start it with the Google Voice search option intent. The Google (Search) package name is "com.google.android.googlequicksearchbox", the specific intent for google voice search is "com.google.android.googlequicksearchbox.VoiceSearchActivity". The combined "String to be used" is therefore "com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.VoiceSearchActivity".

Another example is the Joying Bluetooth apk having intents for the dialer (default launch), the call receiver, the bluetooth streaming, the pairing and a few more.

by system call: A system call can be a direct (linux) command or a shell script or a binary (to do something).

= Commands can be a single command as in:

"ls -l > /sdcard/some_file.txt" to capture a directory listing to a file

"input keyevent 3" => Go to the Home screen (of the default launcher)

"am start -a android.intent.action.MAIN -c android.intent.category.HOME" => Go to the Home screen (of the default launcher)

"input keyevent 127" => pause active media player (any media player)

"input key event 126" => (re)start last used media player.

"am start com.syu.radio/com.syu.radio.Launch" => Start the radio app with the default launch intent (or better use "by package name": com.syu.radio; Or use "by intent": com.syu.radio/com.syu.radio.Launch)

As you can see from the 2nd and 3rd example, there are multiple ways to do something.

From the 6th example you can see that you can start an app (the radio) from the command line with "am start <full intent>", or by package name, or by intent directly.

= A system call can also be a number of commands separated by a ";".

Say you want to pause the media player and switch of the leds, when switching of the contact (ACC_OFF event), you can use as "String to use"

input keyevent 127; echo -n "h" > /sys/fytver/colorled

Upon switching on your car, you might want to continue your media player and switch on your leds to green

input keyevent 126; echo -n "b" > /sys/fytver/colorled

Note that you need to separate the commands with a ";" (a semi-colon without the quotes). I have currently no idea how long the entire command can be but I assume some system standard like 255, or 1024 or 2048 or 32767 or 65535, but I advise to use a script anyway when it gets that long (see next point)

= A system call can also be a call to a shell script

Say you want to pause the active media player and switch off the leds (like the example above), you can also put these commands (and 2-200? more) in a script like:

#!/system/bin/sh
input keyevent 127
echo -n "h" > /sys/fytver/colorled

You copy that script to a location where you can give it the execute bit (necessary on linux), which means not the internal or any external sdcard, but for example /data. You need adb, a rooted terminal or a rooted file manager to do that. Give it the execute rights like "chmod 755 my_great_script.sh"

Multi-tap options (preferred method)

The XFytTweaker and previously the XSofiaTweaker (since v1.22) directly supports double-tap and triple-tap options for hardware and steering wheel buttons, thanks to [MENTION=520205]gtxaspec[/MENTION].

Simply assign a call option and call entry to the double-tap and triple-tap option. The default delay is 300 ms, but this is user configurable via the "tap delay" setting.

Using NoKill and experiencing cold boots

The NoKill module/option in XFytTweaker is NOT the cause of the cold boots! Bad behaving apps keeping the CPU awake by setting a "wake lock", thereby preventing the unit to go into deep-sleep, are the cause. They make the MCU shutdown the unit completely after about 20 minutes.

The original sofiaServer app simply kills everything, so no problem there.

Especially some GPS, tasker and media player apps are bad behaving apps holding a "wake lock".

You can completely, safely use the NoKill option, but you should find those bad behaving apps and get rid of them, or kill them on going into deep-sleep using the ACC_OFF event and start them again using the ACC_ON event.

To kill an app on going into deep-sleep and start it when coming out of deep-sleep, AND to pause any mediaplayer on going into deep sleep, you can for example use the ACC_OFF option with a "system call".

am force-stop com.waze; input keyevent 127

And in the ACC_ON command to restart waze (in this case) and restart any media player on coming out of deep sleep:

am start com.waze/.MainActivity; input keyevent 126

Multi-tap options (deprecated method)

The customkeymod from Gustden and my sofiaservercustomkeymod xposed module both use the launcher script that enables multi-tap options.

The XFytTweaker (previously XSofiaTweaker) does support that as well using a script approach by using a "by system call". But it is advised to use above mentioned method.

So lets say we want to capture the src/mode button and assign 3 apps to that by consecutive key-presses, and lets say we call our script "src_mode.sh"

#!/system/bin/sh

# Goto Home screen
home="input keyevent 3"
# my apps
app_no1="blah"
app_no2="blahblah"
app_no3="blahblahblah"

last=`cat /data/src_mode.cnt`
last=$((last+1))
case $last in
1)
echo $last > /data/src_mode.cnt
(sleep .7 && [ `cat /data/src_mode.cnt` = $last ] && echo 0 > /data/src_mode.cnt && ${app_no1} ) &
;;
2)
echo $last > /data/src_mode.cnt
(sleep .5 && [ `cat /data/src_mode.cnt` = $last ] && echo 0 > /data/src_mode.cnt && ${app_no2} ) &
;;
3)
echo 0 > /data/src_mode.cnt
${app_no3}
;;
*)
echo 0 > /data/src_mode.cnt
$home
;;

esac
;;

Save that script to /data as "src_mode.sh" (for example) and make it executable "chmod 755 src_mod.sh". Make the call method in the XFytTweaker "system call" and the string "/data/src_mod.sh"

Assign full launch intent calls to the ${app_no1} for your apps.

In case of google maps like

app_no1="am start com.google.android.apps.maps/com.google.android.maps.MapsActivity"

And use something more logical that "app_no1" ;)

- Use an editor that can handle unix line ends/line feeds, so not notepad.

- Some of the "complaints" about the previous mods from gustden was the "delay". This was also caused by the multitap, as the scripts waits 0.7 seconds for the second tap, and 0.3 seconds for the 3rd tap. If you are a "fast tapper", you could reduce this to 0.5 and 0.3 (or 0.2) seconds.

(Will be further expanded)