Modify config to support app specific themes [1/4]

Summary of Changes
1. The configuration now supports each app to have their own theme.
Each theme can include icons, styles (ie overlays) and font.

2. The theme config is serialized into a json string and stored
in secure settings.  This entry consolidates what was previously 3 separate
keys (style, icon, font) into a single field.

3. 'CustomTheme' was renamed to 'ThemeConfiguration'.

Note: This commit is for the configuration. Additional work needs to be done to
the framework and UI to support app specific themes.

Change-Id: I6f72f542829578201c57c54786456486f6a6e2e3

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/java/com/android/server/SystemServer.java
	services/java/com/android/server/am/ActivityManagerService.java
Support theming navbar separately from SystemUI

This allows using a different theme for the navbar than the theme
applied to the rest of SystemUI.  This will not affect theming until
we have the front end in place that allows users to change this.

Change-Id: I3ad4e8774ac69d1e6e1d83fa5e1ffe59b977d4e9

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
Add getThemedResourcesForApplicationAsUser()

Change-Id: I90b7cb441e4056f59b7260ffa55e31eba644e25a
Allow specifying a theme when creating a Context

A Context normally loads the resources associated with the given
package that this context is for.  This patch allows us to specify
a theme we want attached to a given context's resources.

Change-Id: I1e619f038566233bd89ee96eb8eb87fa6894e630
Use systemui's applied theme for notifications.

Notifications contain RemoteViews which are inflated using the
application's context for which this notification belongs to.  This
can look out of place if SystemUI is using a different theme than the
rest of the system.

This patch will use SystemUIs theme when inflating the RemoteViews,
giving us a more consistent look in the notification drawer.

Change-Id: I9514ce7fcc4858bad3d3c4190f55c1f5a1441d7c
Themes: Add icon previews to ThemesContract

Change-Id: Icbfbee3404702a29881ad4933721d8beb39bef30
Themes: Style, boot animation, and wallpaper previews

Change-Id: I2b367bf5336c03f2a4972a05b68922065cd4a701
Themes: Add URI for querying previews of applied components.

Change-Id: I97417901f3b03fc82df5a823970991ddd8092df2
Themes: Allow theming navbar bg color

Change-Id: I256afc30fc018ea752769029c5246bc7310c23a6

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
Fix ResourceNotFoundException when updating  applied theme

If the user has a theme applied and there is an update to that theme,
then the themed apps will crash. This is because the theme's APK path changes,
but the apps do not update their resources. Apps were not updating their resources
because updateConfiguration() determined that the config (which only has pkgName) hasn't changed.

The problem is fixed by first applying the default theme config and then re-applying the
updated theme.

SystemUI was crashing with a NPE while verifying this fix, so a NP check was added to SystemUI as well.

Change-Id: I00e32fc1535b4d279fcb37c35f868501ecc1dd19

Conflicts:
	packages/SystemUI/src/com/android/systemui/quicksettings/UserTile.java
Themes: Support applying components from multiple themes [1/3]

The current implementation assumes the components being passed
into the ThemeService belong to the same theme.  This patch uses
a Map instead of a List to pass in a mapping of components to
package names, allowing us to apply several components from
different themes.

Requesting a theme change now takes a Map<String, String> which
maps components to the theme package name they will be applied
from.
Example:
    Map<String, String> componentMap = new HashMap<String,String>();
    componentMap.add(ThemesColumns.MODIFIES_ICONS, "com.mytheme.blue");
    componentMap.add(ThemesColumns.MODIFIES_OVERLAYS, "com.mytheme.red");

    ThemeManager tm = (ThemeManager) contex.getSystemService(Context.THEME_SERVICE);
    tm.requestThemeChange(componentMap);

Change-Id: I13fa17eabecb824884fe522d5dc1822a4d7c55f4

Conflicts:
	core/java/android/content/res/ThemeManager.java
	services/java/com/android/server/ThemeService.java
SystemUI: Restore bounds when loading new gradient

This fixes an issue introduced with the reloading of the nav bar
transitions after a theme change in Change-Id: I256afc30fc018ea752769029c5246bc7310c23a6

Change-Id: I648039506b826583d554b2a0cf4f6ab9a9bb1de8
Catch all exceptions when retrieving ComposedIconInfo

It is possible to receive a TransactionTooLargeException when
getting the composed icon info from the package manager service.
We should catch these exceptions to avoid unnecessary crashes.

For reference:
The Binder transaction buffer has a limited fixed size, currently 1Mb,
which is shared by all transactions in progress for the process.
Consequently this exception can be thrown when there are many transactions
in progress even when most of the individual transactions are of moderate size.

see http://developer.android.com/reference/android/os/TransactionTooLargeException.html
for more details.

Change-Id: I70d35dc4926125bfbef5d8c5fb8ed6d6fcdbf159
Add SET_WALLPAPER permission to SystemUI

If an exception is thrown in updateWallpaperLocked, a call to
WallpaperManager.clear() is made.  This requires the SET_WALLPAPER
permission and will throw a SecurityException if that permission
is not granted to SystemUI.

Change-Id: I61811b65dcfe8b15f0e9030f7aa6d1dc09cea351
Themes: Add STYLE_THUMBNAIL to PreviewColumns

Change-Id: Ie18264cbede92220335400428e67735866cd442d
Themes: Add helper methods for creating complete component maps

These methods can be used to apply a theme while replacing any
components not found in the theme with the defaults.

Default components come from the default theme for the system
with any missing components in that default theme coming from HOLO.

Change-Id: Idea55cc684ccc8304b01a991c36b6993f55b8880