[1/2] Base: Battery Saver mode

Concept:
http://jira.omnirom.org/browse/CONCEPT-24

introduce battery saver mode
this based from what user want or what user do to saving the battery life
this include:
1. Automatically switch mobile network into what user choice and also disable mobile data IF wifi connected to an AP
2. Automatically switch mobile network and disable mobile data IF battery low (battery level can configure)
3. Reduce screen brightness based low battery (this feature will disabled if Auto brightness mode enabled)
4. Not changing network IF on Call or Usb tether enabled or WifiAP enabled
5. Not changing network IF there is Download/upload progress
6. Support For Both GSM and CDMA devices (need someone to test for CDMA devices)
7. every condition has an option :D
8. Restore all network configuration if battery saver mode disabled
9. Add Time Range to start battery saver mode
10. allow device without mobile data support, to using this feature
11. fix inconsistent battery low level
12. rewrite to better performance
13. modified the controller to support battery saver mode
14. add bluetooth, gps, wifi, and mobile data (if support) to be disabled while power saving activated
15. fix build QuickSettings because of LocationController change
16. rewrite to better performance
17. fix brightness value
18. rewrite (again) to allow add more saving mode
19. do delay changing only for POWER SAVING not NORMAL mode
20. add Cpu power saving mode
21. fix Cpu freq value
22. fix call saving state for non user configuration mode
23. fix NPE
24. add kill all task
25. add disable sync
26. add disable vibrate
27. add disable led
28. add notification :)
29. finally fix sync interval :D

preview:
http://jira.omnirom.org/secure/attachment/10394/Screenshot_2014-03-07-19-54-57.png
http://jira.omnirom.org/secure/attachment/10395/Screenshot_2014-03-07-19-55-56.png
http://jira.omnirom.org/secure/attachment/10396/Screenshot_2014-03-07-19-56-06.png
http://jira.omnirom.org/secure/attachment/10397/Screenshot_2014-03-07-19-56-14.png
http://jira.omnirom.org/secure/attachment/10398/Screenshot_2014-03-07-19-56-27.png
http://jira.omnirom.org/secure/attachment/10399/Screenshot_2014-03-07-19-56-34.png

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

Change-Id: I9d86ef1425228e11cadd85d37c5b6e8b20e50fb0

Conflicts:
	packages/SystemUI/res/values/custom_strings.xml
	packages/SystemUI/src/com/android/systemui/BootReceiver.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
	packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
	packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
	services/java/com/android/server/NotificationManagerService.java

Conflicts:
	core/java/android/content/Intent.java
	packages/SystemUI/res/values/slim_strings.xml
	services/java/com/android/server/NotificationManagerService.java
missing strings
Squashed commit of the theme engine support.

Updated 4.2 support for the old T-Mobile theme engine, as usual
needs the provider and switcher apps installed as well.

I'm finally dropping the 400+ commit history on this, since everybody
else keeps picking it up from CM as a single patch anyway... But
for the record, nothing of this would be possible without Josh, Ed,
and the rest of the TMo guys who wrote and maintained it until 2.2:

amit chabra <amit.chabra@t-mobile.com>
Amit Kohli <amit.kohli@t-mobile.com>
Chris Cogar <chriscogar@t-mobile.com>
Dirk Sigurdson <dirk.sigurdson@t-mobile.com>
Ed Carrigan <edward.carrigan@t-mobile.com>
Gaurav Sharma <gaurav.sharma3@t-mobile.com>
Hui Feng <hui.feng@t-mobile.com>
John Ritz <john.ritz1@t-mobile.com>
Josh Guilfoyle <josh.guilfoyle@t-mobile.com>
Mark Roberts <mark.roberts48@t-mobile.com>
Pankaj Kumar <Pankaj.kumar6@t-mobile.com>
Samuel Cheung <samuel.cheung@t-mobile.com>
Sergey Ten <sergey.ten6@t-mobile.com>

