Phone lock enabling using hardware buttons I don't normally like to lock my phone as I find it annoying.

Is it possible to enable the lock or some kind of encryption on the phone in an emergency, for example by holding down a number of the hardware buttons?
Opposing ce4, I see a possibility using e.g. Tasker. In case you don't know it: Tasker is the most complex automation tool available on Android. You connect "events" (as e.g. phone rings, incoming SMS, a given time (clock), a location, ...) with "tasks" (actions to be taken, as e.g. switching mobile data on/off, enabling/disabling airplane mode, adjust volume, and much more) to so-called "profiles".

So here comes an example profile for your problem:


Event:

event->hardware->camera button pressed
event->sensor->shake->[configure details]

Task:

Keyguard On



So with that profile, if you hold down the camera key and shake your device, the configured keyguard (pattern lock, pin, password) will be activated. Obviously you need the opposite action as well: Use the above again with a different "shake pattern" and, of course, "Keyguard Off" in the task.

So initially, you configure your pattern/pin/password to be set on, as usual on Android (so the system knows which one to use). After that, use your configured hold-shake-pattern to activate and deactivate it.

Pretty simple. Though I didn't test it -- but I like that idea, so I certainly will test it soon myself :)