Set themes to install internal only

Themes should not be moveable to sdcard. Before this patch the new
style themes installed with forward lock would fail.

Change-Id: Iea50f5526b1c2c56a825757eac5bf4bb01b4686d
CM11 Themes: remove handleThemeConfigChanges

This was used by the T-Mobile theme chooser and is no longer
needed with the new chooser.

Change-Id: I035606ffe6cb3efc82a3a0ce79215509d8289503
CM11 Themes: Fix how common resources are found

During the boot process, application info may not be fully
available and createPackageContext can throw a null pointer which
causes a theme's resource-cache to be cleared.  If this theme is
in /system/app or /system/priv-app the theme will still be installed
but applying it will result in styles not being applied.

Change-Id: I4094bdd923edc1d829024404a4ce1b72709bd4f1
Themes: Support launcher based icon packs [1/2]

Before this patch, icon packs written for Trebuchet/Nova/Apex could not be used
with the new theme engine as the formats were different. Particularly the icon package IDs are 7F,
the same ID as as regular apps. Furthermore the location of resources in these icon packs was different
from what the theme engine expects. This patch adds support for these icon packs by overriding
the pkg id.

AssetManager now can override package ids without requiring aapt to recompile the APK.
Note: XML references will still use the original id compiled with AAPT, so it is only useful for resources
which do not use xml drawables (such as icon packs).

PackageInfo now has a new member identify "legacy" (3rd party icon packs) written
for launcher's like Trebuchet, Nova, and Apex.

Change-Id: Icd12c097e156c9626df0772abeb50e00f7b61f64
CM11 Themes: Don't set sys.refresh_theme on icon update

Change-Id: I5ed49ad2aa93974c54434e092946c4be7699131d
Send broadcast when package is 'about' to be removed

If a theme package is removed and it is the currently applied
theme, some apps will crash because the theme resources are
no longer available, since they were cleaned up by the package
manager.  The themes provider will receive this broadcast and
take care of switching back to the default theme for components
that are using the package about to be removed.

Change-Id: I968c25e19eb17ec87e7ddcba5ac0fd81745cef20
CM11 Themes: Properly handle themeing apps on install

Previously when an app was installed or re-installed it would not
pick up the currently applied theme.

mOverlays was not being properly updated and therefore newly
installed or re-installed apps would not pick up the currently
applied theme.

Change-Id: I7ce5454af11fb44e9a73b30858d893050b2fba8a
CM11 Themes: Handle legacy themes in createIdmapsForPackageLI

Change-Id: Iff42bac7bf84b9c739831775c8deef86adbdc0ca
CM11 Themes: Allow defining a custom default theme [1/3]

Conflicts:

	core/java/android/content/pm/ThemeUtils.java
	core/java/android/provider/Settings.java
	packages/SettingsProvider/res/values/defaults.xml
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
	services/java/com/android/server/ThemeService.java

Change-Id: I6b794d6c9c27b2d6436bdf4fec51c84a7859c134
Cleanup themes that fail to install

Themes which fail to install due to aapt or idmap errors
would not be properly cleaned up. This caused subsequent installs
to give a INSTALL_FAILED_UID_CHANGED (-24) error.

This patch also adds install error codes specifically for themes.

Change-Id: Ie03b92ca0a7dec8c4a5e3725b717943d36abb349
Automatic translation import

Conflicts:

	core/res/res/values-nb/cm_strings.xml
	core/res/res/values-sr/cm_strings.xml
	core/res/res/values-sv/cm_caf.xml
	core/res/res/values-tr/cm_strings.xml
	core/res/res/values-zh-rHK/cm_strings.xml
	packages/SystemUI/res/values-sr/cm_strings.xml
	packages/SystemUI/res/values-zh-rHK/cm_strings.xml
	packages/WallpaperCropper/res/values-sv/strings.xml

Change-Id: I54e519bd787f76b94605bfe3057ba508d06c2069
CM11 Themes: Reduce "unable to load asset" log spam

With the introduction of a "common" resource folder for themes,
we always try to attach the common resource table and if it does
not exist it won't be attached but we would see this log spam.

Change-Id: Ida4e815523fd71b34fe8f3b41cef3432e6e07b64
CM11 Themes: Get proper package name in attachThemeAssets

Change-Id: Ic77ff41519b22e3b20c4571785a1368cdf4d14d2
Themes: Fix -110 install error [2/2]

aapt was being called from PM with a ' ' at the end of the cmd. This would
cause installd to read unexpected parts of memory which sometimes
causes it to parse the command incorrectly.

Change-Id: I85bf93045370478fd9baaf5db784c0cc3a4a03b9
Avoid app install failures from malformed themes

When an app is installed we create idmaps between it and all the themes
that theme the app. If the theme is really badly written it could
potentially fail idmap generation, but we should not block the app
itself from being installed just because a bad theme is on the device.

Change-Id: I0e38fd373dfd294aac17fab1cf07ba49934a8859
CM11 Themes: Expose applyDefaultTheme to public service

Change-Id: I952870fb984d51d554e560566a8cadbe2c49cc6b