BatteryService: fix FC on boot until battery stat is present

updateLightsLocked() can be called from CM's added SettingsObserver
when battery stat is not present, causing an FC and a loop until
battery stat is present.

I/SystemServer(  502): Battery Service
E/System  (  502): ******************************************
E/System  (  502): ************ Failure starting core service
E/System  (  502): java.lang.NullPointerException
E/System  (  502): 	at com.android.server.BatteryService$Led.updateLightsLocked(BatteryService.java:735)
E/System  (  502): 	at com.android.server.BatteryService.updateLedPulse(BatteryService.java:709)
E/System  (  502): 	at com.android.server.BatteryService.access$1600(BatteryService.java:86)
E/System  (  502): 	at com.android.server.BatteryService$SettingsObserver.update(BatteryService.java:860)
E/System  (  502): 	at com.android.server.BatteryService$SettingsObserver.observe(BatteryService.java:822)
E/System  (  502): 	at com.android.server.BatteryService.<init>(BatteryService.java:187)
E/System  (  502): 	at com.android.server.ServerThread.initAndLoop(SystemServer.java:328)
E/System  (  502): 	at com.android.server.SystemServer.main(SystemServer.java:1309)
E/System  (  502): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/System  (  502): 	at java.lang.reflect.Method.invoke(Method.java:515)
E/System  (  502): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781)
E/System  (  502): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/System  (  502): 	at dalvik.system.NativeStart.main(Native Method)

Change-Id: Ic4438fe50e98f1aa05ae1d0d26240bf9410fd92f
(cherry picked from commit 7b6cf25c9aae688a009f1faee1dbeee837e641a7)
Profile: disable triggers when profiles are disabled

Change-Id: Ic25bd90deb1979f2a7f21a5b588e5f1e18834864
(cherry picked from commit cf207fa40abb8b3fd12539237c8b00429d80c95d)
QS: enable haptic feedback and change Alarm tile longpress

nice idea from xploid to have haptic feedback on the tiles
just a bit to complicated to do on every tile

so activate it centralized

as well change the longressbehaviour of alarm tile to the
normal onClick behaviour

Change-Id: I48d4129c63ea6396b2a176bee9d6df02d414d28a
(cherry picked from commit f6ed5464b2543632c908df7141b3576ebce5fe3f)
QS: make dynamic tiles configurable (1/2)

instead of using a bunch of provider settings var
like it was on 4.3 and almost all other roms are doing
use one and split like we do for the normal tiles. This
is more consistent and saves us to observe a bunch of values
As well this is integrated into the one layout screen we have. So
all QS related is easy and logical usable for the user on one
screen

Change-Id: Ic1b8d021f4bf418257df268262b7eff9474d4819
(cherry picked from commit a7d34850b0b55dcb3a51b0ac9381990bce2344a0)
Frameworks: Slim Shortcuts

PS2: Screenshot, Reboot, Last-App
PS3: Forgot earlier derp fixed elsewhere.
PS4: Clean-up
PS5: No change.  Create Dependant.
PS6: Fix blank activities sometimes.

Change-Id: I9c5e7dbdeaa727fca9a7317c3546ff9aa67ef4bf
(cherry picked from commit 9310795c3e131139ba4c2e27830ad8bfdd5a4de4)
Fix appwidgets not updating

Previously there was a bug where if an appwidget's update caused a
TransactionTooLargeException then the AppWidgetServiceImpl.Host's
callbacks were completely disabled, for all widgets.

The fix still allows a DeadObjectException or other RemoteException
to disable the host callbacks, as that would be caused by a bad host.

Fixes issue 28216 on the public tracker
https://code.google.com/p/android/issues/detail?id=28216

Change-Id: I5c5d5939d7211ed23cca69e6674de730b51b0f3e
Signed-off-by: Kevin Barry <kevin@teslacoilsw.com>
(cherry picked from commit 0eeb3dcfa81b8d14a5b980441038fa9feeb3c557)
(cherry picked from commit f42976bf8534e01ebddb24c25a67ba3ef213dab4)
(cherry picked from commit 136675c94c1255337127d4776b80e68c3e6b7cb2)
(cherry picked from commit 25aa3becfd51a0cf7ffb9337b30679143370c6b7)
(cherry picked from commit 2d3a2cc7946d57eab354d4d1ff2e9eb0372cdd91)
(cherry picked from commit 723017bc7fb639adeab80f2f43db510b5f8aa373)
(cherry picked from commit e1589a774dfc4298f423eca7d5de64b013526c35)
(cherry picked from commit cbe569215b4afdfc3060730ffe99b28080be5b56)
(cherry picked from commit 75a798150a36a73e93c4c4b9ba2935bcba02f944)
(cherry picked from commit abe3c6024d9b8d969e02c389ce5dd53675dec39b)
(cherry picked from commit 3b456cf3621925315096cdffa85f912a0f60a425)
(cherry picked from commit 475fee56ed217efbc494fb3d6da94587e9f02600)
add a varaible
(cherry picked from commit 514ffb683718495ab5fa47f1913012aa2a218cdc)

(cherry picked from commit e8c960f363c3e907fab777c69094700fac119c2c)
(cherry picked from commit 65225b4942cc8e1aab2d5b547e08923cca4231da)
(cherry picked from commit c40bca4dfc66a8247aacae92e0af93efc4247dfe)
(cherry picked from commit 99813682e4b31846d56f3b24882d00e9c5ba65de)
(cherry picked from commit a96cb07f86ddb9902bfe1959a90c2c0418b36f54)
(cherry picked from commit 552ad00594d3ceb7d4e83134e2769155fa5f19ef)
(cherry picked from commit 9326a18876ceda2c6e9af093165a374f62f5add0)
(cherry picked from commit 8cd83006f5e130425ae247efc185d39b95eff71c)
(cherry picked from commit 28dc8834e555c231b0c935ee414d311f84471e20)
(cherry picked from commit bd8453cd99b9aea48567ee80c873f574663d4bc7)
MediaFocusControl: Do not grant audio focus if notification stream is 0

Previously audio focus would be granted regardless of notification volume, meaning
that if notifications are muted the media stream would still be dimished for focus.
By checking if STREAM_NOTIFICATION is 0 and if a notification stream is
requesting focus, this no longer an issue.

PS1: Initial implement
PS2: Better implement in MediaFocusControl
PS3: Whitespace

Change-Id: Ie10a64e58ce77174a3bbdeaa936646d40c24404f
Signed-off-by: Evan Anderson <evan1124@gmail.com>
(cherry picked from commit e303cb2000f3ceb674863459b895c6021795dd66)
(cherry picked from commit 1c89a593d62e1b8a37c71eee43a2c40b0b517f66)
(cherry picked from commit 0dd8976d6b5c400a483c7aef71ab7bbc17318bb7)