summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClark Scheff <clark@cyngn.com>2015-01-28 12:39:21 -0800
committerClark Scheff <clark@cyngn.com>2015-01-28 12:39:21 -0800
commit3e827929241d3339b77ed5f523f32dbd28d8b2a3 (patch)
tree866d2aee883afc6a13ed9562536c884056696e0b /src
parentd9cb7a2235034aba5eeb76eb89238d0379239dcc (diff)
downloadandroid_packages_providers_ThemesProvider-3e827929241d3339b77ed5f523f32dbd28d8b2a3.zip
android_packages_providers_ThemesProvider-3e827929241d3339b77ed5f523f32dbd28d8b2a3.tar.gz
android_packages_providers_ThemesProvider-3e827929241d3339b77ed5f523f32dbd28d8b2a3.tar.bz2
Relax constraint of what is considered a presentable theme
Themes that have at least overlays and a wallpaper will be marked as a presentable theme. If these two items are not in the theme then only their components will be available in their respective category. Change-Id: Ia67abafd2206029a20b8aa651e7379f34104a323
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemePackageHelper.java1
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java26
2 files changed, 25 insertions, 2 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
index 8d9a933..6be5570 100644
--- a/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemePackageHelper.java
@@ -289,7 +289,6 @@ public class ThemePackageHelper {
public static boolean isPresentableTheme(Map<String, Boolean> implementMap) {
return implementMap != null &&
hasThemeComponent(implementMap, ThemesColumns.MODIFIES_LAUNCHER) &&
- hasThemeComponent(implementMap, ThemesColumns.MODIFIES_ICONS) &&
hasThemeComponent(implementMap, ThemesColumns.MODIFIES_OVERLAYS);
}
diff --git a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
index 33a8336..6183399 100644
--- a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
@@ -35,7 +35,7 @@ import android.util.Log;
public class ThemesOpenHelper extends SQLiteOpenHelper {
private static final String TAG = ThemesOpenHelper.class.getName();
- private static final int DATABASE_VERSION = 11;
+ private static final int DATABASE_VERSION = 12;
private static final String DATABASE_NAME = "themes.db";
private static final String DEFAULT_PKG_NAME = ThemeConfig.SYSTEM_DEFAULT;
@@ -101,6 +101,10 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
upgradeToVersion11(db);
oldVersion = 11;
}
+ if (oldVersion == 11) {
+ upgradeToVersion12(db);
+ oldVersion = 12;
+ }
if (oldVersion != DATABASE_VERSION) {
Log.e(TAG, "Recreating db because unknown database version: " + oldVersion);
dropTables(db);
@@ -355,6 +359,26 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
}
+ private void upgradeToVersion12(SQLiteDatabase db) {
+ // This upgrade performs an update to the ThemesColumns.PRESENT_AS_THEME since the
+ // requirements for what is a presentable theme have changed.
+ final String[] projection = { ThemesColumns.PKG_NAME, ThemesColumns.MODIFIES_LAUNCHER,
+ ThemesColumns.MODIFIES_OVERLAYS};
+ final Cursor c = db.query(ThemesTable.TABLE_NAME, projection, null, null, null, null, null);
+ if (c != null) {
+ while(c.moveToNext()) {
+ final String pkgName = c.getString(0);
+ boolean presentAsTheme =
+ c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_LAUNCHER)) == 1 &&
+ c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_OVERLAYS)) == 1;
+ db.execSQL(String.format("UPDATE %s SET %s='%d' WHERE %s='%s'",
+ ThemesTable.TABLE_NAME, ThemesColumns.PRESENT_AS_THEME,
+ presentAsTheme ? 1 : 0, ThemesColumns.PKG_NAME, pkgName));
+ }
+ c.close();
+ }
+ }
+
private void dropTables(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + ThemesTable.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + MixnMatchTable.TABLE_NAME);