yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Original Android Development] Tungstwenty:
That pseudo-file is not meant to be read interactively but rather used in a script to block until a gesture is detected and then acting upon the received gesture id.

If you read it with a regular app, it will block until a new gesture is detected and since that won't normally happen, after a while the app is considered unresponsive and killed.
[Galaxy S II Original Android Development] mefistofelis:
It's there any way for a gesture to be perceived when the screen is off, similar to slide to wake function?

---------- Post added at 02:28 PM ---------- Previous post was at 02:28 PM ----------

How do we edit the file then?
[Galaxy S II Original Android Development] Many40:
Read pls posts above yours. They may be kind of answer to your question. Reagards
[Galaxy S II Original Android Development] Kondra007:
Still can't make it work.

Latest Dorimanx installed :(
[Galaxy S II Original Android Development] PantsDownJedi:
Freaking Awesome thread! Thanks! Solved my puzzle of how to kill maps when I close it. My phone approaches brilliance...
[Galaxy S II Original Android Development] mekhonte:
Could anyone help me with the heart gesture? my pal used to Love it when i was using dorminax kernel on SGS2. Now I moved to SGS3 but don't know how to add the heart gesture.!!!!!

Thanks in advance
[Galaxy S II Original Android Development] clonednull:
Well you could try the app "kernel gestures builder" from the play store. There is also a xda thread for this app. You can generate all kinds of gestures with this app.

Edit: oh nevermind i think i missunderstood your problem mate
[Galaxy S II Original Android Development] Flint2:
Have you tried	TouchGesturesSample-v1.1-s3-CWM.zip ? S3 has different screen size and coordinates than S2.

What kernel version you have now?

Also like clonednull said you can test with my app. Thanks!
[Galaxy S II Original Android Development] Tungstwenty:
Camera from the lockscreen

Hi,

I just found that the new

Android 4.2 Camera

app (can be found in multiple threads, such as this one) includes

native support for pictures straight from the lockscreen

, without needing to unlock with PIN or whatever.

All it takes is for you to run this command from one of your gesture actions:

am start -a android.media.action.STILL_IMAGE_CAMERA_SECURE

You can still use your regular camera app if you like, if you launch it normally from the icon. There's no problem at all having multiple camera apps.

But the new one (which includes the gallery as well) is pretty nice and this is a great bonus at least for me. :victory:

It will even know that you should be able to browse only the pictures you took during that secure session (just swipe right) but not the other ones :good:
[Galaxy S II Original Android Development] TheUnkn0wn:
Display Recent Applications List

For some reason Jellybean doesn't like to display the recent applications list by doing this :

input keyevent 187

so... to overcome this problem you have to do this :

am start -a com.android.systemui.recent.action.TOGGLE_RECENTS -n com.android.systemui/.recent.RecentsActivity

Hope it helps some people :)
[Galaxy S II Original Android Development] Valholy:
Good day trying to get a lock gesture on my S2 got dorimanx v7.4 kinda outdated unable to update it right now but want to know a way to get a lock screen gesture will this app work with my outdated kernel?? thanks a lot
[Galaxy S II Original Android Development] Flint2:
This feature is in your kernel, be sure to activate it in sTweaks or exTweaks, if you have any kernel doubt please post in support thread

Sent from my GT-I9100 Powered by Dorimanx kernel and Resurrection Remix
[Galaxy S II Original Android Development] GoJo ^^:
Hi there, i've used the gestures long time ago, N°4 (calling number) worked well, however now i just edited the gesture sh file and input a number but nothing happen after drawing heart..? Also i'd like to know how do i change the camera app that should open. Thanks ;)
[Galaxy S II Original Android Development] karlesg:
Does anybody know a command that we can use in Jelly Bean for quickly changing the cellular network function between GSM only - Auto GSM/WCDMA?
[Galaxy S II Original Android Development] Chillmann:
AW: [Ref][Kernel][Gestures]Triggering actions with touch gestures

Hi,

can some1 please explain how to use the "break" command? I think there must be a certain variable set to a new value, but my scripting knowledge is close to zero and i have just no clue how it actually works.

Thx in advance and best regards,

Chillmann
[Galaxy S II Original Android Development] ksilver89:
Hi,

