Fix resource leaks

Change-Id: I3a201cfd924e467d605351782bd06874c2af725e
Cleanup app->{theme1,theme2...} mapping on uninstall

Change-Id: I24b43e8817db1927d5b43fcf7ad3340269d046ea
Themes: Add '|' delimited list of components to broadcast

Change-Id: I742dcb0f502b6089dee584a92a3792016f2a9799
Themes: Handle apps using "original-package" tag

Before this patch the themes code assumed the pkgName from PackageInfo was equal to the
manifest value. This is not the case however for upgraded system apps that have gone
through a pkg-name change. For example, Trebuchet was "com.android.launcher3" and now
it is "com.cyanogenmod.trebuchet". If the device had wiped data then PM would use the new
pkg-name, but if the system apps were being upgraded then PM would use the old name which is
now different from the manifest name.

Change-Id: Ie7eb1b4e17899d1055535dc890d4f7a7bca9a98a
Make theme change broadcast a protected broadcast.

Change-Id: Ic24c840685d18d133dc73ff2637c041c4775f197
Themes: remove unused code

Change-Id: I5ee8de962c40ddc5fcfbbc0332a9e389223e716c
Themes: Delete icon resources during uninstall

Change-Id: Icf247642f9d246c8826f3394f873e4b434ad2b3f
WallpaperCropper: do not display null bitmaps

It is possible that themes can include a corrupted bitmap,
and the lockscreen will try and display a NULL image resulting in an
empty thumbnail and applying it will cause the app to crash.

Change-Id: Ie0770486a9d58050a5f296a219d844a39937421e
Signed-off-by: Roman Birg <roman@cyngn.com>
Themes: Update last postFinish call

* Previous patchset changed postFinish function signature.

Change-Id: Ibe07435e274054c7203504bc4b0877b4df006893
Themes: uninstallThemeForAllApps shouldn't check if map is empty if it's null

Potential NPE introduced in ec2200878706735cdd2caf4d934d988296998e85

Change-Id: I6d1ec165957c2be63086a18af2236e46978e9c8a
Don't cleanup overlay mapping for non-theme apps

mOverlay structure should keep all app/theme mappings even
if the app does not exist. Otherwise we will have to insert back the mapping
for every app that is installed which would be time consuming.

Without this patch an upgrade app loses its applied theme
until the device is rebooted.

Change-Id: Id02b8e0a3bdd78d1a9d39cd38294c584ef95f8db
Themes: Keyguard: Fix NPE setting lockscreen wallpaper

After boot the view might not be laid out and so getWidth() and
getHeight() return 0 and will cause a NullPointerException in
createBitmap().

Bug AOSPA-448

Change-Id: Ibacf4199a69709dc34d21695732c2a5360533a23
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>

Conflicts:
	packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java

 Author:    Dirk Rettschlag <dirk.rettschlag@gmail.com>
Themes: Avoid compiling icon packs every boot

Change-Id: I51c7effdd4592a302f457822a05cbebee6cde06b
Themes: synchronize updateStringCache on mAccessLock

Resources.java used to synchronize on mTmpValue but has since
switched to mAccessLock. mTmpValue can be null in some instances
causing a NPE during a theme change.

Change-Id: I7411dfdf6e8e411381ae993872a3c740dad19300
Themes: sync status bar transparency state on theme change

When the status bar view is reinflated its transparency mode is
reset back to opaque. This can be observed by changing a theme
and switching to home in the middle of a switch.

Change-Id: I3049c5f24cc6c46dcefb24188039a08503db09a9

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

 Author:    Andy Mast <andy@cyngn.com>
Themes: Theme special volumeup+down volume panel

When you press vol up + vol down button it brings up a
different volume panel which was not getting themed because
it lacked the ui context.

Change-Id: I416b8920160c0ab263fd426a6e6491d1f877a905

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Themes: Check CRC of APK MANIFEST.MF at install

Change-Id: I6ccfcd2b04107b85fe14cb678aad63443284353a
CM11 Themes: Add support for composed icons [1/2]

If an icon pack includes background, mask, and/or foreground
images and an icon is not included for a given app, an icon
will be generated using the background, mask and foreground.

Icon packs can include the following items into their
appfilter.xml
    <!-- Set deafult scale factor for the icons -->
    <scale factor="1.0" />

    <!-- Set back image for composed icons -->
    <iconback img="iconback" />

    <!-- Set the mask image for composed icons
         Original icon will be masked off using this mask -->
    <iconmask img="iconmask" />

    <!-- Set foreground image for composed icons -->
    <iconupon img="iconupon" />

Note: Mutliple iconback images can be used as follows
    <iconback img1="iconback1" img2="iconback2" img3="iconback3" />

Change-Id: I0f5fd7de4f0eae485139cbcd282c1d1e1663952f
Themes: Don't set icons for iconpack that is applied.

Change-Id: I3cffade2c12ae1dbc1f75e43f1a74609ff0d7135
Themes: Don't kill launchers that handle the theme change

Change-Id: I5e3a7ea2455a4c407928bb5c90b7fc4e5906aa73