yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Original Android Development] SilencerOfLambs:
Just dropped in to say that this is some really awesome and great work !!
[Galaxy S II Original Android Development] superlik:
Damn, awesome work..it's like magic to show to my wife

Gesture 2,7,8 not working for me..trying sample script..anyone can help?

just trying to be lazy to read on how to make it :p

RR 3.8,Dorimanx 5.83 beta 5,XXKI4,Extweaks default setting,Cobalt theme
[Galaxy S II Original Android Development] mefistofelis:
How can i remove this script?
[Galaxy S II Original Android Development] Many40:
By deleting the file S50GestureActions from /etc/init.d folder. But don't do that, it's very useful.
[Galaxy S II Original Android Development] Cyb0rgz:
HI All,

Just wanna switch on my display with tasker using shell command at some specific time interval.

I have set a profile to execute with timing context. The shell script is used to turn on and turn off the display. Turn off works fine, but turn on is not working. Just wonder why she'll script are not working when screen is off. It works well when display is on.

Below is the shell command which simulates key press event(power button press event)

Input keyevent 6

Any idea would be appreciated
[Galaxy S II Original Android Development] mefistofelis:
Could anyone just post the complete code with a gesture that swipes between the last 2 apps, without the one being the launcher?
[Galaxy S II Original Android Development] Tungstwenty:
The code I'm using for that is (note that this is for the TW launcher, you can change it for others):

...
elif [ "$GESTURE" == "9" ]; then
service call vibrator 2 i32 100 i32 0
dumpsys activity a | grep "Recent #1:.* com.sec.android.app.twlauncher"
if [ "$?" -eq "0" ]; then
service call activity 24 i32 `dumpsys activity a | grep "Recent #2:" | grep -o -E "#[0-9]+ " | cut -c2-` i32 2
else
service call activity 24 i32 `dumpsys activity a | grep "Recent #1:" | grep -o -E "#[0-9]+ " | cut -c2-` i32 2
fi
...

And for my personal taste I have defined gesture 9 as:

# Gesture 9 - one finger on the bottom left and another swiping right-left-right on the top
9:1:(0|150,600|800) # bottom left
9:2:(330|480,0|200) # top right
9:2:(0|150,0|200) # top left
9:2:(330|480,0|200) # top right
[Galaxy S II Original Android Development] Many40:
Hi,

I just found out by accident on Dorimanx kernel's thread that some guys turn off gestures support to save some battery (couldn't however find any objective explanation for that). On this thread it's stated that gestures don't work during deep sleep, they don't cause any wakelocks, but from other side based on the post beneath gestures script runs as its own process even when the screen is OFF. Furthermore Dorimanx decided in his cortex script to kill the gestures process when the screen goes OFF as he wrote - "...to save very little battery power." So, my question is: is it realy worth to worry about battery draining issue regarding gestures script and if its helpfull to kill the process when the screen goes OFF.

Thanks in advance for your answer. regards

Dorimanx's post from this thread
[Galaxy S II Original Android Development] mefistofelis:
Thx a lot, but i have nova launcher prime, what should i put instead?
[Galaxy S II Original Android Development] Cyb0rgz:
Does input keyevent command listeners doesn't work when screen is off? Just tried to run script to turn screen on with key press event..please help me, I'm struggling a lot in this!!
[Galaxy S II Original Android Development] Tungstwenty:
I have version 1.3.1 installed and it looks like it's "com.teslacoilsw.launcher".

Anyway, you can find it out for yourself:

- Go to the launcher

- Start any other app from there

- Run this on the ADB shell:

adb shell dumpsys activity a | grep "Recent #1:"

This will give you the last activity before the current one, which in my case shows:

* Recent #1: TaskRecord{41b3a698 #7 A com.teslacoilsw.launcher}
[Galaxy S II Original Android Development] Tungstwenty:
Do you run that as a response to touch gestures?

The kernel gestures detection (at least the one I added to Siyah) does not run while the screen is off, since the power is shut down not only from the display but also from the touch sensor in order to conserve battery.
[Galaxy S II Original Android Development] Tungstwenty:
I don't see a reason for the script (the client side, that reacts to detected gestures on the kernel) to be stopped when the screen goes off.

If runs as an infinite loop within shell process, but it's completely idle until a gesture is reported by the kernel.

The crucial part is this one:

Reading from the "wait_for_gesture" pseudo-file blocks until something is reported (or until the process is interrupted, such as a kill). Until then, no cycles are consumed.

The exact same thing happens with the usual screen-aware scripts (probably the cortex reference) that "cat /sys/power/wait_for_fb_wake" and ...sleep to block until the screen switches to ON or OFF.

