summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-02-01 03:42:36 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-02-01 04:50:20 +0000
commitdda298f30af6a957b9194f54d91a3e6bbaa68302 (patch)
treec6a8b84b2fb9ff84cace607d0c5be67a7a076fa0
parent5fbcf7f7fabddfd55d959de5278ca635f66c536b (diff)
downloadandroid_packages_apps_Trebuchet-dda298f30af6a957b9194f54d91a3e6bbaa68302.tar.gz
android_packages_apps_Trebuchet-dda298f30af6a957b9194f54d91a3e6bbaa68302.tar.bz2
android_packages_apps_Trebuchet-dda298f30af6a957b9194f54d91a3e6bbaa68302.zip
Fix L3 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
-rw-r--r--Android.mk2
-rw-r--r--AndroidManifest.xml5
-rw-r--r--src/com/android/launcher3/LauncherProvider.java68
3 files changed, 70 insertions, 5 deletions
diff --git a/Android.mk b/Android.mk
index 7a6b3ba5b..0fd1ff77f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -38,7 +38,7 @@ LOCAL_PACKAGE_NAME := Trebuchet
LOCAL_PRIVILEGED_MODULE := true
#LOCAL_CERTIFICATE := shared
-LOCAL_AAPT_FLAGS := --rename-manifest-package org.cyanogenmod.trebuchet
+LOCAL_AAPT_FLAGS := --rename-manifest-package com.cyanogenmod.trebuchet
LOCAL_OVERRIDES_PACKAGES := Launcher3
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9e192544a..13cf636fc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -23,6 +23,8 @@
android:versionName="@string/application_version"
android:versionCode="1000">
+ <original-package android:name="com.android.launcher3" />
+
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="19" />
<permission
@@ -47,9 +49,6 @@
android:protectionLevel="signature"
/>
- <original-package android:name="com.cyanogenmod.trebuchet" />
- <original-package android:name="com.android.launcher3" />
-
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 210bbf8bc..359a40323 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -69,7 +69,7 @@ public class LauncherProvider extends ContentProvider {
private static final String DATABASE_NAME = "launcher.db";
- private static final int DATABASE_VERSION = 15;
+ private static final int DATABASE_VERSION = 17;
static final String OLD_AUTHORITY = "com.android.launcher2.settings";
static final String AUTHORITY = ProviderConfig.AUTHORITY;
@@ -689,6 +689,72 @@ public class LauncherProvider extends ContentProvider {
}
}
+ // 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();
+ }
+ }
+
+
+ // Artificially inflate the version to make sure we're fully up to date
+ // after a possible 10.2-Trebuchet migration
+
+ if (version == 15) {
+ version = 17;
+ }
+
if (version != DATABASE_VERSION) {
Log.w(TAG, "Destroying all old data.");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);