Add PowerManager integration for button and keyboard backlight.

Allows setting button and keyboard backlight brightness as well as
button timeout.

Change-Id: I550cccafc0a8f90d6347de9261adb26b75955cc4

Conflicts:
	core/java/android/os/PowerManager.java
	core/java/android/provider/Settings.java
	services/java/com/android/server/power/PowerManagerService.java

(cherry picked from commit f0c5766d1747f4adfe4364bb0611765e1171c9a2)
(cherry picked from commit 97a2bc82b929642595adef1961da505812e6e2c1)
SystemUI: Fix potential NPE

Does already cause issues on some Halo ports to other ROMs.
Might not cause issues on PA (yet), but better safe than sorry.

(cherry picked from commit bfa35ccc2a87f73d9f50a29237b157bdba89fbef)
clean up double imports

(cherry picked from commit e710cb905dffe0909f61d482e67140ce924b2fc5)

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
orig file
Revert "orig file"

This reverts commit 387738c4460892d3c1b18c1ccfd74a8dd827718a.
WMS fix: add back IDeviceHandler import
fixes errors in builds referring to WindowManagerService.java

Change-Id: If446047e5b0f31f1e7fe2d3f1507dc94669fb5ad
(cherry picked from commit a5c4b2445049a5bbb1a17585512b39eee7583a69)
TEMPORARY: Reintroduce button-backlight (and respective inactivity timeout)

The power manager rewrite from Change I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
completely removed support for control of the button backlights, which makes
all capacitive buttons out there stay dark. The commit message in that change
mentions it hasn't been implemented _yet_, so this fix should be temporary
until upstream does their own implementation

Change-Id: I6094c446e0b8c23f57d30652a3cbd35dee5e821a
(cherry picked from commit 3ddc1491674415d48a92e20625b27cb551e341a5)
PowerManagerService: Implement setButtonBrightnessOverrideFromWindowManager method

Differs from Android 4.1 (and earlier) implementation in that the
overridden button light still turns off after BUTTON_ON_DURATION instead of
staying on until screen off.  However, button lights are annoying, and
really the purpose of this is to allow apps (e.g., Screen Filter) to
_disable_ the button lights altogether.

Conflicts:
	services/java/com/android/server/power/PowerManagerService.java

Change-Id: I4220246ee364222673586fa908404f9d16efb64b
(cherry picked from commit a220d2b2bb0bc54a2585cd447baa38dcf77ab903)
Keyboard light: Fix the physical keyboard not light when it's visiable.

Change-Id: I595afd3cb6b422a17ae0f6ec20aa51979db13810

Conflicts:
	core/java/android/os/PowerManager.java
	services/java/com/android/server/power/PowerManagerService.java

(cherry picked from commit df78fc62ce72a47863e8f9d5bb74f8d130d761c8)
keyboard: adding functional alt/shift lights

This is useful for devices that has QWERTY keyboard
and leds for the Alt/Shift (Fn/Caps) keys, like
htc doubleshot.

Depends on libhardware patch for the light ids:
http://review.cyanogenmod.org/34902

Change-Id: I66ebc2d881438f5b51db77eaa885421e65a7da0d

Conflicts:
	core/java/android/os/PowerManager.java

(cherry picked from commit 04b51775126ef44db545ff4a819b9a11d2c0e259)
Keep keyboard lit until the screen is dimmed

Do not use button timeout for keyboard (which is intrusive on QWERTY
sliders). Keep it lit until the screen dims instead of turning it off
like the buttons after 5 seconds. Also consider setting keyboard
visibility as a user activity.

Conflicts:
	services/java/com/android/server/power/PowerManagerService.java

Change-Id: I32ea85ef558a5d3b5047695464e4172d24b3121d
(cherry picked from commit 4bb1d5beff9b4502bef96aee619e1fae299deed4)
Factor out preference-in-storage check to overridable method.

Change-Id: I2fff3192802f8a180330fda66388eda394334a5a
(cherry picked from commit 879ad53bf9e08d6cfd545957c0352ae4c14bee62)
Treat default value that wasn't found as empty value.

Fixes http://code.google.com/p/android/issues/detail?id=33220

Change-Id: If22e8b245f688d922c168aa54c8acf743c0644d7
(cherry picked from commit 8b7755aa667e76500e2f97aff37f2c79cfbc8f9c)
Allow adjusting progress on touch events.

Change-Id: Ide0a7ae057a62f3631a32eeaa63f3e04dec5bf54
(cherry picked from commit 55b62a82192111ab2a0b939fc3e4eacefa9a3d60)
[2/2] Permit home button wake to be configurable

Change-Id: Ie52247d5c23c8f840ababc880dd41992049cefd1

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

(cherry picked from commit a76e0fa9436b5e3a252c7d45b1ff0d6b9a0ba26f)