On the kernel side, the implementation is the same: it uses the "wait_event_interruptible" mechanism to stop until another part of the kernel sends it a signal to wake up and proceed.

Unless something else is at stake here, I don't see a reason for stopping the loop.

You could add something like this right after the above line:

and check that log file for a timestamp of all the times the script woke up with a reported gesture.
[Galaxy S II Original Android Development] might277:
This kernel gesture is cool, but i want to edit the gesture myself. I realize that i can edit the gesture_patern file but cannot open the wait_for_gesture file to define the action? Im using galaxy S2 RR 2.7. The loading of wait_for_gesture file last forever, i cant open this file to edit it. What can i do?
[Galaxy S II Original Android Development] Tungstwenty:
Guess what: wait_for_gesture ... WAITS for a gesture to be detected and returns its code for you (or a script) to launch whatever action you want related to that.

The gesture definition - finger paths - is on gesture_pattern.

But the easiest way is for you to edit the script inside the zip on the OP. Then you can flash it again and end up with the new gesture definitions and trigger the actions you want, after every reboot.
[Galaxy S II Original Android Development] hawkerpaul:
Hi mate.

Do you know if there a command (or am start sequence) I can invoke in order to turn data sync on/off please?
[Galaxy S II Original Android Development] Tungstwenty:
Hi, thanks for bringing this up :)

When I initially went through the existing services, I missed this.

But it's possible to do, just use this bit of code:

service call content 14 | grep "0 00000000"
if [ "$?" -eq "0" ]; then
service call content 13 i32 1
else
service call content 13 i32 0
fi

It will invert the Sync status every time it is called.
[Galaxy S II Original Android Development] hawkerpaul:
cheers mate. You are an absolute star!!!
[Galaxy S II Original Android Development] Mario1968:
Hi Tungstwenty, sorry for the OT, I've read in other thread a post by you to read the status of the light sensor by issue getevent command, i want to use in Tasker profile this method but discovered that the getevent wait for a light change before give a result, there is a method for read the actual value without wait for a change in light amount?

Excuse my English

Mario

P.S. The Tasker variable %LIGHT don't works for me, return the value "%LIGHT" every time I read it.

Inviato dal mio Galaxy S2 con Tapatalk2®

XWLPF Stock

Dorimanx Kernel 5.90

Jkay V14.1
[Galaxy S II Original Android Development] Tungstwenty:
Apparently there's a much easier way indeed, at least on my kernel

/sys/devices/virtual/lightsensor/switch_cmd/lightsensor_file_state

The contents of this file at any given time show the same value as the test panel (*#0*#) :good:

When the screen is off, it goes to a fixed value of 10.
[Galaxy S II Original Android Development] Mario1968:
Thank you, it works for me!

Mario

Inviato dal mio Galaxy S2 con Tapatalk2®

XWLPF Stock

Dorimanx Kernel 5.90

Jkay V14.1
[Galaxy S II Original Android Development] itchetrigr:
Does anyone know the terminal commands I can use to bring up the navigation bar in say paranoid android or an aokp Rom?
[Galaxy S II Original Android Development] hawkerpaul:
Hi again Tungstwenty

Sorry mate, I should have asked before, but do you know if there a command (or am start sequence) I can invoke in order to turn GPS on/off please?

I've read in the thread previously that there may not be a call for this, but wondering if you have managed to crack it?

Cheers
[Galaxy S II Original Android Development] Tungstwenty:
I think it's not possible any more. In previous versions there were similar APIs to toggle it but in the more recent ones it seems that Google has removed them.
[Galaxy S II Original Android Development] hawkerpaul:
Thanks for all your help mate.

Just one more (I promise!!! :) )

Is it possible to toggle flight mode via a gesture?

Cheers mate
[Galaxy S II Original Android Development] Tungstwenty:
I couldn't find a perfect solution, but here goes ...

On ICS

To enable the radio:

service call connectivity 13 i32 0 i32 1

To disable:

service call connectivity 13 i32 0 i32 0

On JB, replace 13 with 14.

If you want a single gesture to perform the toggle, use this to check the current state:

service call phone 11 | grep "0 00000000"
if [ "$?" -eq "0" ]; then
// Disabled, call the code to enable
else
// Enabled, call the code to disable
fi

(code 11 on the phone service is for both ICS and JB)

The missing detail is that you won't get the airplane symbol on the statusbar, but rather the crossed circle. But on the Power menu, you'll see "Airplane mode is ON".

