[maemo-developers] Inhibiting device auto-lock on N900

From: Per von Zweigbergk pvz at pvz.pp.se
Date: Mon Apr 19 11:04:42 EEST 2010
I'm writing a "talking clock" application. The purpose of this application is to answer the ever-so-frequent question "mghhnm, what time is it" in the morning, just before you've been able to open your eyes properly much less put on your glasses.

I've already written the application itself, it was a fairly simple project that took a couple of hours. In testing, however, I discovered a slight drawback to my planned approach of "start the program before falling asleep, mash the screen in the morning and it'll tell me the time".

1. The screen itself will stop accepting taps when the device is turned off. It seems this particular feature can be inhibited by leaving the phone slided open (with the qwerty keyboard exposed) or by setting the gconf setting /system/osso/dsm/locks/touchscreen_keypad_autolock_enabled to false. This requires you to slide the lock button on the side of the phone to unlock the screen. Annoying, but still doable even in a half-awake stupor. And besides, you can always leave the phone activated in its "opened" mode.

2. The device will automatically lock itself after 5 minutes, for security purposes. Now, remembering and correctly entering the device lock code in a half-awake stupor is considerably more difficult. This can be disabled by setting the gconf setting /system/osso/dsm/locks/devicelock_autolock_enabled.

However - I don't really like this approach of changing gconf user settings to inhibit device locks. The last thing I want is for the phone or my application to crash (or more likely, to run out of battery) while the program is running and leaving the device unlocked, requiring the user to set the automatic lock option on again (if he even notices it's been disabled).

Whoever coded the built-in media player agrees with this. He's found some way to tell the system not to automatically lock itself without changing the gconf settings. I have not yet figured out how.

One other option worth considering is the fact that some applications, such as the phone (for an incoming call) and the alarm application (to silence the infernal bleeping of an alarm) will allow you to throw up a screen to the user that'll be accessible even if the lock code has not been entered. This would also solve the potential security issue of somebody stealing your phone while you're sleeping to get to it while it's unlocked. :-)

So, does anybody have any ideas as to how I might acheive this in some way?
More information about the maemo-developers mailing list