Squash CM hardware key rebinding commits

Additional help from Davor

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/config.xml
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

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

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

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

Reimplement AOSP's home-key behavior configuration

Add support for resource-based long-press and double-tap behaviors,
bringing back the functionality introduced by Google at change
I4564d9e4d127f782ed5bd8eb613ef8f2255176cc on top of our own
hardware key rebinding code

commit caca88150cc22a9324b6fed89ecdf394e68cf6f8
Author: Jeff Brown <jeffbrown@google.com>
Date:   Thu May 9 13:34:33 2013 -0700

    Support double-tap home to go to recents.

    Add config resources to enable the following behavior for
    certain devices:

    * press home - go home
    * long-press home - launch assist intent
    * double-tap home - open recents

    Bug: 8891502
    Change-Id: I4564d9e4d127f782ed5bd8eb613ef8f2255176cc
    (cherry picked from commit b7805698035622a633b2d76f7ca60169aaa9f0ca)

Change-Id: I578700abf8c51e613a4227cdf9f6c3bff90feec9

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

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:
	services/java/com/android/server/wm/WindowManagerService.java

Conflicts:
	core/java/android/view/ViewConfiguration.java

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

Fix hardware home key behavior on wake-up

Change-Id: Ib489e4b8bb1d10591afc96c680c7865d61c959a0

Fix home key long press to work when assigned to recent app switcher.

Change-Id: Ibd16ff07b9910605c95180b54040f3e2b78939cb

Build fixes for hardware keys

Change-Id: I070435090c9d32c9ee4d1518f2ab3c08e2a08b69

FW: Use AOKP overflow menu option as default

Change-Id: Id3b4ccbb6cb0468463d5439fa7e721b3617d520d

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

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

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

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

Change-Id: I070435090c9d32c9ee4d1518f2ab3c08e2a08b69