yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Original Android Development] Computoncio:
Just reporting that the TouchGesturesSample-v1.1 now boot's my phone without any problems.

Using Resurrection Remix JB v3.0.4 & siyah v4.1beta6.

Awesome idea Tungswenty, congrats
[Galaxy S II Original Android Development] ggs2:
ahh bill gates will be angry to see this :P
[Galaxy S II Original Android Development] rakeshishere:
The gesture for launching camera app from sample flashable zip doesn't work on Sammy rom on lockscreen itself. It works everywhere else and I changed lockscreen type from PIN to swipe and vice versa and still no results.

I'm using stock camera app by the way
[Galaxy S II Original Android Development] OGroteKoning:
It does work, but it does not unlock the screen and go into the camera app. When I did this, the camera app started the moment I unlocked the screen. So Yes and No I guess - It works, but not the way we want it to from lock screen
[Galaxy S II Original Android Development] 000zui:
+1

Anyway works perfectly now, thank you and gm really a lot for this delicious feature.

GSII @ NeatRom Lite XWLPI / CMX 20120815 # Siyah 4.1b6 # Jkay&Mod personali
[Galaxy S II Original Android Development] rakeshishere:
During my testing, this is what I noticed as well. You have manually unlock the screen after performing the gesture
[Galaxy S II Original Android Development] majkicimo:
thank you very much,its great sir Tungstwenty:good:

No problem with stock LQB 4,0,4 and syiah kernel beta 6

In the next version will be some new predefined gestures?F.e closing apps ....thx
[Galaxy S II Original Android Development] hawkerpaul:
If you want the vibrate feedback on ANY captured gesture, do the following:

( while [ 1 ]

do

GESTURE=`cat /sys/devices/virtual/misc/touch_gestures/wait_for_gesture`

if [ "$GESTURE" == "1" ]; then

.

.

.

.

fi;

if [ "$GESTURE" -gt "0" ]; then

# Small vibration to provide feedback

service call vibrator 2 i32 100 i32 0

echo reset > /sys/devices/virtual/misc/touch_gestures/wait_for_gesture # (optional)

fi;

done ) > /dev/null 2>&1 &

Some have already been posted, but here is my list of key events:

# Simulate key press (input keyevent)

# 3 = Home

# 26 = Power

# 24/25 = Volume up/down

# 84 = Search

# 85 = Media Play / pause

# 86 = Media stop

# 87/88 = Media next / previous

# 164 = Volume mute / unmute

# 176 = Settings

# 187 = Recent apps

# 208 = Calendar

# 209 = Music

# 210 = Calculator

# 211 = EMail

# 212 = Brightness Up

# 213 = Brightness Down

# 214 = Recent Apps (too)

# 215 = App Drawer (allows you to jump to App Drawer from any place except for Lock screen)

# 220 = Voice Search
[Galaxy S II Original Android Development] Grimmy1st:
Thx for the samples, no boot problems with cm9, but camera trigger doesn't work. No problem with mdnie.

In fact only mdnie works...
[Galaxy S II Original Android Development] Tungstwenty:
As I mentioned before, the behavior of the camera app (at least the Samsung one) is that unlike the Phone app, Camera is not prepared to work in "lockscreen mode". This happens with almost all apps and for a valid reason - you won't want the lockscreen to not "lock" the contents of your device :)

However, I found a way to make it work a bit like Phone does - open camera even with the lockscreen active, allow taking pictures, but not allow you to browse the previous photos, delete them, etc.

I'm using an Xposed mod for that (you can read about it on the link in my sig), but it's very raw for now and not ready to be posted. As soon as I clean it up and have all the validations properly working, I'll post it so at least those of you using the stock app can have this enhancement.

Likewise, it would be great for me to e.g. open up the Memo app from the lockscreen, do now allow reading old memos but allow creating new ones. However, I tried the same approach as I did for the Camera and it's much more complex.

I can imagine a handful of apps would be great to have available with this philosophy. I'm hoping that after I share the sources for the Camera changes, someone can start doing it for other stuff :)

Is the camera open after you unlock the screen? If so, the gesture is detected, but the issue I just explained is happening which is normal.

Gesture 3 is not configured to dial anyone, you'll need to edit the script and uncomment the line for it to do it (I don't know who do you want to call).

Also, did you try the additional gestures 4 to 8 (see OP)?
[Galaxy S II Original Android Development] danividalg:
Unlock and run app with tasket :)

Hi,

Thanks for this great feature XD

Here is how I have made Unlock and run an App:

