Development stopped: [APP][Updated 17-04-09] Stylus(BattC)lock (v1.7)

Search This thread

ZuinigeRijder

Retired Recognized Developer
Jun 13, 2008
2,854
208
www.zuinigerijder.com
==================================================================================================
More advanced *FREE* unlocking using all the HTC sensors can be found here: [APP]TouchLockPro

If you are fine with StylusLock 1.7, just keep using it. However, because StylusLock 1.7 is integrated in TouchLockPro, new developments within StylusLock 1.7 are not expected. So keep your eye on the new thread (you can even subscribe to it, via the "Thread tools" feature of XDA).
==================================================================================================

There are already a lot of applications to disable touchpanel and/or hardware keys for the Touch Diamond. I added another simple one:

StylusLock

Youtube video StylusLock in action on wmpoweruser.com. Note that this video is version 1.1. New version 1.2 onwards has a StylusLock indicator and vibration is different


Version 1.6 onwards has a BattClock, indicating the locked status
Unlocked:
BattClockUnlocked.jpg


Locked:
BattClockLocked.jpg


Features:
* Great to have *ANY* application locked, e.g. GPS navigation, Music player, Home screen, so you do not accidentally press touchpanel/hardware buttons.
* Works with Touch Diamond and Touch Pro.
* Be able to put the Touch Diamond in your pocket with touchpanel and all hardware buttons locked.
* Taking out the TD from your pocket: the touchpanel or a hardware button cannot be accidentally pressed when locked.
* Avoid missed calls, by accidentally pressing the TouchPanel and/or hardware buttons.
* With Bluethooth headset still incoming calls can be answered, although it is locked (confirmed by others)
* No effect on Battery life.
* Consumes no CPU cycles (only in case of an Stylus/Power event, no polling). Check it with a Task Manager!!
* Use Stylus for locking/unlocking
* Clock and battery percentage indicates Locked/Unlocked, pressing the indicator enables "Stylus lock mode" (version 1.6 onwards)
* Unlocked when on AC or USB power
* Vibration when changing lock state to locked
* Not having the Vibration bug of "SensorLock"
* Go to Suspend when locked and the backlight goes off (v1.3 onwards)
* Possibility to overrule default behaviour (v1.4 onwards)

What does it do:
* There are 2 modes, "stylus lock mode" enabled and disabled
- Mode 1 - enabled - stylus in = phone locked
- Mode 2 - disabled - stylus in = phone not locked
* You can enable "stylus lock mode" by pressing the BattClock (version 1.6 onwards)
* You can toggle the "stylus lock mode", by taking OUT the Stylus and putting it back IN within 1 second (3 seconds in versions before 1.4)
* In fact the second mode permits not to use the lock functionality, in order to use your fingers on the touchpanel and hardware buttons, rather than the stylus.
* On startup/boot/reset it will be always unlocked and "stylus lock mode" is disabled
* It will always be unlocked, when the Stylus is OUT
* It will always be unlocked, when on ACPower/USB power
* It will always be unlocked, when the program is exited
* In "stylus lock mode 1", putting the Stylus IN and on battery-power, the touchpanel and all hardware keys will be locked
* In "stylus lock mode 1", when switching to battery-power and the Stylus is IN, the touchpanel and all hardware keys will be locked
* Vibrate once when switching to unlocked state (till version 1.1, version 1.2 onwards does not vibrate anymore, because there is a StylusLock indicator when locked, saves battery)
* Vibrate when switching to locked state and/or "stylus lock mode" enabled

How to install:
* Deinstall the previous version of StylusLock and/or other locking programs
* Copy the StylusLock.x.x.CAB file from your computer to the Touch Diamond or Touch Pro Memory card
* Go via the explorer of the Touch Diamond or Touch Pro to the location where you copied the .CAB file and click on it to start installation
* Advice is to install it to the Phone memory and not to the Memory card, StylusLock is very small and so it also works in "DiskDrive" mode

