summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-03-15 16:07:53 -0700
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:21:05 -0700
commit145e3fa26c6944b5bd29bc0405af4e5dda4b0a97 (patch)
tree5a4b1b3876cdc1ecd306a1cdd90e1199355e58f9
parente9d903cfbedfd971050e4a71059236c0264aa7e2 (diff)
downloadandroid_packages_apps_Trebuchet-145e3fa26c6944b5bd29bc0405af4e5dda4b0a97.zip
android_packages_apps_Trebuchet-145e3fa26c6944b5bd29bc0405af4e5dda4b0a97.tar.gz
android_packages_apps_Trebuchet-145e3fa26c6944b5bd29bc0405af4e5dda4b0a97.tar.bz2
Trebuchet: Fix some issues with the DB upgrade path
Issue-id: CYNGNOS-2249 Change-Id: If124a9ac51c665c869cf5a745390374658b87156
-rw-r--r--src/com/android/launcher3/LauncherProvider.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 061ac1a..91376a7 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -745,7 +745,8 @@ public class LauncherProvider extends ContentProvider {
if (!recreateWorkspaceTable(db)) {
break;
}
- case 22: {
+ case 22:
+ case 23:
if (!addIntegerColumn(db, Favorites.OPTIONS, 0)) {
// Old version remains, which means we wipe old data
break;
@@ -754,9 +755,6 @@ public class LauncherProvider extends ContentProvider {
// Old version remains, which means we wipe old data
break;
}
- }
- case 23:
- // No-op
case 24:
ManagedProfileHeuristic.markExistingUsersForNoFolderCreation(mContext);
case 25:
@@ -769,6 +767,12 @@ public class LauncherProvider extends ContentProvider {
case 27: {
// DB Upgraded successfully
updateDialtactsLauncher(db);
+ }
+ case 28: {
+ if (!ensureSubTypeColumn(db)) {
+ // Old version remains, which means we wipe old data
+ break;
+ }
return;
}
}
@@ -963,6 +967,22 @@ public class LauncherProvider extends ContentProvider {
return true;
}
+ @Thunk boolean ensureSubTypeColumn(SQLiteDatabase db) {
+ Cursor c = null;
+ try {
+ // Make sure subType exists
+ c = db.rawQuery("SELECT subType FROM favorites;", null);
+ } catch (SQLException ex) {
+ Log.e(TAG, ex.getMessage(), ex);
+ return addIntegerColumn(db, "subType", 0);
+ } finally {
+ if (c != null) {
+ c.close();
+ }
+ }
+ return true;
+ }
+
private boolean addProfileColumn(SQLiteDatabase db) {
UserManagerCompat userManager = UserManagerCompat.getInstance(mContext);
// Default to the serial number of this user, for older