Fix NPE if themeContext is null

When installing a new theme it sometimes happens that the
ThemesProvider crashes due to a NullPointerException in
hasThemeComponent(...) when executing
AssetManager assetManager = themeContext.getAssets();

Don't silently catch the NameNotFoundException and return an
empty map.

Change-Id: I9d7bf8f79b9c38cd5da668a7fcf205406ffdd79c
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
(cherry picked from commit dda7d285c2b77770d09ad2abaf4fa09f909d4636)
Fix NPE if themeContext is null - round 2

If a theme is uninstalled and timing is perfect, it can happen
that the CopyImageService is trying to get the PackageContext
of a not existing package.

Return from the function if a NameNotFoundException is catched.

Change-Id: I8f4e33d527f78228f9681ac518292364e9269a0c
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
CM11 Themes: Allow defining a custom default theme [2/3]

Change-Id: I94521a09339fb760b7a56b9a3ba3d2c56e2d3ac5
Properly handle updating holo theme.

Change-Id: I157e597ee53894b1237c05dd2000b1da957b1968
Merge remote-tracking branch 'github/cm-11.0' into HEAD
Automatic translation import 

Change-Id: Idc73415b665b719cba153929000cc960993241d9
Standardize preview images.

Themes can contain a preview image for wallpaper, lockscreen, and
styles.  These can be either .png or .jpg and use the following
naming conventions:
  wallpaper  -> assets/images/wallpaper_preview.[png|jpg]
  lockscreen -> assets/images/lockscreen_preview.[png|jpg]
  styles     -> assets/images/styles_preview.[png|jpg]

Change-Id: Ibe441abf941e8b995c94eb43f6c6f237758d914b
Merge remote-tracking branch 'github/cm-11.0' into HEAD
Themes: Add read/write permissions [2/2]

Change-Id: Ie41b1605b5773d651b8ef8f3162791fef5c78cfc
Automatic translation import

Change-Id: I4afb8ee9e6ac3f3f11ff95427bb789f2ee7018c8
Merge "Fix NPE if themeContext is null - round 2" into cm-11.0
Merge "Themes: Add read/write permissions [2/2]" into cm-11.0
Cleanup cached preview images on uninstall

Change-Id: I9267a160fbabeb67ade2f18fdaf8d8c6acc539da
When applied theme is removed, revert to default

Fixes issue where fonts and other resources do not get reverted
properly when an applied theme is uninstalled.

Change-Id: I30c9ea018f8bffc6aff51c5b38ff1e4ec82b7b20
Insert instead of update if theme doesn't exist

This handles the case where an app is being upgraded and previously was
not a theme. and therefore wasn't in the provider.

Change-Id: I7b3f64aed2b78081822cb0f9daf0cbd638e0b15b
Merge "Insert instead of update if theme doesn't exist" into cm-11.0
ThemesProvider: Fix query compilation error

This fixes syntax error when excute the SELECT Clause

06-11 13:45:39.370: E/AndroidRuntime(3359): java.lang.RuntimeException: Unable to start
receiver org.cyanogenmod.themes.provider.AppReceiver: android.database.sqlite.SQLiteException:
near "?": syntax error (code 1): , while compiling: SELECT pkg_name FROM themes WHERE (pkg_name?)

Change-Id: If9857b1db447e8752ddf04ce3f7d2cc84d5b28a5
Automatic translation import

Change-Id: I3d8ee2920861a04e551bc632f2aff48b0733fe7b