IndexOutOfBoundsException observed rarely in ProcessStats

Sometime IndexOutOfBoundsException is observed in ProcessStats
while allocating longs array. This could be due to synchronization.
This fix will return if array index is >= size.

Change-Id: I1df34152c95f2ff61829da07f750e79a6f1efab3
CRs-fixed: 626638
Signed-off-by: houst0nn <houstonn@gmail.com>
Themes: 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.

Credit to @BigBrother1984 for the original cherry pick

Change-Id: I8ac7e83f7cfa60567166bed699d1cb17c547e20d
Themes: 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.

Credit to @BigBrother1984 for the original cherry pick

Change-Id: I753623696cdc017fc66dc5e85079fe80e5f626f9
Add getThemedResourcesForApplicationAsUser()

Credit to @BigBrother1984 for the original cherry pick

Change-Id: I90b7cb441e4056f59b7260ffa55e31eba644e25a
Themes: 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.

Credit to @BigBrother1984 for the original cherry pick

Change-Id: Idfb53aba307f58be6e2ed6d404b8a76c31199fc8
Themes: 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.

Credit to @BigBrother1984 for the original cherry pick

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

Credit to @BigBrother1984 for the original cherry pick

Change-Id: Icbfbee3404702a29881ad4933721d8beb39bef30
Merge "IndexOutOfBoundsException observed rarely in ProcessStats" into kitkat
Revert "Themes: Modify config to support app specific themes [1/4]"

This reverts commit f538706eda1484f35f71a0e39bf9c53960b0a62a.
Merge remote-tracking branch 'aospa/kitkat' into HEAD

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