How to use:
* Choose your "stylus lock mode", by using the method above (toggle the "stylus lock mode", by taking OUT the Stylus and putting it back IN within 1 second)
- e.g. if you want to put the TD in your pocket, enable "stylus lock mode"
- e.g. if you have your TD lying on the table, disable "stylus lock mode"
- e.g. you can also use always the "stylus lock mode" when your are fine to take out the stylus for unlocking (you do not need to operate the Power button anymore)

How to go to sleep mode immediately AND locking the phone when in "stylus lock mode"
Press the Power button and insert the Stylus. You will feel a vibration when the phone gets locked. In this way you do not rely in the Windows settings for going to sleep, it will go to sleep immediately.

Version 1.7
* Possibility to disable BattClock press via registry setting ClockClickable

Version 1.6
* Instead of the locked notification icon, now a Clock with Battery percentage is shown on the position of the battery icon
* When pressing the Clock, the "stylus lock mode" will be enabled
* When the phone is locked, the Clock will swap the background and foreground color, to indicate it is locked
* The default position of the BatteryClock can be overruled
* BattClock takes into account portrait and landscape mode (a negative value of ClockX position will count relative from the right, instead of from the left)
* The default foreground and background colors of the clock can be overruled
* StylusLock will become active after 30 seconds instead of 5 seconds, so the phone has time to start up
* Still Stylus(BattC)lock does consume no extra battery/CPU

Note that I hope that people having problems with the locked notification icon, do no longer suffer problems with this approach. Please let me know if this is solved now. Be sure not to run in 1.1 compatibility mode, though.

How to overrule default settings:
It is possible to overrule the default settings via registry HKCU\Software\ZuinigeRijder\LockSettings

Please use a registry editor to create the DWORD values, e.g. PHM RegEdit.
A value of 0 means No and a value of 1 means Yes. The default DWORD value is also mentioned. Please make sure to do a soft reset after adding the appropriate overrule settings.

* lockTouchPanelOnly = 0
* vibrate = 1
* beep = 0
* lockIndicator = 1
* clockClickable = 1
* suspendOnBacklightOff = 1
* unlockOnACPower = 1
* stylusAlwaysControl = 0
* stylusOutInToggleTime = 1000 decimal or 3E8 hexadecimal

* ClockX = -96 decimal, corresponds to unsigned 4294967200 decimal or FFFFFFA0 hexadecimal // minus means relative to the right
* ClockY = 0
* ClockWidth = 48 decimal or 30 hexadecimal
* ClockHeight = 48 decimal or 30 hexadecimal
* ClockBackground = 0 // Black, RGB(0,0,0)
* ClockForeground = 16777215 decimal or FFFFFF hexadecimal // White RGB(255,255,255)

You only need to define the values you want to overrule.

 

Attachments

  • styluslock.1.6.CAB
    9.2 KB · Views: 3,936
  • styluslock.1.7.CAB
    9.2 KB · Views: 2,735
  • styluslock.1.7.sources.zip
    374.7 KB · Views: 878
Last edited:

ZuinigeRijder

Retired Recognized Developer
Jun 13, 2008
2,854
208
www.zuinigerijder.com
How to Use

Unlocking use case when "stylus lock mode" is enabled and e.g. a phone call is coming in.
* Option 1 (when you want to use the Stylus or have place to put it somewhere):
- Take the stylus OUT and keep it out
- Answer/Reject the call with the TouchPanel or Hardware keys
- When done with the call, put back the stylus IN
* Option 2 (if you do not want to use the Stylus and have no place to put it):
- Take the stylus OUT and put it back IN within 3 seconds ("stylus lock mode" disabled)
- Answer/Reject the call with the TouchPanel or Hardware keys
- When done with the call, Take the stylus OUT and put it back IN within 1 second ("stylus lock mode" enabled) (3 seconds for versions before 1.4).