Change-Id: I7148d51be48f28a2dc4bdf9ec9018f04b268ffc4

Conflicts:

	core/java/android/app/ResourcesManager.java
	core/java/android/content/res/Resources.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
	services/java/com/android/server/UiModeManagerService.java
	services/java/com/android/server/connectivity/Tethering.java
	services/java/com/android/server/pm/PackageManagerService.java
	services/java/com/android/server/wm/WindowManagerService.java

Conflicts:
	libs/androidfw/AssetManager.cpp
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	policy/src/com/android/internal/policy/impl/GlobalActions.java
	services/java/com/android/server/SystemServer.java
	services/java/com/android/server/am/ActivityManagerService.java
	services/java/com/android/server/pm/PackageManagerService.java
Fix theme provider crashing for non-primary user.

PackageManagerService's context is for user 0, so if the theme provider
for other users was invoking the getInstalledThemePackages() method, the
themes provider crashed as it doesn't have the INTERACT_ACROSS_USERS
permission.
Fix that (and simplify code) by making getInstalledThemePackages()
return the installed themes for the current user, which was probably the
intent anyway.

Change-Id: I02002cee005b74128f3b2f7cc7a93b9b8514f1f3
Check themes of current user, not user 0.

Change-Id: I5d685a04289b434a12e460b4fdacc43a41ff2be1
JIRA:CYAN-1303
ResourcesManager: Fix theme insertion at boot

This was lost during the 4.4 ActivityThread reshuffle, put it back

Change-Id: I96eadf691973e9a2daa099b55816fc103d129be7
PackageManager: Prevent themes from going into ASEC containers

Themes on ASEC cause all kinds of random timing/racey issues at boot
time, and more kinds of racey concurrency issues at uninstall/upgrade
time. Stop them from getting into containers at all.

Change-Id: If08e90c51137b22239831a4eca17ea00d5d87d93
ThemeUtils: Retain the original package name in themed UI context

In order for themes to reflect on system elements, we're changing
their context, including the package name.

This breaks anything that tries to identify system elements,
most notably any users of the uiautomator. Trying to do
'UiSelector().packageName("android")' to find, for example,
a force-close dialog will fail.

Fixes com.android.cts.uiautomatortest.CtsUiAutomatorTest#testUiWatcher

Change-Id: Ic05c3024b20ac3772ed5597846fbfa4a184ebb0d
platform: Fix the gid for the theme manager service

It was mismatched with fs_config, resulting in attribution of the
"-1" gid

Change-Id: Ia6d55af0b39f659da2965f9bc0bda0df5c775ba4
PackageManager: Let com.tmobile.thememanager access privileged permissions

Needed for CHANGE_CONFIGURATION

Change-Id: If50b0926d77e15e18ef5e88d7efac1b7f209d6e4
AssetAtlas: Fix NPE when there are no preloaded resources
AssetRedirectionService: Check for permissions before running dump()

Fix android.security.cts.ServicePermissionsTest failure

Change-Id: I9d629d19f3ff231db477d156c8bf557d4b8ee861
AssetRedirectionManager: Accept redirections only for whitelisted resource types

Change-Id: Idf1ea739a81719b6a196f0114c9fc3b7c7ff428c
Frameworks: cleanup activity thread whitespace

Conflicts:
	core/java/android/app/ActivityThread.java
PackageManager: fix app lib migration for device with /datadata

For devices using /datadata, dataPathString will point
to /datadata while nativeLibraryDir will point to /data/data.
Thus, compare to /data/data directly to avoid problems.

Change-Id: I11149cf9cc5a573cc85513e12d3569b514f5ffb5
SystemUI: Allow theming battery via theme chooser

Change-Id: Iebea2dab0ed89baa14c0f18a4c8f487cdb8313a6

Conflicts:
	packages/SystemUI/res/values/colors.xml
Dont hide here