5,600,483 Members 32,896 Now Online
XDA Developers Android and Mobile Development Forum

[APP]LockDevice [2009-08-26]. Ultralight app to lock after wakeup

Tip us?
 
danielherrero
Old
(Last edited by danielherrero; 11th September 2009 at 12:19 PM.)
#1  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
Default [APP]LockDevice [2009-08-26]. Ultralight app to lock after wakeup

change's log
V1.6 2009-09-11
Phone doesnt lock if there is a call in progress
V1.5 2009-08-26
1) Added an option to lock the device when a player (HTC player, WM Player, HTC FM Radio, etc) turns the screen off...
V1.4 2009-08-14
1) Added command argument. "lock". this will lock the device.
2) Added a link called "Lock Now" to lock now....
3) All the links are located in a folder called "Lock Device". (because there are 4 links and I dont want to fill the directory \windows\start menu (in your language) with many links
V1.3 2009-08-04
1) Commands support. The program LockDeviceGUI.exe supports 4 commands.
  1. enabled -> Enable LockDevice
  2. disabled -> Disable LockDevice
  3. wakeup -> Run Mode: Lock on wakeup
  4. screenoff -> Run Mode: Lock on screen off
Your can set one or two parameters. For example:
  • 61#"\Archivos de programa\LockDevice\LockDeviceGUI.exe" disabled -> Disable LockDevice
  • 61#"\Archivos de programa\LockDevice\LockDeviceGUI.exe" enabled screenoff -> Enable LockDevie and run mode set to "lock on screen off"
The installer creates out of the box two links in the system programs folder: EnableLock.lnk and DisableLock.lnk (The first with "enabled" parameter and the second one with "disabled" parameter).

V1.2 2009-08-03
1) The installer includes a little GUI program.
Click image for larger version

Name:	icon.jpg
Views:	16302
Size:	26.8 KB
ID:	211919

With this program you can configure how LockDevice must behave.
Attachment 211920
1) Enabled / Disabled
2) Work Mode:
2.1) Lock on wakeup. This is how works previous version. Pros: The program doesnt stay resident. Cons: The device must be "off" some seconds before windows really suspend the device. This time is longer with wifi active. So if you press power off and then power on quickly probably the device wont lock (because windows never suspended the device)
2.2) Lock on Screen off. Pros: The device is locked when the screen goes off so always works correctly. Cons: The program stays resident. Anyway the program is "paused" all the time so no CPU is used. the program stays sleeping until windows notifies it the screen is off. Then LockDevice lock the device and goes to sleep again

Please report any bug, suggestion, etc...
Dani
V1.1 2009-07-31
1) The device is locked directly using keybd_event. No sendkey.exe call . So smaller, quicker and no dependence of sendkey.exe configuration.

Initial post
Hi
Today I ve been searching for a very little program, not resident in memory to lock my device on wakeup. There are other ones but I didnt find one that isnt resident in memory.
So I ve done quickly a very small program that is notified by windows when the device is woken up, so no resident, and executes \windows\endkey.exe. So if you ve configured your end key long press to lock the device then your device will be locked.

I ve tested it in my Touch Pro 2 and works.

I really needed it and maybe other people are in the same situation.

Dani
Attached Thumbnails
Click image for larger version

Name:	lock.jpg
Views:	15095
Size:	54.3 KB
ID:	220847  
Attached Files
File Type: cab LockDevice_V1.6.CAB - [Click for QR Code] (45.3 KB, 20092 views)
The Following User Says Thank You to danielherrero For This Useful Post: [ Click to Expand ]
 
DaVince
Old
(Last edited by DaVince; 30th July 2009 at 02:34 PM.)
#2  
DaVince's Avatar
Senior Member
Thanks Meter 31
Posts: 783
Join Date: Aug 2006
Location: Manila
It doesn't seem to do anything on my Touch HD. I tried turning off and on, nothing. Tried soft resetting, tried again. Nothing. I even tried running it from File Explorer on the LockDevice folder (Maybe it needs to instantiated or something), then tried turning off and on again. Nothing.

EDIT: Oh ok... It doesn't work if you just turn it off then on immediately (which is a good thing). It had to be off for at least 3 seconds. Although there is a second delay before it locks after turning it on, which is ok I guess. Nonetheless, this is good stuff! Since it's the first one I've seen that is not memory resident (which makes me wonder.. how does it work??).
Everything is possible. Impossible just takes longer.


Current Device:
Galaxy Note and Nexus 4

--
Previous Devices:
iPhone 4
HTC Touch HD
Samsung i780
HTC Touch Dual SOLD!
HTC TyTN SOLD!
O2 XDA Exec
Nokia 6630, 3660, 6510, 8210 and 3210 Trashed

 
danielherrero
Old
#3  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
Quote:
Originally Posted by DaVince View Post
It doesn't seem to do anything on my Touch HD. I tried turning off and on, nothing. Tried soft resetting, tried again. Nothing. I even tried running it from File Explorer on the LockDevice folder (Maybe it needs to instantiated or something), then tried turning off and on again. Nothing.
I ve reuploaded it to avoid to hang a call
Do you ve \windows\endkey.exe ?
Is it configured to lock the device?
If you suspend the device and quickly press the power button then the device really isnt suspended so It doesnt work. The device must be screen off several seconds (5-10) to consider itself suspended.....
Attached Files
File Type: cab LockDevice.CAB - [Click for QR Code] (17.6 KB, 813 views)
 