Unlocking use case when "stylus lock mode" is disabled and e.g. a phone call is coming in.
- Answer/Reject the call with the TouchPanel or Hardware keys, because they are not disabled

I would like to thank surfsmurf for his SensorLock software which made it possible for me to have a quick start in programming Windows Mobile and the trick of locking the touchpanel and hardware keys.

Version 1.5.2
* Reverted back to version 1.5 (1.5.1 did not solve the crashes and gave other problems)
* Fixed bug with lockTouchPanelOnly = 1 (version 1.5 did not work with this setting)
* There can be occasional lockups, when using the lock indicator. You can disable the lock indicator with setting lockIndicator = 0 or use version 1.1.

Version 1.5.1
* Reverted lock code, because the 1.5 version did not work with lockTouchPanelOnly = 1
* lock indicator is now added/removed in Window callback
* Again an attempt to solve the reported crashes

Version 1.5
* Integrated latest lock code from SensorLock 0.3.4
* Maybe this solves the reported crashes

Version 1.4.1
* Fixed bug when lockTouchPanelOnly = 1 was set and a call comes in, the TouchPanel was unlocked. Now I reapply the lock on resume.
* Because of the complaints of crashes, I now do the Add/Remove of the lock icon in the background.
* Also there is a delay of 1 second before the icon gets added or removed and the lock status has not changed in that time.
* However, I do not know if this solves the crashes, but you can give it a try.

Version 1.4
* Solved the rarely occurring lockup bug
* Changed the Stylus Out/In time from 3 seconds to 1 seconds
* Made it possible to overrule the default settings via registry HKCU\Software\ZuinigeRijder\LockSettings

Version 1.3
* Go to Suspend when locked and the backlight goes off (v1.3) (saves again extra battery automatically) :cool:
* You can control this duration time via Windows Mobile power setting "backlight off time"
* This way someone can also quickly put on the phone with the Power button to check e.g. the time. It will now fall earlier to sleep
* So you do not need to wait too long for putting the Stylus back, if you do not want to toggle.
* Again did some measures for preventing rarely occurring lockups. I am convinced the problem is not fully solved though :(

Version 1.2.2
:) No longer vibrate when the backlight is on and it goes to locked, because the intention of StylusLock is to use no real extra battery:
* Added that StylusLock will no longer vibrate when the backlight is on and it goes to locked. The visual icon is good enough in that case.
* But if you put the TD to sleep first by using the power button or the backlight is off and thereafter locking the TD, then it will still vibrate for non-visual feedback.
* Also did some measures for preventing rarely occurring lockups.
Hope these improvement are liked, otherwise keep version 1.2.1.

Version 1.2.1
* Found the problem why the icon was disappearing. So now I do not need to redo the locked icon each 55 seconds. No CPU usage again.
* Apply the lock icon immediately AFTER it is really locked
* Remove the lock icon immediately AFTER it is really unlocked
* I had a lockup of the TD today (with version 1.2), so I do not hope this version is buggy
* Added the missing sources (forgot to put under source control)

Version 1.2
* Added StylusLock indicator when locked. Works for TouchFlo3D screen as well as other Today screens.
* Because the StylusLock indicator is now visible if locked, it no longer vibrates when unlocked (saves extra battery)
* Kept StylusLock as simple and small as possible (only 1Kb in memory) and does still consume no CPU (check with Task Manager!!).
* v1.2 is even a bit smaller then v1.1, although the StylusLock indicator has been added.

Version 1.1
When the stylus is put inside it will only vibrate if "stylus Lock mode" gets enabled and/or the phone is getting locked. If there is no vibration, you know the phone is not locked and "stylus Lock mode" is disabled. Added source code.

Version 1.0
First released version
 

Attachments

  • styluslock.1.1.CAB
    8 KB · Views: 99
  • styluslock.1.1.sources.zip
    367.6 KB · Views: 58
  • styluslock.1.5.2.CAB
    9.5 KB · Views: 263
  • styluslock.1.5.2.sources.zip
    374.4 KB · Views: 175
