Backup+ Lets You Backup Your App Data on Android Lollipop

Even though Android 5.0 Lollipop hasn’t yet seen its official release, quite … more

TechTalk Compiles All the Android News You Need in One App

If you’re as obsessed with mobile devices as the vast majority of our forum … more

Android App Review: Google Inbox to Improve Your Life – XDA TV

Recently, Google+ exploded with the announcement of Google Inbox, as … more

Damp the LG G3 Thermal Throttling

As our mobile devices grow thinner and more powerfulwith each passing generation, it’s inevitable … more
Post Reply

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

OP danielherrero

30th July 2009, 01:54 PM   |  #1  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
Donate to Me
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:	16321
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:	15113
Size:	54.3 KB
ID:	220847  
Attached Files
File Type: cab LockDevice_V1.6.CAB - [Click for QR Code] (45.3 KB, 20125 views)
Last edited by danielherrero; 11th September 2009 at 12:19 PM.
The Following User Says Thank You to danielherrero For This Useful Post: [ View ]
30th July 2009, 02:24 PM   |  #2  
DaVince's Avatar
Senior Member
Flag Manila
Thanks Meter: 31
 
783 posts
Join Date:Joined: Aug 2006
More
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??).
Last edited by DaVince; 30th July 2009 at 02:34 PM.
30th July 2009, 02:34 PM   |  #3  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
Donate to Me
Quote:
Originally Posted by DaVince

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, 817 views)
30th July 2009, 02:40 PM   |  #4  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
Donate to Me
Quote:
Originally Posted by DaVince

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
30th July 2009, 09:14 PM   |  #5  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
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
31st July 2009, 06:58 AM   |  #6  
DaVince's Avatar
Senior Member
Flag Manila
Thanks Meter: 31
 
783 posts
Join Date:Joined: Aug 2006
More
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.
31st July 2009, 08:21 AM   |  #7  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
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...
31st July 2009, 08:36 AM   |  #8  
Junior Member
Thanks Meter: 0
 
15 posts
Join Date:Joined: 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.
31st July 2009, 08:44 AM   |  #9  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
Donate to Me
Quote:
Originally Posted by chronodrago

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
31st July 2009, 03:51 PM   |  #10  
danielherrero's Avatar
OP Senior Member
Flag Madrid
Thanks Meter: 231
 
3,241 posts
Join Date:Joined: Oct 2006
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

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes