summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClark Scheff <clark@cyngn.com>2014-06-19 14:37:48 -0700
committerClark Scheff <clark@cyngn.com>2014-06-19 14:38:52 -0700
commitc69e2172796a547f32d49d2b84bacf444a30256b (patch)
treed0e8485500effac84e15767afb6aed789f627d4b /src
parentc85c5ae51e240c71c43a1335b919b15bd696844a (diff)
downloadandroid_packages_providers_ThemesProvider-c69e2172796a547f32d49d2b84bacf444a30256b.zip
android_packages_providers_ThemesProvider-c69e2172796a547f32d49d2b84bacf444a30256b.tar.gz
android_packages_providers_ThemesProvider-c69e2172796a547f32d49d2b84bacf444a30256b.tar.bz2
Make sure to update theme capabilities.
Change-Id: I42970fd98e629bde8f32d698b67892ba7b8e6965
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
index aabab9d..1df0442 100644
--- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
@@ -98,11 +98,7 @@ public class ThemePackageHelper {
values.put(ThemesColumns.LAST_UPDATE_TIME, pi.lastUpdateTime);
// Insert theme capabilities
- for (Map.Entry<String, Boolean> entry : capabilities.entrySet()) {
- String component = entry.getKey();
- Boolean isImplemented = entry.getValue();
- values.put(component, isImplemented);
- }
+ insertCapabilities(capabilities, values);
context.getContentResolver().insert(ThemesColumns.CONTENT_URI, values);
}
@@ -122,12 +118,7 @@ public class ThemePackageHelper {
values.put(ThemesColumns.LAST_UPDATE_TIME, pi.lastUpdateTime);
// Insert theme capabilities
- for (Map.Entry<String, Boolean> entry : capabilities.entrySet()) {
- String component = entry.getKey();
- Boolean isImplemented = ThemesColumns.MODIFIES_OVERLAYS.equals(component) ? Boolean.TRUE
- : entry.getValue();
- values.put(component, isImplemented);
- }
+ insertCapabilities(capabilities, values);
context.getContentResolver().insert(ThemesColumns.CONTENT_URI, values);
}
@@ -147,11 +138,7 @@ public class ThemePackageHelper {
values.put(ThemesColumns.IS_LEGACY_ICONPACK, 1);
// Insert theme capabilities
- for (Map.Entry<String, Boolean> entry : capabilities.entrySet()) {
- String component = entry.getKey();
- Boolean isImplemented = entry.getValue();
- values.put(component, isImplemented);
- }
+ insertCapabilities(capabilities, values);
context.getContentResolver().insert(ThemesColumns.CONTENT_URI, values);
}
@@ -215,6 +202,9 @@ public class ThemePackageHelper {
ThemeUtils.getDefaultThemePackageName(context).equals(pi.packageName) ? 1 : 0);
values.put(ThemesColumns.LAST_UPDATE_TIME, pi.lastUpdateTime);
+ // Insert theme capabilities
+ insertCapabilities(capabilities, values);
+
String where = ThemesColumns.PKG_NAME + "=?";
String[] args = { pi.packageName };
context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args);
@@ -233,6 +223,9 @@ public class ThemePackageHelper {
values.put(ThemesColumns.DATE_CREATED, System.currentTimeMillis());
values.put(ThemesColumns.LAST_UPDATE_TIME, pi.lastUpdateTime);
+ // Insert theme capabilities
+ insertCapabilities(capabilities, values);
+
String where = ThemesColumns.PKG_NAME + "=?";
String[] args = { pi.packageName };
context.getContentResolver().update(ThemesColumns.CONTENT_URI, values, where, args);
@@ -300,6 +293,15 @@ public class ThemePackageHelper {
return implementMap;
}
+ private static void insertCapabilities(Map<String, Boolean> capabilities,
+ ContentValues values) {
+ for (Map.Entry<String, Boolean> entry : capabilities.entrySet()) {
+ String component = entry.getKey();
+ Boolean isImplemented = entry.getValue();
+ values.put(component, isImplemented);
+ }
+ }
+
private static boolean hasThemeComponentLegacy(PackageInfo pi, String component) {
if (ThemesColumns.MODIFIES_OVERLAYS.equals(component)) {
return true;