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

-Fix home/menu unlock with long press hardware key

jt1134 authored 11 months ago

-Keyguard: Fix for home wake/unlock sometimes waking and unlocking during the same keypress.

corcoran authored 9 months ago

-Policy: always use hardware acceleration for keyguard

pawitp authored 9 months ago

-Fix Home/Menu/Back keys' unlock

NeverGone-RU authored 2 months ago

-LockScreen: allow hardware key longpress to put device to sleep

jt1134 authored 2 months ago
Adds ability to answer call with hardware HOME button (preparation to winter time)

Change-Id: Ic11449acf87c6b4d932142b74158af7441658b3d

Patch set 1 : Upload the change
Patch set 2 : Only change the real Author
Patch set 3 : Bugfix:
              Add register for the ContentObserver (Settings.Secure.RING_HOME_BUTTON_BEHAVIOR) in PhoneWindowManager,
              and correcting the logging functions and deleting some unneeded comments

Conflicts:

	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Dispatch keys to a device specific key handler

Injects a device key handler into the input path to handle additional
keys (as found on some docks with a hardware keyboard).

Configurable via overlay settings config_deviceKeyHandlerLib and
config_deviceKeyHandlerClass.

Change-Id: I6678c89c7530fdb1d4d516ba4f1d2c9e30ce79a4

Conflicts:
	core/res/res/values/symbols.xml

Conflicts:

	core/res/res/values/config.xml
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
DeviceKeyHandle: The device should consume only known keys

When the device receive the key, only should consume it if the device
know about the key. Otherwise, the key must be handle by the active app.
Also make mDeviceKeyHandler private (is not useful outside this class)

Change-Id: I4b9ea57b802e8c8c88c8b93a63d510f5952b0700
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>

Conflicts:

	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
DeviceKeyHandler: Increase handler priority

Allow DeviceKeyHandler to have higher priority when handling user keystrokes.

Patchset 2: Update commit message
Patchset 3: Rebased
Patchset 4: Fixed needed ref
Patchset 5: Rebased

Needed by http://review.cyanogenmod.org/#/c/35064

Change-Id: I60871052aaae0af7d864113f00dbdf9ba5200f2e
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>

Conflicts:

	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
[2/2] Permit home button wake to be configurable

Change-Id: Ie52247d5c23c8f840ababc880dd41992049cefd1

Conflicts:

	core/java/android/provider/Settings.java
Always prevent wake on home keypress when kl config does not contain WAKE

http://review.cyanogenmod.org/#/c/43124/ introduced a change in behaviour
where the home key could wake a device even if the kl config lacked
the WAKE option.  This fix restores the original behaviour.

Change-Id: I56fc23244957a5738823b5e59f0a719670b41f6d
Fix ordering of home keypress handling

* Home keypress handling was done out of order, causing an extra go home
  action to be executed.

Change-Id: Ieb2f6ffbf6d1e18a5d4602975f48717089e5c9dc

Conflicts:

	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Fix hardware home key behavior on wake-up

Change-Id: Ib489e4b8bb1d10591afc96c680c7865d61c959a0
DeviceKeyHandler : Allow handling keyevents while screen off

Some devices require the keyevents to be processed while the screen
is off, this patchset addresses that by moving the filter up in the call
hierarchy.

Change-Id: If71beecc81aa5e453dcd08aba72b7bea5c210590
Make lock screen menu button actions work regardless of rebinding

Fixes 'Menu unlock' and (Lock screen->Button actions->)'Long press Menu button'
when the menu button is assigned to an action other than its default.

Change-Id: I4c2e2cf47fa2f0c171e3599cdc36bc744a708c3b
PhoneWindowManager.java: fix derps