summaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/themes/provider/PreviewGenerationService.java
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-03-11 15:05:32 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-03-12 16:01:16 +0000
commit6c29892fc83a43a7f363f56950ac6e7a8423ac91 (patch)
treefa822f579149c92f7562969f728eb0d7ed401622 /src/org/cyanogenmod/themes/provider/PreviewGenerationService.java
parentcc0e0e1f3d19109cfe2a6ff2e2b616d5b97e90f6 (diff)
downloadandroid_packages_providers_ThemesProvider-staging/cm-12.1.tar.gz
android_packages_providers_ThemesProvider-staging/cm-12.1.tar.bz2
android_packages_providers_ThemesProvider-staging/cm-12.1.zip
Themes: Process theme resources after package scanned [2/2]staging/cm-12.1
The provider now assumes that the theme service will process all themes and icons packs, and then sends the appropriate broadcast once processing is done for that package. The preview generator now queries for the theme 's capabilities rather than rely on that info to be passed in. This is partly due to the new flow of installing a theme as well as the fact that legacy icon packs were not having previews generated. Change-Id: I418debb6f91296107476016367131fac2c3a32ce
Diffstat (limited to 'src/org/cyanogenmod/themes/provider/PreviewGenerationService.java')
-rw-r--r--src/org/cyanogenmod/themes/provider/PreviewGenerationService.java36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/org/cyanogenmod/themes/provider/PreviewGenerationService.java b/src/org/cyanogenmod/themes/provider/PreviewGenerationService.java
index 0db60f6..ed86994 100644
--- a/src/org/cyanogenmod/themes/provider/PreviewGenerationService.java
+++ b/src/org/cyanogenmod/themes/provider/PreviewGenerationService.java
@@ -18,6 +18,7 @@ package org.cyanogenmod.themes.provider;
import android.app.IntentService;
import android.content.ContentResolver;
import android.content.ContentValues;
+import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -48,11 +49,6 @@ public class PreviewGenerationService extends IntentService {
public static final String ACTION_INSERT = "org.cyanogenmod.themes.provider.action.insert";
public static final String ACTION_UPDATE = "org.cyanogenmod.themes.provider.action.update";
public static final String EXTRA_PKG_NAME = "extra_pkg_name";
- public static final String EXTRA_HAS_SYSTEMUI = "extra_has_system_ui";
- public static final String EXTRA_HAS_ICONS = "extra_has_icons";
- public static final String EXTRA_HAS_WALLPAPER = "extra_has_wallpaper";
- public static final String EXTRA_HAS_STYLES = "extra_has_styles";
- public static final String EXTRA_HAS_BOOTANIMATION = "extra_has_bootanimation";
private static final String TAG = PreviewGenerationService.class.getName();
@@ -69,12 +65,25 @@ public class PreviewGenerationService extends IntentService {
final Bundle extras = intent.getExtras();
String pkgName = extras.getString(EXTRA_PKG_NAME);
- boolean hasSystemUi = extras.getBoolean(EXTRA_HAS_SYSTEMUI, false);
- boolean hasIcons = extras.getBoolean(EXTRA_HAS_ICONS, false);
- boolean hasWallpaper = extras.getBoolean(EXTRA_HAS_WALLPAPER, false);
- boolean hasStyles = extras.getBoolean(EXTRA_HAS_STYLES, false);
- boolean hasBootanimation = extras.getBoolean(EXTRA_HAS_BOOTANIMATION, false);
+ boolean hasSystemUi = false;
+ boolean hasIcons = false;
+ boolean hasWallpaper = false;
+ boolean hasStyles = false;
+ boolean hasBootanimation = false;
boolean isSystemTheme = ThemeConfig.SYSTEM_DEFAULT.equals(pkgName);
+ Cursor c = queryTheme(this, pkgName);
+ if (c != null) {
+ if (c.moveToFirst()) {
+ hasSystemUi = c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_STATUS_BAR)) == 1;
+ hasIcons = c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_ICONS)) == 1;
+ hasWallpaper = c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_LAUNCHER)) == 1 ||
+ c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_LOCKSCREEN)) == 1;
+ hasStyles = c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_OVERLAYS)) == 1;
+ hasBootanimation =
+ c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_BOOT_ANIM)) == 1;
+ }
+ c.close();
+ }
final String action = intent.getAction();
if (ACTION_INSERT.equals(action) || ACTION_UPDATE.equals(action)) {
PackageInfo info = null;
@@ -228,4 +237,11 @@ public class PreviewGenerationService extends IntentService {
bmp.compress(format, quality, out);
return out.toByteArray();
}
+
+ private static Cursor queryTheme(Context context, String pkgName) {
+ String selection = ThemesColumns.PKG_NAME + "=?";
+ String[] selectionArgs = { pkgName };
+ return context.getContentResolver().query(ThemesColumns.CONTENT_URI, null,
+ selection, selectionArgs, null);
+ }
}