To explain this briefly, the gesture detection is actually a script with infinite loop to read a value in the memory located at /sys/devices/virtual/misc/touch_gestures/wait_for_gesture. Therefore, you will see a line in the script template as below:

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

The "break" command is used to break the infinite loop and hence terminate the script.

Simply define a new gesture and let the action to execute "break", with a little vibration for feedback as the script will be killed.
[Galaxy S II Original Android Development] MaxPower985:
Hello, can someone help me?

Is there a command which would turn on/off Smart Stay using Terminal Emulator?

I want use this command in Tasker ( run Shell), turn on smart stay automatically when brightness >30% and turn off when brightness <30%

I noob in programming :(
[Galaxy S II Original Android Development] MSF Jarvis:
[MENTION=4322181]Tungstwenty[/MENTION], is there some method around to be able to add this to custom kernels for other devices??
[Galaxy S II Original Android Development] Ir09036542800:
خ
[Galaxy S II Original Android Development] antt00:
With CM10 and beta5, I cannot boot the phone with the script in init.d. Clearing the init.d folder solve the problem. Is there something i am missing?

Will try to run the script using script manager which runs after boot.
[Galaxy S II Original Android Development] Tungstwenty:
Touch actions have been there for a long time. It's YOU that must make sure not to use any complex and patented gesture such as drag finger from bottom left to bottom right, otherwise you risk getting sued. :D
[Galaxy S II Original Android Development] deklica:
Yup, not working in RR 3.0.3 :(
[Galaxy S II Original Android Development] Tungstwenty:
All kinds of Intents can be called with the "am" command. I haven't explored it too much myself but essentially it can be used to trigger the TWLaunch action for every app, plus specific actions that some apps can be launched with.

Perhaps you'll need not only to know the package name, but also use APKTool to take a look at its AndroidManifest.xml to see which Activities it has and therefore what are the right arguments to pass to "am start ...".

Anyone with a bit of experience can share further tips on this?

This is by design. Each gesture tracks its progress in a completely independent way of the others.

What you can do is this:

Since gestures are reported from 1 to 10, if you define the 3-finger gesture with a lower number than 2-finger, in your detection loop you can respond to the "3" result and before iterating again just "echo reset > wait_for_gesture" so it clears the "2" that's already pending to be reported as well.

(in case you do want to ignore the 2-finger gesture if the 3-finger one is detected)
[Galaxy S II Original Android Development] Tungstwenty:
I'm not sure what action you could run to access the notification bar from the lockscreen.

Please share if you find out how to do it :)
[Galaxy S II Original Android Development] Tricks25:
is there an app to set this or is it only through scripts?

too bad i dont have any idea how to make or execute scripts..

a great feature though! by seeing continued development for our beloved galaxy s2 makes me proud of owning one!

cheers! :)
[Galaxy S II Original Android Development] Tungstwenty:
They don't really "take precedence". You might say they are detected "first", but this is done with a pass-through approach, so all touches and movement is still reported as usual to the applications. If you have something else monitoring touches (apps, for instance), they will not be affected at all.

So if you have an app responding to the same gestures, both actions will be triggered. If they are different, the fact that the kernel is monitoring certain movements (and perhaps they don't match) won't affect in any way whatever apps might be doing the same for possibly other movements.

The actions will execute even if you're on the lockscreen, and the 3 sample actions I included in the OP illustrate that.

Just bear in mind that things like "am start ... camera" will trigger the execution of the camera app, but that by itself will not make it appear on top of the lockscreen - it will start running and be waiting for you as soon as you unlock with the pin / whatever.

mDNIe toggle will work fine, since all it does is echo to the right parameter file the new inversion status

As for the phone dial example, the Phone app

happens to

deal fine with the lockscreen and know it should display on top of the lockscreen even if there's a pin (so you should use this only if you're willing to have someone dial that predefined number if they know the gesture). When on the phone app, clicking "contacts", etc. will however not allow others to access your contacts list, because that's the way the app works (which I find great!).

PS: I happen to use a test mod (based on the Xposed framework, check by sig) to make the camera also have this behavior :D. I still need to polish it a bit - essentially prevent seeing the last picture thumbnail - and then I might release an Xposed mod so anyone can have the same: open the camera even in lockscreen and be able only to take new pictures, but not access past photos. The way the camera app should have been made, a bit like Phone.apk
[Galaxy S II Original Android Development] Tungstwenty:
To anyone experiencing issues with init.d script:

