LockScreen: allow long-press actions from hardware keys (1/2)

Allow following actions with button long-presses on lockscreen:
- toggle flashlight (if available)
- play/pause/next/previous track selection
- toggle silent mode

Allow customizing of back, menu, and home buttons. Search
button events are completely ignored on the lockscreen.

Auto-detect hardware keys, only show appropriate menu
options based on the actual hardware keys available on the
device (or completely hide if there are no hardware keys).

Based largely on Danny Baumann's work from gingerbread.

Ported from CM10
Change-Id: Iff32736d00ca5d4122f64a6a861bbb0a1de9cca9

Fix home/menu unlock with long press hardware key
- Forward port of commit 2a572ee
Change-Id: Ic2eb85542f8052fe1662244fe5e72ba12a98608b

Keyguard: Fix for home wake/unlock
sometimes device is waking and unlocking during the same keypress.
Change-Id: I72ea7611d39aac0cd03dfd5aa7036aeef7600140

Use sticky broadcast to convey torch state (1/2).
It doesn't really make sense to store the (non-persistent) state of the
torch in a (persistent) setting. As the torch is sending a broadcast
anyway, make that broadcast sticky and use it to convey the state.

Also unify the torch constants (actions, extras, activity names) at a
common place.
Change-Id: If845bef27cc79990794aa748dce18cfea3bac1f5

Fix Home/Menu/Back keys' unlock
Change-Id: Ibd3842b6ad8e037a2a9f8eb581e7c55900017b0f

LockScreen: allow hardware key longpress to put device to sleep
Change-Id: I54260e21c462bcabd9b6383e22f44d644630b4d3
Framework: Add option to always show battery status on lockscreen (1/2)

Based on the feature by burnsra in CM7
Authored by Blunden
Tweaked by DvTonder
Change-Id: I642da4dcd82a776a74d77031d37acc76f97b25af

lockscreen battery status: add off option (2/2)
Change-Id: Ie10015865f161e783dc394d467e456d51dc9fbbc

Conflicts:

	core/java/android/provider/Settings.java
Re-initialize error after attach

If flag for error after attach is not reinitialized, it may cause
NullPointerException on subsequent onAttachedWindow if error text
was reset to null.

Change-Id: I8976c28a6ca71017e5c4b3f29d4eeeb2eda48c38
Fix a JNI local reference leak in JNIMediaPlayerListener::notify.

Bug: https://code.google.com/p/android/issues/detail?id=62137
Change-Id: I776cd83a66de37fdbbe8af367bf1b26e5e0c7247
Fix NPE in ConnectivityService

Could occur when requestRouteToHostAddress is called on a network
with no associated tracker.  Code later in the method handles
this case gracefully but code introduced in JB throws an exception.

Change-Id: I6c8a0e313ecbcca120aeb5dd0802a72114749aa1
Show owner info creation if no owner is set for UserTile

Forward port from cm-10.2.
Squash of the following commits:

Show owner info creation if no owner is set for UserTile

Fix showing owner info creation from UserTile if no owner is set

* Turns out the default user will always be present, meaning a check of
  user count == 0 fails.

Show default profile name if no profile exists

UserTile : Check if profile has a photo

In the event that the profile doesn't have a photo, don't default to the
user's photo, instead show a default avatar.

Change-Id: I89de06f8578280e4671526418b2cabcc5f4348c7
Breaks our userimage on the tile

Revert "Show owner info creation if no owner is set for UserTile"

This reverts commit 9920125cce0b289be3485763f084d8abd95fe57c.

Change-Id: Ic4b532ec0b8b55d21ac74cb2d0cc0ff706ef0f74