On the action I modify a file on the sdcard

echo 'camera' > '/sdcard/external_sd/Siyah Gesture Actions/action'

On Tasker I use the File Modified event and if this file is modified then read the first line and depending of the word readed unlock the phone and run the appropiate app :)

This will leave our device unlocked so, if you turn off the screen and then push "home" or "power" buttons the phone will wake up without unlock screen (even slide or pin)

What I have done to re-lock the phone is to create another Tasker event that runs on screen off event and if "lock" is off then turn it on

I want to put screenshots to clarify but I have my phone hardbricked (is a long story) and waiting for it to be repaired.

If anyone need this screeshots to clarify ask for it and I will post it as soon as I can.

Best regards :)
[Galaxy S II Original Android Development] hawkerpaul:
@Tungstwenty.

May be worth adding variables to the init.d script for easier future reference. For example:

#!/sbin/busybox sh

GESTURE_DIR=/sys/devices/virtual/misc/touch_gestures

GESTURE_PATTERNS=${GESTURE_DIR}/gesture_patterns

GESTURE_DETECT=${GESTURE_DIR}/wait_for_gesture

so the script can access the the files thereafter like this:

" > ${GESTURE_PATTERNS}

GESTURE=`cat ${GESTURE_DETECT}`

echo reset > ${GESTURE_DETECT}
[Galaxy S II Original Android Development] AlkaDragos:
Well, that's an interesting approach method. ;) all you have to do with gestures is to write something to a file that can be parsed later and do anything you want with Tasker, that way you don't have to struggle with direct call methods for starting an application / make a call / or anything like that, and also IMO, you have more options to play with. Thank you for this idea.
[Galaxy S II Original Android Development] Grimmy1st:
Yeah tried the other ones, but they don't work on cm9 (only mdnie toggle). Tried camera with and without lock screen, doesn't work either.
[Galaxy S II Original Android Development] danividalg:
You're welcome :)
[Galaxy S II Original Android Development] wjchen0:
In cm10 this command "input keyevent 187" to show recent apps not work.

Then I find something interesting use google.

The input keyevent is very slow and sometimes not work,recommend use sendevent.

Use this command to emulate home key long press:

sendevent /dev/input/event1 1 102 1
sendevent /dev/input/event1 0 0 0
usleep 500000
sendevent /dev/input/event1 1 102 0
sendevent /dev/input/event1 0 0 0
[Galaxy S II Original Android Development] Zalastax:
You seem to want to do the same thing as me! I would like previous/next app by swiping.

Is it possible to get running apps list? Or last app in focus.

I wanted to do it in Tasked but Start last app didn't work for me.
[Galaxy S II Original Android Development] Westi01:
Is there a way to toggle Outdoor mode from CM's extended settings with this gestures? Would be awesome!
[Galaxy S II Original Android Development] karlesg:
I don't use a CM rom but a Sammy one. What does CM when you choose outdoor? Most probably it will toggle between max gamma and default gamma.

Anyway 2-3 pages back I posted an indoor-outdoor script. Try it and see if the result is the same with CM's outdoor mode.
[Galaxy S II Original Android Development] Westi01:
Thanks for your reply but I got stuck at making a init.d script for that. I placed the script in system/etc/init.d and it looked like:

#!/system/bin/sh

#
# Sample touch gesture actions by Tungstwenty - xdaforums.com
#

echo "
# Gesture 1 - swipe 1 finger near the top and one near the bottom from left to right
1:1:(0|150,0|150)
1:1:(330|480,0|150)
1:2:(0|150,650|800)
1:2:(330|480,650|800)

" > /sys/devices/virtual/misc/touch_gestures/gesture_patterns

(while [ 1 ];
do

GESTURE=`cat /sys/devices/virtual/misc/touch_gestures/wait_for_gesture`

if [ `cat /sys/class/lcd/panel/user_gamma_adjust` != "50" ]; then
echo "50" > /sys/class/lcd/panel/user_gamma_adjust
else echo "0" > /sys/class/lcd/panel/user_gamma_adjust
fi

done &);

After reboot I got stuck in the Kernel boot Screen. What am I doing wrong?
[Galaxy S II Original Android Development] karlesg:
The script I posted is an action for a certain gesture. So you have to replace an existing action in Tungstwenty's script, with the indoor - outdoor action.

Let's take for example the script in OP, and let's say that you want with gesture #2 instead of opening the camera, to execute the indoor - outdoor mode. In this case the script in OP must be...

