summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClark Scheff <clark@cyngn.com>2014-05-19 15:33:43 -0700
committerClark Scheff <clark@cyngn.com>2014-05-19 15:33:43 -0700
commit6d17ea67d7f040941706c3afd71149f05c3b1342 (patch)
tree15b5b8fdcae0d4f52cb7baaf266ec8bcdf7e3d4d /src
parent8ff5a8cd6aa1fe64a1f3ee63cade6ed8d8acc439 (diff)
downloadandroid_packages_providers_ThemesProvider-6d17ea67d7f040941706c3afd71149f05c3b1342.zip
android_packages_providers_ThemesProvider-6d17ea67d7f040941706c3afd71149f05c3b1342.tar.gz
android_packages_providers_ThemesProvider-6d17ea67d7f040941706c3afd71149f05c3b1342.tar.bz2
Properly handle updating holo theme.
Change-Id: I157e597ee53894b1237c05dd2000b1da957b1968
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
index 0ecdcaf..ed1a740 100644
--- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
@@ -39,6 +39,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import static android.content.res.CustomTheme.HOLO_DEFAULT;
+
/**
* Helper class to populate the provider with info from the theme.
*/
@@ -155,14 +157,18 @@ public class ThemePackageHelper {
}
public static void updatePackage(Context context, String pkgName) throws NameNotFoundException {
- PackageInfo pi = context.getPackageManager().getPackageInfo(pkgName, 0);
- Map<String, Boolean> capabilities = getCapabilities(context, pkgName);
- if (pi.themeInfos != null && pi.themeInfos.length > 0) {
- updatePackageInternal(context, pi, capabilities);
- } else if (pi.legacyThemeInfos != null && pi.legacyThemeInfos.length > 0) {
- updateLegacyPackageInternal(context, pi, capabilities);
- } else if (pi.isLegacyIconPackApk) {
- updateLegacyIconPackInternal(context, pi, capabilities);
+ if (HOLO_DEFAULT.equals(pkgName)) {
+ updateHoloPackageInternal(context);
+ } else {
+ PackageInfo pi = context.getPackageManager().getPackageInfo(pkgName, 0);
+ Map<String, Boolean> capabilities = getCapabilities(context, pkgName);
+ if (pi.themeInfos != null && pi.themeInfos.length > 0) {
+ updatePackageInternal(context, pi, capabilities);
+ } else if (pi.legacyThemeInfos != null && pi.legacyThemeInfos.length > 0) {
+ updateLegacyPackageInternal(context, pi, capabilities);
+ } else if (pi.isLegacyIconPackApk) {
+ updateLegacyIconPackInternal(context, pi, capabilities);
+ }
}
}
@@ -186,6 +192,15 @@ public class ThemePackageHelper {
context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args);
}
+ private static void updateHoloPackageInternal(Context context) {
+ ContentValues values = new ContentValues();
+ values.put(ThemesColumns.IS_DEFAULT_THEME,
+ HOLO_DEFAULT == ThemeUtils.getDefaultThemePackageName(context) ? 1 : 0);
+ String where = ThemesColumns.PKG_NAME + "=?";
+ String[] args = { HOLO_DEFAULT };
+ context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args);
+ }
+
private static void updateLegacyPackageInternal(Context context, PackageInfo pi,
Map<String, Boolean> capabilities) {
LegacyThemeInfo info = pi.legacyThemeInfos[0];