summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/LauncherProvider.java')
-rw-r--r--src/com/android/launcher3/LauncherProvider.java58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 8da3a2482..ecc1cdf75 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -853,7 +853,6 @@ public class LauncherProvider extends ContentProvider {
}
}
-
if (version < 16) {
db.beginTransaction();
try {
@@ -869,6 +868,63 @@ public class LauncherProvider extends ContentProvider {
db.endTransaction();
}
}
+ // This was the old L2-based Trebuchet's version. Do steps that come after version 12
+ // (Launcher2's original version) so the new things get added, but skip the intermediate
+ // workspaceScreens updates (addWorkspacesTable() takes care of that)
+
+ if (version == 16) {
+ Log.w(TAG, "Found pre-11 Trebuchet, preparing update");
+
+ // With the new shrink-wrapped and re-orderable workspaces, it makes sense
+ // to persist workspace screens and their relative order.
+ mMaxScreenId = 0;
+
+ // This will never happen in the wild, but when we switch to using workspace
+ // screen ids, redo the import from old launcher.
+ sJustLoadedFromOldDb = true;
+
+ addWorkspacesTable(db);
+
+ Cursor c = null;
+ long screenId = -1;
+ try {
+ c = db.rawQuery("SELECT max(screen) FROM favorites", null);
+ if (c != null && c.moveToNext()) {
+ screenId = c.getLong(0);
+ }
+ if (c != null) {
+ c.close();
+ }
+ } catch (SQLException ex) {
+ Log.e(TAG, ex.getMessage(), ex);
+ }
+
+
+ db.beginTransaction();
+ try {
+ // Insert new column for holding widget provider name
+ db.execSQL("ALTER TABLE favorites " +
+ "ADD COLUMN appWidgetProvider TEXT;");
+ db.execSQL("ALTER TABLE favorites " +
+ "ADD COLUMN modified INTEGER NOT NULL DEFAULT 0;");
+ // Create workspaces for the migrated things
+ if (screenId > 0) {
+ for (int sId = 0; sId <= screenId; sId++) {
+ db.execSQL("INSERT INTO workspaceScreens (_id, screenRank) " +
+ "VALUES (" + (sId+1) + ", " + sId + ")");
+ }
+ }
+ // Adjust hotseat format
+ db.execSQL("UPDATE favorites SET screen=cellX WHERE container=-101;");
+ db.setTransactionSuccessful();
+ version = 17;
+ } catch (SQLException ex) {
+ // Old version remains, which means we wipe old data
+ Log.e(TAG, ex.getMessage(), ex);
+ } finally {
+ db.endTransaction();
+ }
+ }
if (version < 17) {
// We use the db version upgrade here to identify users who may not have seen