Return system theme when SecurityException is caught.

Isolated processes cannot access content resolvers so a SecurityException
will be thrown when calling getBootTheme.  This catches that
exception and returns sSystemTheme.

Change-Id: If4077adef4c657b80ba2c52a6610126dabe4ffdf
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Ensure customTheme is not null.

The configuration retrieved via getConfiguration() sometimes contains
a null customTheme which results in the theme returning to holo when
applying a component such as icons.  Icons will change but styles
and fonts would return to the default.

Change-Id: Iac0cb8eed5de8fdc9fe8efd697d968f26e801c08
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Common overlay for sharing resources. [1/2]

This patch will allow themes to contain common resources
which can be shared by all overlays.

Common resources will reside in assets/overlays/common and
can be referenced by other overlays.

Common resources will be referenced using the common package
name, i.e. To reference the common drawable some_drawable for
com.example.theme the theme designer would use
"@*common:drawable/some_drawable"

Change-Id: I395b6bd5eae91b00265a8e9221856ef7bf5d115a
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Include alarms in mixnmatch.

Change-Id: I004f6b0149d71c8ed1a3952704f5a3521eca5add
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Properly handle SystemUI theme package name.

Change-Id: Ia8915684e1620184dcc513c2c5039ea20aabbd04
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
rename the custom lockscreen state action

Change-Id: I4ffadda9392e8ca8765e5b8ca47994e3a9990792
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

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

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Add wallpaper pickers to seperate package [1/2]

Currently wallpaper pickers were part of the various launchers
and we were relying on Trebuchet's to add code for including
wallpapers from themes.  If Trebuchet is removed then this
functionality is lost.  This package is already included in all
builds so making the picker available here removes the dependency
on a specific launcher.

Trebuchet still contains a picker which should probably be removed
and make use of this package instead.

Change-Id: Ie42ae0e01f951a8293d13d6c8a73fde0dea6682b
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	packages/WallpaperCropper/AndroidManifest.xml
	packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
wallpaperpicker

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
base: Add theme support to Ringtone

Patchset 3: Add support for theme RingtonePreference view. The dialog is
            automatically adjusted to the caller activity base theme.
Patchset 4: Don't break the android api

For Ringtones:

http://review.cyanogenmod.org/#/c/61393/

For Profiles:

Usage:

Intent intent = new Intent(ProfileManager.ACTION_PROFILE_PICKER);
intent.putExtra(ProfileManager.EXTRA_PROFILE_DIALOG_THEME, R.style.CustomDialogTheme); <<< Add your custom dialog theme here
startActivityForResult(intent, 0);

Style Usage:

Define an style that inherits from an android base theme

<style name="CustomDialogThemeDark" parent="@*android:style/Theme.Holo.Dialog.Alert">

or

<style name="CustomDialogThemeLight" parent="@*android:style/Theme.Holo.Light.Dialog.Alert">

or define your own dialog style

Change-Id: Icadbcf2c617c51177466989acdab9435066a47a0
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	core/java/android/app/ProfileManager.java
	packages/SettingsProvider/src/com/android/providers/settings/ProfilePickerActivity.java

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
WallpaperPicker: Destroy cropview to avoid leaks

If the cropview's TiledImageRenderer is rendering threads, the activity
context gets leaked. Avoid that by invoking its destroy in onDestroy() of activity.

Change-Id: I0804c903d14d3f3d13529f0fe90d12784d97e93f
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Don't set sys.refresh_theme on icon update

Change-Id: I5ed49ad2aa93974c54434e092946c4be7699131d
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Handle legacy themes in createIdmapsForPackageLI

Change-Id: Iff42bac7bf84b9c739831775c8deef86adbdc0ca
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
CM11 Themes: Allow defining a custom default theme [1/3]

Change-Id: I6b794d6c9c27b2d6436bdf4fec51c84a7859c134
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	core/java/android/provider/Settings.java
	packages/SettingsProvider/res/values/defaults.xml
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

Conflicts:
	packages/SettingsProvider/res/values/defaults.xml
	packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	packages/SettingsProvider/res/values/defaults.xml
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
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>