danielherrero
Old
#4  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
Quote:
Originally Posted by DaVince View Post
It doesn't seem to do anything on my Touch HD. I tried turning off and on, nothing. Tried soft resetting, tried again. Nothing. I even tried running it from File Explorer on the LockDevice folder (Maybe it needs to instantiated or something), then tried turning off and on again. Nothing.

EDIT: Oh ok... It doesn't work if you just turn it off then on immediately (which is a good thing). It had to be off for at least 3 seconds. Although there is a second delay before it locks after turning it on, which is ok I guess. Nonetheless, this is good stuff! Since it's the first one I've seen that is not memory resident (which makes me wonder.. how does it work??).
Remember to install the new one or the program will hang a incomming call if the device is suspended
When the program starts the first time it register itself to windows to be notified when the device wakes up.
So when the device wakes up Windows execute the LockDevice.exe with an argument "AppRunAfterWakeup". Then the program check if there isnt a call in progress and then execute \windows\endkey.exe. Simple
 
danielherrero
Old
#5  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
could some people with other device than mine (tp2) to try if it works ok?
By now all works perfectly without a process spending ram/cpu
 
DaVince
Old
#6  
DaVince's Avatar
Senior Member
Thanks Meter 31
Posts: 783
Join Date: Aug 2006
Location: Manila
Tried the new cab on my Touch HD (Running WM6.1). Everything works ok so far.
Thanks a lot for this! I prefer this solution since this the simplest most efficient one that makes use of the built in Lock.
Everything is possible. Impossible just takes longer.


Current Device:
Galaxy Note and Nexus 4

--
Previous Devices:
iPhone 4
HTC Touch HD
Samsung i780
HTC Touch Dual SOLD!
HTC TyTN SOLD!
O2 XDA Exec
Nokia 6630, 3660, 6510, 8210 and 3210 Trashed

 
danielherrero
Old
#7  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
Nice. I thought about write an small resident process that monitors changes of power state to be more efficient but I prefer a process that only runs for a few ms when the device wakes up and then dies...
 
chronodrago
Old
#8  
Junior Member
Thanks Meter 0
Posts: 15
Join Date: Dec 2008
awesome app dude. well done. i was wondering though, since its possible to run an app on device wake up...is there a way to call upon an app when the device is set into suspend? cause even though the device's screen isnt on, stuff is still running, so what if a reg entry like the "on device wake up" is used as a "device suspend". that would get rid of the 1 sec wait on wake up and also still not be resident. i actually dont know if there is a way to do that, i dont fully comprehend it but it was an idea. cause it would be sick to be able to get rid of the 1 sec wait.
 
danielherrero
Old
#9  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
Quote:
Originally Posted by chronodrago View Post
awesome app dude. well done. i was wondering though, since its possible to run an app on device wake up...is there a way to call upon an app when the device is set into suspend? cause even though the device's screen isnt on, stuff is still running, so what if a reg entry like the "on device wake up" is used as a "device suspend". that would get rid of the 1 sec wait on wake up and also still not be resident. i actually dont know if there is a way to do that, i dont fully comprehend it but it was an idea. cause it would be sick to be able to get rid of the 1 sec wait.
Hií
You can, but using a resident process. The feature I used in the "wake up" process isnt avaible in that way for "before going to sleep". A process can register itself to get notifications about changes in power state (From On state to suspended state)(RequestPowerNotifications api). So you could do some stuff when the device goes to idle state (screen off) but It requires the process to stay running in memory. Really It would be "paused" waiting for a queue event but spending one of the 32 available process in WinMo. Later I will upload a little process doing that. Just for try and play
Dani
 
danielherrero
Old
#10  
danielherrero's Avatar
Senior Member - OP
Thanks Meter 223
Posts: 3,234
Join Date: Oct 2006
Location: Madrid

 
DONATE TO ME
Hi
I ve uploaded in first post a more optimized version. Now the program can lock the device by itself instead of rely on call sendkey.exe. So smaller and more efficient. To avoid the 2-3 seconds needed to be suspended to make it work correctly I ve done other version that monitors the power state. It locks the device when the screen goes off (instead of when the device wakes up) but it spend one process (WinMo only can run 32 process at same time). Question of tastes...
The reason about 3-4 seconds needed to wait between power off / power on is this:
When you press power off, the screen goes off (power idle state) but the system needs some seconds to really be suspended. Its in this way because windows notifies drivers about the power event and they must adjust their power levels....So if you press power off and quickly power on then the device really didt was suspended so It isnt really being woken up and the program isnt called by windows
Dani

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

TasGear: A Tasker Extension for the Samsung Galaxy Gear

With wearable technology taking center stage this year, one can only expect more … more

Intelligently Place Contacts on Your Home Screen with CallWho Widget

There are plenty of ways to get your contacts to show up on your … more

Control TWRP from within Android with TWRP Coordinator

You may recall that back when TWRP2 introduced a couple of years ago, it brought with … more

Keep Track of Everything Your Device Does with Event Logger

Regardless of their OS choice, computing power users generally share one common … more