Can you try placing the script in another directory and run it from an adb shell so that any errors are seen on the console?

I'm not sure what could this be and that input would be valuable.
[Galaxy S II Original Android Development] Gustavo_s:
Tried on terminal, the file was on internal storage, i got permission denied. Take a look on the attached screenshot :fingers-crossed: great work btw
[Galaxy S II Original Android Development] rakeshishere:
Can this feature be used to implement the slide to wake feature available in fluxi kernel.?

I wish there was some sort of GUI application or option in Extweaks itself to make this a little easier
[Galaxy S II Original Android Development] B3AstLyBLitZ:
hi guys, im using cm10 with siyah and tried this sample gestures. Now stuck at siyah boot. Ive read to clear the init.d folder? Now how to find this/clear it using recovery? Sorry for the noobiness :P

In Desperate Need Of Help. I cannot boot into my phone at all.
[Galaxy S II Original Android Development] rakeshishere:
Never mind. I figured out this gesture feature in siyah doesn't work when phone is in deep sleep. It works even on lockscreen but phone has to be awake.

Please correct me if I'm wrong
[Galaxy S II Original Android Development] cavaliere06:
First!!! LOOOVEE THIS!!!!

I whis I had this on my Nexus 7 XD, Well I wish I had siyah on it also :D

Well I tried to run it from adb shell.

After a clean the init.d folder I could boot, so I place the file again in the same location -- /system/etc/init.d/ -- and it ran ok, first and last gesture worked, Only second gave this error:

and as the third gesture I only removed the second finger

But!! I still get stock on Siyah logo when I try to boot again

so i'll keep trying...
[Galaxy S II Original Android Development] B3AstLyBLitZ:
May i ask, how you cleared the init.d folder? I have the same problem you have right now, im stuck on siyah logo, using cm10. i cannot use my phone or boot into it without clearing the init.d folder, which i cannot find. And help? Thanks
[Galaxy S II Original Android Development] cavaliere06:
U can clear the init.d folter from Recovery-->

Kernel specific options --> Remove all files in init.d folder

---------- Post added 14th August 2012 at 12:18 AM ---------- Previous post was 13th August 2012 at 11:53 PM ----------

As I posted I can run it via adb shell, now I tried with the Terminal emulator app:

Firs I copy the script to --/system/etc/init.d/--

Then I do this:

#chown root gesture_actions

#chgrp root gesture_actions

#chmod 755 gesture_actions

#./gesture_actions

then I can do the gestures, everything seems ok, but after a reboot I get stocked at siyah logo again, I hope you could tell me what am I doing wrong

--Edit--

--IF YOU GET STOCK AT BOOTLOGO --

To enjoy gestures, now I have to run the script from another location with the Terminal emulator every time I reboot(wich isn't ideal but doable) or use Script manager until we find a solution
[Galaxy S II Original Android Development] jaksau:
@Tungstwenty

Well, in jellybean(CM 10) the camera app is inside the Gallery app, right? so maybe that's the reason it can't find com.sec.android.app.camera.

Maybe it should be like this: am start --activity-exclude-from-recents com.sec.android.app.gallery/com.sec.android.app.gallery.camera
[Galaxy S II Original Android Development] 000zui:
@ cavaliere06;30195483 thanks i have the same problem. Apparently it can work just when already booted.. Or maybe just me who cannot manage good the init.d scripts? Thanks anyway

GSII @ NeatRom Lite XWLPI / CMX 20120812 # Siyah 4.1b6 # Jkay&Mod personali
[Galaxy S II Original Android Development] Tungstwenty:
You need to move the script to another path where you can change the owner and the execute permissions.

Instead of placing it on init.d, which is the issue trying to be solved, you can use /data/local/tmp and launch it manually from there. It won't affect the next boots.
[Galaxy S II Original Android Development] Tungstwenty:
Exactly.

For detection to work with the screen off, it would require the touch screen to be always powered which would cause a bigger battery drain.

Just press HOME and then draw the gestures ;)
[Galaxy S II Original Android Development] hawkerpaul:
I'm on Neat LPI and I've noticed a problem. When gesture_actions is active in init.d folder, I lose all my media (music/notifications/ringtones) files stored on the external sd card. The only thing storage-related in my init.d scripts is the following S98MTPenable script that Neat installs as standard:

