Frameworks: add Battery Styles the new way 1/2

Ported from slim

=================================================================

fb: add Battery Styles the new way 1/2

google draws now the battery icon which fits perfectly into our
concept. Beside that the batteryview is as well used on QS.
So we readd our battery icons (icon, percentage, icon with percentage
circle, circle perc, dot circle, dot circle perc) back and all are
drawn. As well the icon does not only change on statusbar as well
on QS it is reflected.

As usual color options are present for the User to style the icon

Change-Id: Iae9021af56a21b8d39efc5162186eb17ecc933e2

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

remove unused methods

remove unsed method

change to magicmod name

add Battery Styles the new way 1/2  --fix derp
Frameworks: Fix first animation to QS

on click of qs settings button

Change-Id: I7fbc4bc162aabeedb6b88c3046403c12ebb2e6bf
Frameworks: correct the google animation on flipping to QS to be nicer

Ported from slim

==================================

that the carrier text on flipping to qs hides when QS is already present
is not very nice from UX perspective. Correct this behaviour to hide
it directly when the user goes into QS. Same for notification shortcuts

As well reflect this behaviour on manual flippsettings

Change-Id: Ib181bef2022b974e05ec8ebeb195e08cd41a4ffc

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

remove unsed method
fb: show percentage on icon in bold and use for

only percent more width in statusbar and QS
As well show on percent with icon on fully charge not the bolt
and instead the value 100

Change-Id: I4e0b837ff6e217e1c9f78d967aa57c3e2f1bf2ad
fb: follow new 4.4 transition on center clock and circle battery

Change-Id: I50657071f290e0646193d079ab9319ed15f667b6
Re-Add WiFi reloading config

frameworks/base: support devices with SoftAp that don't require firmware reload

Change-Id: I01e868ad2824c4cb0fdfdae866d794b39cf78095
fb: statusbar reflect am/pm based on the global user settings 12h/24h format (1/2)

Change-Id: I7d6eec4d62f0e1072f11e8e131608b78f17539d9
Improve scrolling cache

Scrolling cache helps make short scrolls/flings smooth but will
cause stutter when long flings are made. This patch disables
scrolling cache when long flings are made.

This patch also fixes a related bug where scrolling cache will
not be enabled properly when transitioning from flinging to scrolling.

Patch Set 2: Calculate threshold based on maximum velocity (Sang Tae Park)

Credits: Pawit Pornkitprasan

Change-Id: I1fdbaad92263c9f983a32900e74eba1f0367902b
Signed-off-by: Arham Jamal <arhamjamal@gmail.com>
Fix to NullPointerException when activity is relaunched

When ChooseTypeAndAccountActivity is relaunched and resumed
by ActivityManager a call is made to onActivityResult without
first triggering onResume. This leads to mAccounts object
still being null.

Fixed by properly setting mAccounts object if it is null prior
to use after function onCreate has been called.

Change-Id: Ife7e1e052c473970d923fa43ee6189eb62a1113b
Keyguard: Set WIDGET_CATEGORY_KEYGUARD when AppWidgetHostView is created

Allows the default lockscreen widget to inherit the keyguard widget
host category.  Without this, only widgets added through
KeyguardActivityLauncher are assigned the correct
OPTION_APPWIDGET_HOST_CATEGORY.

Change-Id: Ic97818d85ca5f00da0ce43bb36006d66a6935363
StorageManager: fix android.process.media process stop while plug a discontinuous partitioned SD Card

While get volume state, throw an IllegalArgumentException, catch
this exception in StorageManager and return null to MtpService to
avoid process stoping.

Change-Id: Iebb5c38e375d3f54505d9b9d64fcd0f02a2b60c1
Author: Li Gang <gang.g.li@intel.com>
Signed-off-by: Li Gang <gang.g.li@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 47459
Remove possible leak when exception occurred.

nameUtf8 is not released after exception.
In addtion, Fix code going down after ThrowException.

Change-Id: Id46e8ed55acd98e982ae532f7da2c0c48847f010
frameworks/base: Fix to remove exception in tonegenerator

- Framework reboot happens, if tonegenerator fails to create
  a track in audioflinger.
- The cause for framework reboot is, an exception thrown by
  tonegenerator if fails to init.
- Fix is to remove the exception and delete the tonegenerator
  instance.
CRs-fixed:466491

Change-Id: Ie7b87f787d8a885cc70be9af4ba9d04ecd691cc2
framework: packageinstaller :fix logical error in size calculation

fix logical error in available size calculation.

Change-Id: Ic6ce312cf1c146030a20187fcb27b24fbe4c321a
libaudioeffect_jni: GREF leak fix for JB

- Excessive JNI global reference in AudioEffects.
- Global references created during native setup
  are not deleted.
- Global references are deleted in setup failure
  and during native release.

(cherry picked from commit a04a2bf4563dc20c52f4d4239e01f80b220077a5)
CRs-fixed: 413633

Change-Id: Ia4340a2128850101b394e00c8e1db9db49f516fd
Wifi: Fix for connection failure between third client and GC.

When third device sends a connection request to the group client, the
existing connection is terminating and also the ongoing connection not
successful.Currently as there is  no use case where third device is
connecting to GC,and the existing onnection getting terminated.This
is addressed by ignoring the new connection request from third client
to GC and the existing connection is intact.
CRs-Fixed: 467049

Change-Id: I784c38b9a4ca0c60b188b9697e3b4af4d09053cc
frameworks/base: move the traces file to avoid data loss

If an ANR comes just after the framework reboot, the traces for
the framework reboot will get over-written with the ANR traces.
So, We are missing the traces for the framework reboot which
makes debugging the framework reboot difficult.

This patch will rename this trace file for the framework reboot
once the ActivityManager collects the traces.

Change-Id: Iee07b13ba02d8aab9cc43567aa5df131cc43c737
Fixes for clang:
PackageInfo is a class, not a struct.
String16 is contained in the android namespace. Do not namespace prefix it
within the android namespace.
Explicitly specify which std classes are necessary to prevent ambiguous
type errors. (map, set)

Change-Id: I0d01477a976e770821ebae8847f8d11b132a15d6
Frameworks: speed up statubar/notification drawer

a lot user complain about slow statusbar pull down introduced
with jb 4.2....this speed it up

thanks to IceColdJelly

Change-Id: Iae108f5680b25ea995168a505a30e06bef0185d3
Add turn off action to WiFi Tether notification

PS 2+3 : Fixed Icon + Add persistence to WiFi state [mnazim]

Change-Id: I320405ed7e90e4c06ecdb127cd4c1cad6bedbcdd
Signed-off-by: Gergely Szell (sethyx) <szell@hu.ibm.com>