( while [ 1 ]
do

GESTURE=`cat /sys/devices/virtual/misc/touch_gestures/wait_for_gesture`

if [ "$GESTURE" -eq "1" ]; then

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

elif [ "$GESTURE" -eq "2" ]; then

# Indoor - outdoor mode
if [ `cat /sys/class/lcd/panel/user_gamma_adjust` != "50" ]; then
echo "50" > /sys/class/lcd/panel/user_gamma_adjust
else echo "0" > /sys/class/lcd/panel/user_gamma_adjust
fi

elif [ "$GESTURE" -eq "3" ]; then

# Edit and uncomment the next line to automatically start a call to the target number

### EDIT ### service call phone 2 s16 "133"

fi

done ) > /dev/null 2>&1 &

-edit

the above IS NOT the whole script that you must put in your init.d folder.

You must replace in Tungstwenty's script that you downloaded from the first page

this

# Start the camera app
am start --activity-exclude-from-recents com.sec.android.app.camera

with this

# Indoor - outdoor mode
if [ `cat /sys/class/lcd/panel/user_gamma_adjust` != "50" ]; then
echo "50" > /sys/class/lcd/panel/user_gamma_adjust
else echo "0" > /sys/class/lcd/panel/user_gamma_adjust
fi
[Galaxy S II Original Android Development] Westi01:
Ok I have it applied and it is rebooting normal. But nothing is showing up when doing this gestures ... Too bad...

Edit: I am on the latest Siyah on my Galaxy SII
[Galaxy S II Original Android Development] karlesg:
Try executing this script with superuser rights, with an app like script manager.

if [ `cat /sys/class/lcd/panel/user_gamma_adjust` != "50" ]; then
echo "50" > /sys/class/lcd/panel/user_gamma_adjust
else echo "0" > /sys/class/lcd/panel/user_gamma_adjust
fi

If something happens, then you are doing something wrong editing Tungstwenty's script.

If nothing happens then I don't know what's wrong...
[Galaxy S II Original Android Development] Grimmy1st:
Sorry, don't know what was wrong, gestures work like a charm, maybe I executed them to fast.

Thx anyway
[Galaxy S II Original Android Development] Scarface1991:
I am really interested in the swiping gestures. I want to define 3 gestures.

1. Pause/Play Media (if possible swiping with 2 fingers from top to bottom)

2. Media Next Title (If possible swiping with 2 fingers from left to right)

3. Media Previous Title (If possible swiping with 2 fingers from right to left)