Last edited:

ZuinigeRijder

Retired Recognized Developer
Jun 13, 2008
2,854
208
www.zuinigerijder.com
FAQ

Q: Why do you not shutdown the power (go to sleep) when locking is enabled
A: Dependent of the usage, e.g. using GPS navigation or in a call, you do not want to go to sleep mode, because you still want to see the screen or operate. Now the sleep mode is just triggered by Windows Mobile settings, which should be convenient enough. But if you want to go to sleep mode immediately, press the Power Button and insert the Stylus IN. A double vibration will be felt, if the phone is locked.

In version 1.3 onwards it will go to sleep when in styluslockmode and the backlight goes off. Make sure that your GPS software does not trigger the backlight off. I use OziExplorer and IGO 8, and there this works. In TomTom, the backlight goes off, so I do not know if there is a setting to disable that. If you do not want the phone to go to sleep when the backlight goes off, you can overrule the setting suspendOnBacklightOff in version 1.4.

Q: Can you add a lock/unlock indication
A:Added in version 1.2.

Q: Can you add a method for locking by pressing a (TouchPanel) button
A: I am looking into the NavSensor to unlock or lock possibility in addition of Stylus control.

Q: Why do you not make it possible to disable only the TouchPanel
A: In my opinion, only locking the TouchPanel will not avoid e.g. missed calls, because also the hardware keys can be accidently pressed (although a little bit less likely). There are also problems reported that it unlocks, when you do not answer a call. This version (also locking hardware keys) does not have this problem. However, I added the possibility in version 1.4 to overrule this via setting lockTouchPanelOnly.

Q: Why do you not lock when going to/resuming from sleep mode
A: When you are in "stylus lock mode" it will be locked already if the stylus is IN. Otherwise you have decided not to use the "stylus lock" feature. You just can put the TD on a table and do as if StylusLock was not active when "stylus lock mode" is disabled.

Q: Why is this version better than SensorLock
A: The GSENSOR gestures in SensorLock uses CPU by polling (and takes also more battery). Also the way of turning is not so easy always (drop your TD). StylusLock does not have the vibrate bug. Accidently turning may lock/unlock the TD. Stylus control is the simplest way to operate your locking, why need an extra method for it?

Q: Is the Vibrate bug of SensorLock solved in StylusLock
A: Yes, the vibrate bug does not appear in StylusLock.

Q: Can you change the Vibrate into Beeps
A: In version 1.4 you can overrule the default setting. Even you can use both or none.

Q: Why is StylusLock better than other solutions?
A: It consumes no extra battery/CPU and is as simple as possible but still powerful. It can be used in conjunction with other software and does not interfere with e.g. GSENSOR applications.

Q: Can you please add this or that feature?
A: The intention is that the program must be lean and mean and still be easy to operate. So yes, you can ask for features and I will consider them, if it is easy to do (complexity) and does not influence battery usage. In version 1.4 default settings can be overruled. If you need more advanced features or more control, take a look at other applications.

Q: Which other solutions exist
A: This is a list of other solutions
* Get A Reward! Create A "answer Only With Hw Buttons" Option! http://xdaforums.com/showthread.php?t=414731
* S2U2
* PDAVIET's dialer
* CSDEVCTRL http://xdaforums.com/showthread.php?t=386451
* SensorLock http://xdaforums.com/showthread.php?t=422871
* Answerkeys Disabler http://xdaforums.com/showthread.php?t=425650
 
Last edited:

drvdijk

Senior Member
Jul 31, 2008
286
0
Utrecht
Nice one. The techniques for locking and polling are becoming pretty obvious now, and some great ideas are being implemented!

However, when on my bike (yeah we Dutchies ride them continuously ;)) and a call comes in, I'd have to let go of both hands... Hmmm..

Anyway, congratulations with an application that does NOT eat your battery! Job well done :)
 

ZuinigeRijder