Also, I guess the other radios will keep working unless you disable them as well (e.g. WiFi).

Sources:

IConnectivityManager

ITelephony
[Galaxy S II Original Android Development] karlesg:
In Siyah v5 changelog says that there are some touch gestures optimizations.

Using latest siyah v5b2 invert mdnie colors action is executed only once

gesture->invert mdnie

gesture->default mdnie

mdnie_status=`cat /sys/class/mdnie/mdnie/negative`
if [ "$mdnie_status" == "0" ]; then
echo 1 > /sys/class/mdnie/mdnie/negative
else
echo 0 > /sys/class/mdnie/mdnie/negative
fi

After that, if I trigger the action again with the gesture, it is not executed it doesn't invert mdnie colors. If I reboot the phone the action is executed again but only for once time. With previous siyah there wasn't this problem. It was executed normally again and again with the gesture.

I don't have a problem with other actions I have set, only with this one, for inverting mdnie. Other actions are executed normally again and again.

Is this bug caused from the latest optimizations or from something else?
[Galaxy S II Original Android Development] Tungstwenty:
In newer JB kernel sources, reading the contents of the "negative" file now bring additional lines with extra information, instead of only 0 and 1. That makes the detection of the previous state fail.

We now need to filter the output in order to read only the 1st line of the output, as in:

cat /sys/class/mdnie/mdnie/negative [B]| head -n 1[/B]

I have updated the sample script on the OP with this change, plus 3 additional gestures and actions that I use on an almost daily basis.

PS: The optimizations you mention are just related with some code clean up on the kernel, it won't affect any of the functionality from the scripts.
[Galaxy S II Original Android Development] itchetrigr:
One of my favorite threads on this forum!!!

Any tips on how I can figure out toggljng nav keys ON/OFF in a AOKP ROM?

thanks again for the great work you have done with gestures and this thread...
[Galaxy S II Original Android Development] Tungstwenty:
I don't use an AOKP rom so I'm not sure what you mean by "toggling nav keys on/off".

Could it be something that can be achieved by simulating a key press? If so, "input keyevent ..." might do the trick. Please check the "Key Presses" section on the 3rd post.
[Galaxy S II Original Android Development] hawkerpaul:
Hi Tungstwenty. Me again! :o

Is there any way by gestures to get/set/toggle Silent mode please mate?
[Galaxy S II Original Android Development] Tungstwenty:
Ok, this time it's your turn to learn to fish :). I had a general look and it seems to be possible, but I haven't tried it.

I'll give you a few pointers ;)

An example of an app that apparently does it programmatically: source code

The question is - can it be done through an Intent or a service API?

Find services related with audio:

service list | grep -i audio

Take the one that looks like it's managing the audio, and find the name of its interface, such as IAudioManager or whatever.

Go to http://grepcode.com and search for that "Ixxx" entry, then open the interface (for the version you have - ICS or JB).

Look for entries named TRANSACT_getxxx or _setxxx related with what you want to accomplish.

See where they are used in that same file, to check the kind of parameters expected.

If there are parameters used, go to the developers documentation and see what they mean. In addition, you can also locate the abstract methods in the source file and "find derived methods" to see its implementation on the service, to follow how the parameters are used.

At last, experiment and see what happens.

Let me know your results :)
[Galaxy S II Original Android Development] hawkerpaul:
Cheers butty!

To test for silent mode etc:

service call audio 15 | grep "0 00000002" = sound on

service call audio 15 | grep "0 00000001" = silent+vibrate

service call audio 15 | grep "0 00000000" = silent

To test if sound is off:

service call audio 15 | grep "0 0000000[01]"

if [ "$?" -eq "0" ]

then

Sound is OFF

fi

To test if sound is on:

service call audio 15 | grep "0 00000002"

if [ "$?" -eq "0" ]

then

Sound is ON

fi

To set mode:

service call audio 14 i32 2 - set to sound on

service call audio 14 i32 1 - set to sound silent+vibrate

service call audio 14 i32 0 - set to silent

I'm bit confused as to why the call numbers are 14 and 15, as getRingerMode=(android.os.IBinder.FIRST_CALL_TRANSACTION + 11) and setRingerMode=(android.os.IBinder.FIRST_CALL_TRANSACTION + 10), so I thought the calls would have been 12 and 11, as FIRST_CALL_TRANSACTION=0x0000001

Any ideas on this mate?

In jb, setRingerMode=(android.os.IBinder.FIRST_CALL_TRANSACTION + 19) and getRingerMode=(android.os.IBinder.FIRST_CALL_TRANSACTION + 20).

