Theme manager : some more merge fix
Squash CM hardware key rebinding commits

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.

android.policy: Fix launching home when waking the device with the home button again

Was removed in b055725

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.

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 caca881
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 b780569)

Fix ordering of home keypress handling

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

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.

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.

Fix virtual key press detection.

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

Fix hardware home key behavior on wake-up

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

Build fixes for hardware keys

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

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.

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.

Adds ability to answer call with hardware HOME button (preparation to winter time)

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

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.

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/mahdi_config.xml
	core/res/res/values/mahdi_symbols.xml
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java