Retired Recognized Developer
Jun 13, 2008
2,854
208
www.zuinigerijder.com
Nice one. The techniques for locking and polling are becoming pretty obvious now, and some great ideas are being implemented!

However, when on my bike (yeah we Dutchies ride them continuously ;)) and a call comes in, I'd have to let go of both hands... Hmmm..

Anyway, congratulations with an application that does NOT eat your battery! Job well done :)

Ah, just a reason to stop when someone calls :p
Is also safer. :)
 

ZuinigeRijder

Retired Recognized Developer
Jun 13, 2008
2,854
208
www.zuinigerijder.com
Sweet! I'm glad SensorLock got you started.

As for trying to fix the vibration bug, what have you done exactly? The vibration notifications look similar, is the vibration based on the SensorLock one?

There are a couple of measures which can contribute to not having the vibration bug in StylusLock:

- I sleep 5 seconds, before doing some stuff, when started StylusLock first time
- I start always forced unlocked, when just started (so when it is vibrating, it maybe stops then)
- I do not use it in combination with the GSENSOR (maybe that can cause problems)
- Soft Resetting is normally done unlocked (because the Stylus is out ;-)
- I lock both the TouchPanel as the hardware keys (like in SensorLock 0.1)
- I vibrate only when not locked (so just before locking, and just after unlocking)
- I do not lock on PBT_RESUME
- I always unlock when I exit StylusLock

However, I am not sure it will be solved with the above things and which one is responsible for solving the vibrate bug.
Especially, because I did not having encountered this bug, also not with SensorLock.

Hope this gives you some clues/ideas.
But I am not sure my approach solves the vibration bug.
I think it is too early to conclude on that, let people try StylusLock.
 

surfsmurf

Senior Member
Sep 1, 2008
88
4
Copenhagen
There are a couple of measures which can contribute to not having the vibration bug in StylusLock:

Thanks for sharing, there's some interesting points in that list.

Personally I think the vibration bug in SensorLock is caused by bogus results from the G-Sensor, causing bogus gestures to be detected continually. The vibration code itself is SO simple I simply cannot see where a bug might be hiding in it.

I doubt very much that StylusLock would be suffering from the same problem, but as I said, it's an interesting list of points.
 

bennec83

Senior Member
hi,

i am currently using answerkeys disabler, does this drain battery?

second question, am i correct in thinking, that with auto-lock enabled the only way to answer a call is to press the hardware answer key?

would this be a better app than answerkeys disabler to stop answering calls in my pocket?
 

drvdijk

Senior Member
Jul 31, 2008
286
0
Utrecht
Answerkeys Disabler does not drain power. StylusLock doesn't either. SensorLock a little more, but still nothing compared to S2U2.
 

anthibug

Member
Aug 30, 2008
11
0
I love it !
A few days ago i discoverd SensorLock.
I ran through the vibrating bug and others disadvantage (i lose the transcriber*).
With the version 0.3.0 of SensorLock, i was able to 'play' with it and i was kind of deceive :
The g-sensor-phone-360° thing was a good idea but finally it's not convenient as you said in the faq.

So i tried your application : great !
And it does not consume power at all, cool !

Like the 0.3.0 version of SensorLock, no vibrating bug anymore at start in your program.

Your tutorial is good but don't explain the auto lock mode stuff for beginners, i would have say something like :
There is 2 mode :
1 - stylus in = phone locked
2 - stylus in = phone not locked
In fact the second mode permit not to use the lock functionnality, in order to use your fingers on the touchpanel, rather than the sytlus.

Moreover : nothing happens 'automatically' after some time, so the words 'auto lock mode' is kinda wrong.

Last thing :
when switching to auto lock mode or not, there is no differences
maybe 3 short vibrations when switching to no auto lock mode ?
or just a different icon in the upcoming systray icon ?

Personnaly i don't need a systray icon but why not...


* For those concerned : I didn't reinstall my rom to get it back, i just desinstall SensorLock :)