Harmattan hack : access to the lock screen

This is a feature I was working on for quite a long time, but I never released it since it is not polished at all. But anyway, since I do not have a lot of time to work on it, here is the release, and I hope that other people will support this hack and improve it.

As we know, Nokia released an app on Meego to change the lock screen. It was called something like zones. And we, in the Maemo community, also want to access to this lock screen. But the lock screen access is undocumented, and I had to hack through it, based on nm and friends, and source code of meegotouch-home.

Basically, meegotouch-home provides some plugins. One of them is the weather widget, another is the screen lock. The screen lock is not protected by aegis since Nokia is using it with the zones app, so there is no need to incept anything.

The source code of a demo is on gitorious, here.

Implement the screen lock

In order to implement and enable the screen-lock, two things have to be done.

  1. Implement the given interface
  2. Provide a desktop file
  3. Write some postinst and postrm debian scripts.

Implement the interface

Every screen-lock interface comes from ScreenLockExtensionInterface. This interface simply provides some information about what is the screen’s current state, and gives the notification manager.

My implementation is done in the ScreenLockExtension class. Basically, it provides a QGraphicsProxyWidget, in which I embedded a QDeclarativeView to load my QML files. This is very very ugly, but I had no choice.

Don’t forget to emit the unlocked() signal, otherwise your lock-screen won’t be able to be unlocked.

Provide the desktop file

The desktop file simply describe the interface. You can change the name or the translation, but don’t touch anything else. Everything else, especially the version of the interface, is important for meegotouch-home to load the interface.

Provide rules to replace Nokia interface

When installing or uninstalling the package, you have to replace the desktop file of Nokia’s screen-lock. This can be done by moving the file in /usr/share/meegotouch/applicationextensions/sysuid-screenlock.desktop and creating a symlink to your desktop file, and then, restart sysuid.

Don’t forget to remove the symlink and restore the original file when the package is uninstalled.

What works / don’t work

Well, not a lot of stuff works. The good news is that you can implement your lock screen, and even interface with notifications.

But, there are a lot of stuff that do not work. Pay attention to that, it is very important.

  • No swipe
  • Sometimes, if the QGraphicsWidget that is given by the interface is not very well implemented, the status-bar cannot be accessed anymore.
  • When calling / a reminder is displayed / the alarm clock is ringing, the bouncing effect do not appear.
  • Performances are quite poor. I don’t know how the scene is accelerated, but maybe OpenGL is not available. Stacking a QGraphicsProxyWidget do not help either.
  • You can brink your device if the desktop file is not available, or points to the wrong plugin.

Be sure to always have an SSH connection to your device in case you forget to remove the symlink when uninstalling the package, or if your device cannot be unlocked anymore. Restarting sysuid with the Nokia plugin can solve these problems easily.

Be ready to brick and reflash. If you introduce a segmentation fault to the device, sysuid will die 5 times, and reboot, and then die 5 times again, and stuck your device in a reboot loop.

You have been warned ! Now, happy hacking.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s