#!/system/bin/sh

# WanamLite tweaks

# USB mass storage

/system/bin/setprop sys.usb.config mtp,adb

/system/bin/setprop persist.sys.usb.config mtp,adb

/system/bin/setprop sys.usb.state mtp,adb

It makes no difference if gesture_actions gets called before or after this script (I've tried renaming it to zgesture_actions). When I go into music player, it says "no files", and I also lose my default ringtone/notification that are stored on the external sd card.

If I remove init.d/gesture_actions and reboot, I then see all my files in music player.

Thanks for all your help so far Tungstwenty

:good:
[Galaxy S II Original Android Development] gokhanmoral:
hmm, I cannot test it now but I feel like the script is blocking the execution of other scripts...

first, try to replace the first line with "#!/sbin/busybox sh" to prevent problems with different busybox versions in ROMs.

and then try to replace the last line with "done ) &;", move "&" sign out of the braces.
[Galaxy S II Original Android Development] danividalg:
Hi,

Thanks for that great feature! XD

Now a question:

- What command / action could be executed in the script to unlock the phone even with pin lock?

Thanks and best regards :)
[Galaxy S II Original Android Development] CuBG:
@GM Tryes your gesture with the Hearth that calls the girlfriend/Wife or whatever you want to call and it works like a charm. But because i am on PARANOIDANDROID and its based on CM10 when i put gesture_actions on init.d it stucks on your logo on boot but with the terminal it works and havent got the media scanner problem. It shows my Gallery pictures and music and everythink else. The only problem is that the terminal must be always opened to work.
[Galaxy S II Original Android Development] gokhanmoral:
cm10 is very picky about permissions.

make sure you set 755 and not 777 on /system/etc/init.d and on the script.

chmod -R 755 /system/etc/init.d
chgrp -R 0.2000 /system/etc/init.d
[Galaxy S II Original Android Development] CuBG:
I've already changed it manually from Root Explorer to 755

EDIT: And to add that i moved the file to data/local/tmp to prevent the boot problem.
[Galaxy S II Original Android Development] hawkerpaul:
I might have done something wrong, but I'm sure I haven't but that didn't work I'm afraid Gokhan.

Doing this still "removes" my external sd card media files, and the gestures themselves have stopped responding (the init script must be active, as my media files have gone)

Its interesting, as when I connect my pgone via USB it opens the windows dialog to open in explorer, and only phone storage is detected. If I then disconnect and reconnect USB cable, it then sees both phone and external card storage.

Edit: Not sure what's going on here now as I've just put Siyah 4.0.1 back on and I get the same problem: needs 2 USB connections to see the external card, so it appears its not the gesture_actions script after all, as I have removed this.

Edit2: I've cleared all media-related data/cache files, and this seems to have fixed the problem (on 4.0.1)

Will now test with beta6 with and without gestures to see what happens to see if the problem gets re-introduced...

Edit3: Seems the problem was in the media library cache, so it was a bit of a red herring sorry! By the way Gokhan, the initial placement of the ampersand for background processing in the init.d script seems correct. If I place it outside of the brackets then the gestures do not seem to get actioned
[Galaxy S II Original Android Development] danividalg:
Hi again,

I have tested the script and detection works perfecly! XD

I have copied to /data/sgestures folder, give appropiate permissions and run from script manager with superuser permissions

