summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard MacGregor <macgrr@gmail.com>2015-05-19 07:29:54 (GMT)
committerRichard MacGregor <rmacgregor@cyngn.com>2015-05-19 16:20:17 (GMT)
commita8594f9008f4bcfa7e78efd301f65b748213b307 (patch)
treea94958b2f433be3da1704ffc67f7415c9833ffac /src
parentd2d2ffd0c08c748f1c4cb99c97d6e5ec7fc2beed (diff)
downloadandroid_packages_providers_ThemesProvider-a8594f9008f4bcfa7e78efd301f65b748213b307.zip
android_packages_providers_ThemesProvider-a8594f9008f4bcfa7e78efd301f65b748213b307.tar.gz
android_packages_providers_ThemesProvider-a8594f9008f4bcfa7e78efd301f65b748213b307.tar.bz2
FIX: Preview table upgrade path
Previews table was modified without modifying upgrade path. This fixes themes database issue for those who updated CM between 5.16.2015 and 5.19.2015 Depends on: http://review.cyanogenmod.org/#/c/98708/ http://review.cyanogenmod.org/#/c/98709/ Change-Id: Iab743fec9a03b37b356504f4b905deb3b801fac5
Diffstat (limited to 'src')
-rw-r--r--src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
index 6353d15..9bc3459 100644
--- a/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
+++ b/src/org/cyanogenmod/themes/provider/ThemesOpenHelper.java
@@ -36,7 +36,7 @@ import android.util.Log;
public class ThemesOpenHelper extends SQLiteOpenHelper {
private static final String TAG = ThemesOpenHelper.class.getName();
- private static final int DATABASE_VERSION = 15;
+ private static final int DATABASE_VERSION = 16;
private static final String DATABASE_NAME = "themes.db";
private static final String SYSTEM_THEME_PKG_NAME = ThemeConfig.SYSTEM_DEFAULT;
private static final String OLD_SYSTEM_THEME_PKG_NAME = "holo";
@@ -115,9 +115,10 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
upgradeToVersion14(db);
oldVersion = 14;
}
- if (oldVersion == 14) {
- upgradeToVersion15(db);
- oldVersion = 15;
+ if (oldVersion == 14 || oldVersion == 15) {
+ // Versions 15 and 16 share same upgrade path, no need to run twice.
+ upgradeToVersion16(db);
+ oldVersion = 16;
}
if (oldVersion != DATABASE_VERSION) {
Log.e(TAG, "Recreating db because unknown database version: " + oldVersion);
@@ -407,7 +408,8 @@ public class ThemesOpenHelper extends SQLiteOpenHelper {
db.execSQL(sql);
}
- private void upgradeToVersion15(SQLiteDatabase db) {
+ // upgradeToVersion16 is the same upgrade path for both 14->15 and 15->16
+ private void upgradeToVersion16(SQLiteDatabase db) {
// Previews table upgraded
db.execSQL("DROP TABLE IF EXISTS " + PreviewsTable.TABLE_NAME);
db.execSQL(PreviewsTable.PREVIEWS_TABLE_CREATE);