summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-11-10 10:35:02 -0800
committerAdnan <adnan@cyngn.com>2014-11-19 15:53:59 -0800
commit916ba22867bbbe05edc6ccc39622f0e569b00d58 (patch)
treeacb15d42e2ccf86f7d7f03e3dcaec1607ed899a0 /src
parent12ed20fe5260a7a3b7bedce4cf5e995fc1ac281a (diff)
downloadandroid_packages_apps_Trebuchet-916ba22867bbbe05edc6ccc39622f0e569b00d58.tar.gz
android_packages_apps_Trebuchet-916ba22867bbbe05edc6ccc39622f0e569b00d58.tar.bz2
android_packages_apps_Trebuchet-916ba22867bbbe05edc6ccc39622f0e569b00d58.zip
Fix L2 and old Trebuchet migration
There can only be one original-package tag. Go with com.android.launcher3 for now, and move Trebuchet back to com.cyanogenmod.trebuchet. This will allow for workspace migrations from both CM10.2 Trebuchet and from CM11 Launcher3 Change-Id: I7743954bffc55f503851038f800607947e20015e
Diffstat (limited to 'src')
-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