Now I have a problem on actions :(

- When "call to number" action or "negative colors" action is triggered all works ok

- But when an activity launch action is triggered the scrips hangs for a while and then I get a "Segmentation fault" message and activity does not launch (nor camera neither any other activity)

What could be the problem?

Thanks and best regards.
[Galaxy S II Original Android Development] Tungstwenty:
No app for it, at least not for now (nor do I anticipate doing it any time soon).

It's just a matter of taking examples and changing the actions you want. There seems to be some problems for some folks on the example I posted, though.
[Galaxy S II Original Android Development] Tungstwenty:
Please take the sample I posted as a mere starting point.

Of course you can launch whatever apps you want and depending on the ROM you're using, the camera entry might not make sense and need to be changed. If in your case there's a "galery..." app instead, by all means use that.

The best way IMO is to:

- check the apk you want to be launched

- use APKTool to see its AndroidManifest.xml and find the activity you want

- run "am start ..." to launch it

Example:

If I take an apk and run "java -jar apktool.jar d my_app.apk", on the output directory I'll find AndroidManifest.xml which something like this inside:

<manifest android:versionCode="..." android:versionName="..." package="[COLOR="Red"][B]my_package_name[/B][/COLOR]"
xmlns:android="http://schemas.android.com/apk/res/android">
...
<application android:theme="@style/AppTheme" android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:label="@string/title_activity_main" android:name="[COLOR="red"][B].ActivityName[/B][/COLOR]" android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
...
</activity>
...
</application>

To lanch this app, the command will therefore be:

am start [COLOR="red"]my_package_name[/COLOR]/[COLOR="red"].ActivityName[/COLOR]

In some cases it appears that the "/.ActivityName" is not needed, so your first attempt could be just "am start package_name" and only run the apktool if that doesn't work.
[Galaxy S II Original Android Development] Tungstwenty:
WTF??? :eek:

Well, here's another thing anyone having problems using this as init.d can try:

Edit the script and at the top, right after "#! /system/bin/sh", create a new line with

#! /system/bin/sh

[COLOR="Red"][B]sleep 60[/B][/COLOR]
...

This will still launch the script at boot but wait 1 minute before defining the gestures and then looping to react to them being triggered.

Let me know if this solves the problems you've been having.
[Galaxy S II Original Android Development] Tungstwenty:
The permissions thing could well be the problem, and it would explain why it doesn't happen to me but it does happen to folks using cm.

As for the & position, if I run that interactively from a shell with the & outside the (...) and then try to exit the shell, it will block and therefore the launching process will be waiting for the child to terminate. So IMO it makes sense to be after "done"...

Could anyone try changing the first line to busybox and also make sure the permissions and owner+group are as Gokhan mentions?
[Galaxy S II Original Android Development] hawkerpaul:
Seems the media files/init.d script "clash" was a red herring, as I removed all media related library caches, and this seems to have solved the problem.

Your ampersand positioning for background processing is correct. Moving it outside of the ) prevents the gestures from being detected/executed.

Thanks for all your help mate.

:)
[Galaxy S II Original Android Development] vertrag:
LOL how come root cannot execute a script? did you set the script to be executable (e.g. 775 or whatever).
[Galaxy S II Original Android Development] Tungstwenty:
mount | grep sdcard
/dev/block/vold/259:3 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,[B]noexec[/B],noatime,nodiratime,

The sdcard mountpoint does not allow executing binaries or scripts from there, even if the x bit is set.

If you don't want to place the scripts on /system/etc/init.d/ because it doesn't work, you can use e.g. /data/local/tmp/ or somewhere else on /system or /data
[Galaxy S II Original Android Development] cavaliere06:
sorry for been such a noob, but i guess I'm not doing it right

chgrp -R 0.2000 /system/etc/init.d shows an error, what I'm doing is this:

chown -R root /system/etc/init.d

chgrp -R root /system/etc/init.d

chmod -R 755 /system/etc/init.d

and the same for the script.

In case I'm doing it right, I also changed the firs line to "#!/sbin/busybox sh" but no diference at all.

the funny thing is when I changed "done ) &;" it boot Ok but it didn't run the script, and when I tried to run it with the terminal it gave me a systax error: unexpected ";"

so I put the "&" inside the (...) and my phone get stock on siyah logo again
[Galaxy S II Original Android Development] 000zui:
Maybe it's just me that i'm too stupid to run it and i'm sorry for it, but i always get "syntax error,elif unexpected" from terminal emulator/adb/whatever..what am I missing?
[Galaxy S II Original Android Development] bamthwok:
Great concept!

In order to get used with the x y coordinates, I've found a little tool in the market called "touchEx". If you touch the screen it shows you the actual coordinates. This can be a good starting point to design your own gestures.
[Galaxy S II Original Android Development] lukcinek:
+1

---------- Post added at 05:33 PM ---------- Previous post was at 05:20 PM ----------

I have the same problem :(