Merge branch 'jb43' of https://github.com/ParanoidAndroid/android_frameworks_base into jb43-legacy

Conflicts:
	packages/SystemUI/res/values/dimens.xml

Change-Id: Iccaa8dddbaf3ed5865c13c2838490aa0ff2cb738
(cherry picked from commit f521fccd95ea110887cabb10a95dabb979d7fd40)

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/halo/Halo.java
orig file
Revert "orig file"

This reverts commit 37a880384e1049e0c0b649e7652a084d22f2f834.
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
(cherry picked from commit 1cd02e85ed49d803577444f59b11d114ec33da60)
PackageManager: Let system-defined permissions take precedence over settings

If a permission was already present in the device's settings due to having
no prior system definition, and the system tried to take it over
(after a version upgrade, for example), it'd fail, since the saved
value would clobber the one previously read from the permissions XML.

This breaks system-behavior changes (gid grants, in particular) unless
the user performs a factory reset after upgrading, which isn't acceptable.

Change-Id: If2e44110f6db735ad29cdf1086e814bd1299e290
(cherry picked from commit cf0ffa0ac870cea8104fd7963850e7ef38726436)