As I'm on 4.0.4 I can't test what these values should be, so its anyone's guess at the moment.
[Galaxy S II Original Android Development] Tungstwenty:
I'm puzzled as well.

Calling transaction 12 (getRingerMode) always gives 5 in my case (4.0.3), which isn't even one of the valid states mentioned in the documentation.

Probably the most appropriate would be getVibrateSetting (14) which takes an int being 0 = VIBRATE_TYPE_RINGER:

service call audio 14 i32 0

This retrieves the current mode for incoming calls, and returns 0 (silent), 1 (vibrate only) or 2 (sound on)

To change the current state, call setVibrateSetting (15) with 2 params: type (ringer or notification) and mode (silent, etc.)

service call audio 15 i32 0 i32 0/1/2

Setting to 2 isn't fully working for me, though. I wonder if this has anything to do with the JKay mod.

And about get/setRingerMode, which would make sense, the API mentions that get/setVibrateSetting is deprecated as of API level 16 (JB) and get/setRinger should be used instead, on a per-app basis. I'm not sure whether this means that the shell has a context different than the "global one"...
[Galaxy S II Original Android Development] Napalm Candy:
Why not to make an app to do new gestures like we use today a smartphone?

I did not see the need, to write code. Be practical, it is hard work, but easy yo use, and will use everybody

Take it as a positive criticism, your idea it is a great ideas only need to be finish :)
[Galaxy S II Original Android Development] Many40:
Hi, it is finished because it works :). If you were able to (assume) root your phone, and find this post, you should be able at least to edit text file, copy/paste already prepared gesture solutions and flash it via custom recovery. If not buy an iphone.

Have a nice day.
[Galaxy S II Original Android Development] Tungstwenty:
I agree 100%. It would be hard work, but easy for the users.

Let me know when it's ready. I personally don't need it, but some of my friends prefer using apps instead of editing a few lines on a script ;)
[Galaxy S II Original Android Development] rakeshishere:
He meant "polished" and he used wrong word there ;)
[Galaxy S II Original Android Development] robertogl:
i'd like to swype from top to bottom, only in the home, to move down the notification bar, without having to start from the bar..is it possible? Thanls :)
[Galaxy S II Original Android Development] Flint2:
I'm developing a gui for your superb code, the main objective now is build the gesture string and paste it to clipboard, next step adding actions, browsing for apps, parse current config script and generate the whole script.

It's open source, i commit every time i modified it.

Link to code:

https://github.com/flint2/KernelGesturesBuilder

Will let you now when i'ts ready, maybe post new OP to request for feedback, bugs, and new features, and support users

Any dev feel free to contribute or fork it
[Galaxy S II Original Android Development] rakeshishere:
Possible using behavior options in Apex launcher. No need to use a custom kernel or write a script :p
[Galaxy S II Original Android Development] Kondra007:
Hi! Sorry for my bad English

Trying to make some gestures. I'm using DorimanX Kernel v7.4.2 (which supports gestures) and JellyBam 2012_10_30 firmware

I've carefully read the whole instruction multiple times but still can't understand it.

I've asked a question here

http://xdaforums.com/showthread.php?p=33675349#post33675349