The problem is that I don`t have any programming skills at all. My question is maybe someone here already has done what I mentioned above (Or something similar)? It would be so awesome if someone could post the script for this.
[Galaxy S II Original Android Development] bamthwok:
Hi, this is one of the most amazing features and I feel we are not making full use of it yet.

For me the basic script works except that I can't make trigger any "am start" command. I appreciate if someone can post a couple of examples that I could test.

Furthermore, is there a possibility to lock the screen first (maybe with a simple gesture) before executing the main gesture.

Sometimes I end up triggering an event but I also change my drawer items, or I move icons of the home screen. It would be cool to find a method to avoid that.

I really hope this thread will stay alive for a long time!
[Galaxy S II Original Android Development] AlkaDragos:
One little question, how did you unlock the lockscreen? Do you use the stock lockscreen or widgetlocker? I just got this and gonna create my own actions through tasker :P also if you can post your tasker profile would be helpful too (just in case i don't do this until i get the reply :P). Thank you
[Galaxy S II Original Android Development] ggs2:
anyone please how to expand notification bar with gesture? i cant do it ... in any way :(
[Galaxy S II Original Android Development] ksilver89:
I have to modified a little to get camera working too, but mine is on jelly bean. Don't know if it will work on cm9.

am start --activity-exclude-from-recents com.android.gallery3d/com.android.camera.CameraLauncher

By the way, is anyone could possibly know how to execute this command in gesture script? I found this line in GlobalActions.java. I'm trying to toggle expanded desktop in ParanoidAndroid rom with gesture, it'll save a lot of time switching out between fullscreen apps.

Settings.System.putInt(mContext.getContentResolver(), Settings.System.STATUSBAR_STATE, Settings.System.getInt(mContext.getContentResolver(), Settings.System.STATUSBAR_STATE, 1) == 1 ? 0 : 1);

It's written in C or Java...
[Galaxy S II Original Android Development] anagrams:
This sounds promissing !

To install on CyanogenMod9, just need to reboot to recovery and install from zip?

Thanks !
[Galaxy S II Original Android Development] jonitfcfan:
Pretty much :).
[Galaxy S II Original Android Development] Tungstwenty:
I have already included it in the 1.1 sample script, in the CWM package on the OP.

Can you check if that's working for you?

I have included in the '3 fingers down' gesture launching 3 different "am start" commands to cover more scenarios, including that one.

I just found out how to do it. Here's the solution and how I reached it:

# service list | grep -i Status
37 statusbar: [com.android.internal.statusbar.IStatusBarService]

Now, search grepcode.com for IStatusBarService, and go to the 4.1.1 entry: http://grepcode.com/file/repository...sbar/IStatusBarService.java#IStatusBarService

Scrolling to the bottom of the left pane, you'll see the list of transactions supported by our "statusbar" service, which can be called by "service call statusbar nn ...params...".

For this particular case, you're looking for TRANSACTION_expand, which is 1 (FIRST_CALL_TRANSACTION is 1, +0 = 1).

Searching for the place where it's handled, to check any expected params, you'll find this line. There are no required params, so issuing this:

service call statusbar 1

will expand the statusbar just like you want.

Likewise, you can call TRANSACTION_collapse, TRANSACTION_toggleRecentApps, etc., which also don't require params.

You can use the "service list" command to see other services that exist and explore what you can do with their interfaces.

That's what I did when I added the additional examples in the OP, in particular the bluetooth and wifi toggles.
[Galaxy S II Original Android Development] deklica:
Use "Lock Desktop" feature in Apex Launcher and icons not move...
[Galaxy S II Original Android Development] Tungstwenty:
Here are 2 commands you can use to disable and enable dispatching events.

If you map a "simple" gesture to the first one, you'll essentially prevent events to be delivered to the windows and therefore seem like nothing is being pressed. The kernel sill still detect the touches, obviously, so you can reenable them by invoking the 2nd command.

For ICS:

# Disable
service call window 18 i32 0
# Enable
service call window 18 i32 1

For JB:

# Disable
service call window 15 i32 0
# Enable
service call window 15 i32 1

Example for use:

- Map a simple gesture, like touching the top left and bottom right at the same time, to the service call to disable event dispatching

- Whenever wanting to do something and you're in the middle of some app that might become confused (launcher, for instance), touch the 2 corners and after that you can freely swipe the complex gestures

- Make sure to call the enable code in every other gesture so that after processing the gesture, in addition to the result it does it also re-enables event dispatching

BTW, another command I found that might be useful - Force Stop a package (both for ICS and JB):

service call activity 79 s32 com.swype.android.inputmethod

This example is for swype (find others with "pm list packages") because in my device sometimes swype will stop responding to any touches and it requires me to change the input method, go to apps to force close it, and then change it back. With this, it's much faster.
[Galaxy S II Original Android Development] itchetrigr:
Is it possible to redefine the gestures by executing a script or shell commands? or must it be done on boot? I'm thinking that this can be used to over come the 10 gesture limit...
[Galaxy S II Original Android Development] Tungstwenty:
You can do it at any time:

echo " ..... whatever you want ..." > .../gestures_definition

will overwrite all defined gestures with the new data you're passing it.

However, note that if you're using the approach from the CWM sample file, the loop that handles the actions will keep running, even if the movement definitions have changed.

Anyway, in the latest Siyah build the limit is already raised to 30. I hope now it is enough :)
[Galaxy S II Original Android Development] Mahdi786:
Hi, thanks for the answer about statusbar service call 1, in paranoid there is a setting in the globalactions menu were you can hide the tablet statusbar, would you know how to execute that with a gesture?
[Galaxy S II Original Android Development] Many40:
Hi Tungstwenty,

Appreciate your work - gestures' support in Siyah is awesome!

Just went through your thread and didn't find a solution to toggle mobile data on/of in similar way as WiFi or bluetooth. I found commands to do so separately:

-> Mobile Data ON:

service call connectivity 14 i32 1

-> Mobile Data OFF:

service call connectivity 14 i32 0

However don't know how to put it together as complete command to be usable in the script. Could you advise me? Thanks.
[Galaxy S II Original Android Development] Tungstwenty:
Check the examples for BT and WiFi on the published CWM file. Example for Bluetooth:

# Toggle bluetooth on/off
service call bluetooth 1 | grep "0 00000000" > /dev/null
if [ "$?" -eq "0" ]; then
service call bluetooth 3 > /dev/null
else
[ "$is_jb" -eq "1" ] && service call bluetooth 5 > /dev/null
[ "$is_jb" -ne "1" ] && service call bluetooth 4 > /dev/null
fi

# Small vibration to provide feedback
service call vibrator 2 i32 100 i32 0

For your case you'll want to use TRANSACTION_getMobileDataEnabled and TRANSACTION_setMobileDataEnabled (not 14 I think, but try it out). And it might have different codes for JB and ICS, so use the $is_jb variable I defined in the beginning of the script.
[Galaxy S II Original Android Development] Tungstwenty:
I'm not sure whether that's possible using already existing code and invoking it via a script. But I'll need to have a look at the sources to confirm it.
[Galaxy S II Original Android Development] alojo:
Nice work, I'll have to study how to use it.

Thanks
[Galaxy S II Original Android Development] Tungstwenty:
I looked at the interface for the status bar service but unfortunately it doesn't look like there is a way to issue one of the "service call ..." commands to obtain that result.
[Galaxy S II Original Android Development] danividalg:
Hi,

I use stock pin lock screen, but I have tested it with standard slide lockscreen and works too.

In the task add an action Screen --> Lock --> Off

This will disable your lockscreen so if you turn off your screen and then turn it on you will not see the lock screen

To activate the lockscreen again make another profile that triggers on screen off event, then in the task of this profile add an action Screen --> Lock --> On

That will re-enable lockscreen after your device screen goes off

Best regards :)
[Galaxy S II Original Android Development] Robse86:
Gesture for switching between the last two apps?

Heya to all you cracks :), like my title already says: Is it possible to make a gesture which switches between the last to used apps?

Its kinda of annoying to always hold and wait for the "recent apps" menu and click the app to use. To make it clear, here an example:

Im using the browser and someone writes me on whatsapp. I switch to whatsapp and once im finished I make the gesture and it goes back

to the browser, again the gesture and it goes to whatsapp, etc..

If this isnt possible (or ever wont be) please tell me. If yes (not possible), then is it possible to make a gesture for the recent apps menu?

So at least the pushing and waiting for it will be gone.

Thanks in advance.

Greets
[Galaxy S II Original Android Development] ksilver89:
I have also read and played around with the "service call" command for the whole day, but as you said it is quite impossible unless they change the source. :( Thanks anyway!

I decided to go with the "noob" method to send input for long press power key and touch in order to toggle show/hide status bar manually, which slightly automate the process.

# Long press power key
sendevent /dev/input/event1 0001 116 1
sendevent /dev/input/event1 0000 0 0
sleep 1
# Release power key
sendevent /dev/input/event1 0001 116 0
sendevent /dev/input/event1 0000 0 0
# Send touch
sendevent /dev/input/event2 3 57 1
sendevent /dev/input/event2 3 53 240
sendevent /dev/input/event2 3 54 460
sendevent /dev/input/event2 3 48 40
sendevent /dev/input/event2 3 58 3
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 3 57 4294967295
sendevent /dev/input/event2 0 0 0

It will look a little bit funny but hopefully this can be improved.

Note: oh ya, it would take screenshot on landscape view...dual function...lol
[Galaxy S II Original Android Development] Tungstwenty:
Great idea!

It can be achieved using the "activity" service.

First, use dumpsys to know the task id of the previous app (Recent #1):

previous_task=`dumpsys activity a | grep "Recent #1" | grep -o -E "#[0-9]+ " | cut -c2-`

After that, invoke MOVE_TASK_TO_FRONT_TRANSACTION (24) with that task id and with the MOVE_TASK_NO_USER_ACTION flag (2) so the previous one is not exited:

service call activity 24 i32 $previous_task i32 2

Just place both lines one after the other in the script, on the gesture id you want, and off you go ;)

PS: I've started collecting all kinds of actions in the 3rd post, will try to place them all there later tonight.
[Galaxy S II Original Android Development] Robse86:
OMG!! This is aweeeeeeeeeeeeeeeeesome :D. Thank you so much! Its been a pain in my ass for a long time! In generell your kernel based gestures are a really good idea! Love it :). People like you make android better and better! Im gonna try to implement it on my own, hopefully it works, if not I wait until u do it :D.

Thanks n greets :)

EDIT:

Okay so I replaced Gesture 8 with the two lines of code you made and cut off the gesture to only moving once from left bottom to right bottom, works like a charm, this is pure AWESOMENESS!

I attached the file incase someone wants to try it!
[Galaxy S II Original Android Development] wakaru:
Service call to activate/deactivate the GPS

First of all, thanks very much for your brilliant work on this kernel feature.

I would like to activate/deactivate the GPS with a touch gesture.

Could anybody help with letting me know the relevant service calls? Thanks.