Port "Bind VolUp+VolDown to toggle the ringer"

Squash of http://review.cyanogenmod.org/#/c/20256/ and
http://review.cyanogenmod.org/#/c/22716/

Change-Id: Ied3767969482a7ea44f7f0e9222a2f78fe8f507c

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Hardware key custom rebinding (1/2)

Framework changes to allow rebinding of the actions performed on the following
key press events: Home long-press, menu press, menu long-press, search press,
search long-press, app-switch press and app-switch long-press.

The available actions are: Nothing, open/close menu, recent apps switcher,
search assistant, voice search and in-app search.

Patch Set 1: Initial port from ICS [done by Konstantin Koslowski]
Patch Set 2: Added 'assist' (search) key customisation
             Option for ICS-style in-app search, in addition to jellybean-style
             search assistant.
             Fixed double haptic feedback on virtual key press.
Patch Set 3: Checkbox to enable/disable all custom bindings.
             Home long-press defaults to no action on devices with
             an app-switch key.
Patch Set 4: The recent apps list will be preloaded on the initial down press
             of whichever key to which it is bound.
Patch Set 5: Fixed menu virtual key press sometimes performing the custom
             action bound to the menu key instead of just opening or closing
             the menu as it should.

Conflicts:
	core/res/res/values/public.xml
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Change-Id: I72c0d220a09d79230bfa299e0521ed693e5c25f1

Conflicts:
	core/res/res/values/symbols.xml
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/config.xml
	core/res/res/values/liquid_symbols.xml
android.policy: Fix launching home when waking the device with the home button again

Was removed in b055725d0b1df2f23ecfa95bff940aa8b57f97df

Change-Id: I19b5db8e64d7e547f4013ab8df7ff879d1a51167

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Lockscreen VolCtrls : Don't raise volume on skipTrack

Set mIsLongPress to true when longpress was successful to avoid
volume from being changed on release

Change-Id: I874f7d66248e30535dddfec53ddd299718e3fa3d
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
bugfix: allow recent apps dialog to work with menu long-press

With the original patch, using the recent app dialog from a
menu button long-press would cause the dialog to be preloaded
and then dismissed on key-up. Check long-press behavior settings
as well as short-press to prevent the dismissal.

Change-Id: Idf1d27aa725547e0ddc44905e27da6c1b4540fab
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
	core/res/res/values/symbols.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
PowerMenu : Improve keyguard filtered actions

Replaces the check for visibility of lockscreen with the state
of the keyguard instead. This avoids the situation where actions
returning false from showDuringKeyguard, are still shown if user enters
emergency call screen.

Change-Id: Idb5df14813d9479bd4178dbb9eb3b91cbecda5de

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Revert "fb: add config.xml option to permanently force permanent menu key"

This reverts commit f4c697bdda11bafd6871fb7274595161dfc3a73f.

Conflicts:
	core/res/res/values/config.xml
	core/res/res/values/liquid_symbols.xml
Detect whether overflow button should be shown based on menu key state

Some devices may have hardware keys but not contain a hardware menu key.
Hardware keys are also able to remapped. The overflow button detection logic
currently does not take that into account. This change allows detects
whether any key is capable of emitting the MENU_ACTION keystroke in
order to determine whether the overflow button should be shown or not.

Change-Id: I8699bd0242560314f8eadc54b187c69c992cf875

Conflicts:
	core/java/android/view/ViewConfiguration.java
	services/java/com/android/server/wm/WindowManagerService.java
[2/2] Permit home button wake to be configurable

Change-Id: Ie52247d5c23c8f840ababc880dd41992049cefd1

Conflicts:
	core/java/android/provider/Settings.java
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.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
policy: fix menu key for devices with no physical menu key

Initialize key behaviour correctly for the case where the respective key
isn't present in hardware.

Change-Id: I424f879dcf5e09c0897d7ebf7646efe36661d108

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Fix virtual key press detection.

Virtual key events can be injected from anywhere, not just
PhoneWindowManager.

Change-Id: Ia9529c6534a208bf713912fc63f81a016754c6a6
Enable custom actions for double-tap home (1/2)

PatchSet1: add custom actions
PatchSet2: set defaults
PatchSet3: try to get defaults from config.xml
PatchSet4:
* do get defaults from config.xml
* store state of HARDWARE_KEY_REBINDING
* removed trailing whitespaces
PatchSet5: merge with 48002
PatchSet6: getting late, forgot to change the title when merging
PatchSet7: remove whitespace trimming, reduce code duplication
PatchSet8: rebase, simplify code

Change-Id: I041e7ab3853b356ddbdab2524f096546319276f9

Conflicts:
	core/java/android/provider/Settings.java
PhoneWindowManager: Hardware key handling fixes and cleanup

-   Call cancelPreloadRecentApps for long presses and double taps of the home
    key at the right time based on the assigned actions.
    (Reverted Ibd16ff07b9910605c95180b54040f3e2b78939cb as the issue is fixed)
-   Do not allow any menu key events through to apps if
    mPressOnMenuBehavior is not KEY_ACTION_MENU.
-   Don't cancelPreloadRecentApps when menu key is released after a long press.
    (Reverted Idf1d27aa725547e0ddc44905e27da6c1b4540fab as the issue is fixed)
-   For the menu, app switch and assist keys don't cancelPreloadRecentApps on
    long press if the long press has no action assigned to it.

Patch Set 2: -  Fixed not cancelling preload on long press of home when double
                tap is bound to recent apps.
             -  Reduced delta against AOSP.
Patch Set 3: -  Do not perform long press action when key continues to be held
                down after a double tap on home.

Change-Id: I3cc8f9528e5dbd3e0b78308b03440abd9d9351f6

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Fix unresponsive home key after waking device with a long press

With the lockscreen disabled mHomeConsumed would not be properly set back to
false upon releasing the key, causing a subsequent press to perform no action.

Change-Id: I38eeba5850c2f0474cc4cca82a9dcbf17afa4665
Fix hardware home key behavior on wake-up

Change-Id: Ib489e4b8bb1d10591afc96c680c7865d61c959a0
Remove 'force overflow button' logic.

It's force-enabled now anyway.

Change-Id: Ib4489456d40650316d45865fedfae9c3c960b81e

Conflicts:
	core/java/android/provider/Settings.java