Now I managed to make 2 scripts work, but when I add the third one, it breaks :(

Could you please explain?
[Galaxy S II Original Android Development] Tungstwenty:
Did you try flashing the sample script in the OP, with all gestures? If they work (they should), then if it stops working when you edit the script it is probably due to Windows line terminators instead of Linux ones, or wrong permissions after you place the modified script.
[Galaxy S II Original Android Development] Kondra007:
Flashed script in OP, edited in Notepad++

Doesn't work :(

Maybe I should edit file in Gedit in Linux?
[Galaxy S II Original Android Development] Tungstwenty:
And the original file did work?

Post your changed script.

Also execute this on a terminal / ADB and post the output:

ls -la /etc/init.d
[Galaxy S II Original Android Development] Kondra007:
here's script

http://pastebin.com/dBPHD1pe
[Galaxy S II Original Android Development] Tungstwenty:
You have this when testing which gesture was found:

elif [ "[COLOR="Red"]#[/COLOR]GESTURE" -eq "2" ]; then

But it should be a "$" instead of "#", like you have in gesture 1. And the same for gesture 3.
[Galaxy S II Original Android Development] Kondra007:
Oh,thanks a lot. But script still doesn't work on Siyah 5.0i (latest). Nothing adds to gesture_ pattern file.

I'll try Dorimanx 7.4.2.
[Galaxy S II Original Android Development] Tungstwenty:
Here's the script I'm personally using on 5.0i and it's working fine. I don't think it's the kernel.

Note that there's a limit of 4k when writing to 'gesture_patterns', that's why I'm piping through sed to remove all the comments while still keeping the gesture definitions human friendly, since I have many gestures.

But in your case that's not an issue for sure, since you only have 3 gestures.

If you want to try this one, don't forget to remove the extension otherwise it won't be picked up from init.d for automatic execution on boot.
[Galaxy S II Original Android Development] hawkerpaul:
Also note that on DorimanX you need to save your gestures to /data/gesture_set.sh and not use the init.d script.
[Galaxy S II Original Android Development] mekhonte:
Hello guys

I wanted to change the gesture config of siyah v.5i with the one in dorminax, but I've got no luck.

I tried to copy the file from /data to /etc/init.d/ and changing the file name, no luck!

Opend NotePad ++ and replaced the lines, still nothing...

I'll be thankful if sb gives a hint.
[Galaxy S II Original Android Development] Kondra007:
Copied script from first post, rebooted and saw this...

http://cs405726.userapi.com/v405726512/4717/N2oX_jPmui4.jpg

Gestures are "unseen" :(
[Galaxy S II Original Android Development] Tungstwenty:
What filename did you use? Make sure you don't have any dots in the filename.

Please post the current results of "ls -la /etc/init.d/".
[Galaxy S II Original Android Development] hawkerpaul:
Move the .bak file out for starters, as linux executes everything in init.d, so the script will be running twice, and the gestures file is probably getting overwritten by the other continuously.

By the way, what app do you use to get a shell prompt?
[Galaxy S II Original Android Development] Kondra007:
I'm using this app to get a shell prompt.

Deleted .bak file, rebooted - still no changes :(
[Galaxy S II Original Android Development] hawkerpaul:
Did you reboot?

1. What kernel are you on?

2. post up the script
[Galaxy S II Original Android Development] Kondra007:
Of course, I rebooted.

Kernel Siyah 5.0i

the script is the same as in the first post.
[Galaxy S II Original Android Development] Tungstwenty:
The .bak file is not executed, as only files containing letters, numbers, dash (-) and underscore (_) chars are picked up for execution. A filename with a dot (.) will be ignored - at least on Siyah, but I'm guessing it's the same in pretty much all kernels.

The problem is with the permissions. You only have rw for root, it's missing the x (execute) bit.

You can use 755 (rwxr-xr-x) as the permissions, that will make the script be executed at startup.
[Galaxy S II Original Android Development] Kondra007:
Oh..still not working :(

Screen of gesture_patterns file

http://cs405726.userapi.com/v405726512/4717/N2oX_jPmui4.jpg

(yes, screenshot was made yesterday, but nothing changed in this file since then)

And permissions for S50GesturesActions file (sorry for Russian language)

http://cs406223.userapi.com/v406223512/3b10/uQkDaaWngOM.jpg
[Galaxy S II Original Android Development] Tungstwenty:
Can you try running the script directly from a su shell and see if the gesture definitions are loaded?
[Galaxy S II Original Android Development] Kondra007:
Could you tell me, how can I run script?
[Galaxy S II Original Android Development] Tungstwenty:
Open the terminal

Make sure you're root (run "su" if not, or you can run it anyway)

Then execute "/etc/init.d/S50..." or whatever

It should return to the command prompt and have launched in the background:

- wrote the gesture definitions to that "file" you mentioned

- loop waiting for gestures to be triggered and react to them / launch actions

EDIT:

I went back to your pastebin link and found the problem. Here's an excerpt:

2:1:(320|480,160|320)

# Gesture 3 - small V on the lower side
3:1(0|160,480|640)
3:1(160|320,640|800)

You're missing a ":" between the 2nd digit (finger number) and the "(" that starts the coordinates. It should be "3:1:(..."
[Galaxy S II Original Android Development] Kondra007:
writes "Applet not found"
[Galaxy S II Original Android Development] karlesg:
I have added an extra command for tweaked and more intense mdnie colors for outdoor, at the indoor - outdoor mode I posted here.
[Galaxy S II Original Android Development] Flint2:
Kernel Gestures Builder

Dear Tungstwenty and gestures community:

I've developed an app to define gestures, please visit the

Kernel Gestures Builder OP

http://xdaforums.com/showthread.php?p=34022960

Thank's for your feedback!
[Galaxy S II Original Android Development] Heroeagle:
hiii

i cannot edit wait_for_ gesture file each time i try to open it using text editor i don,t hane any response only black screen then root exploler not responding