summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Android.mk4
-rw-r--r--AndroidManifest.xml12
-rw-r--r--src/com/android/launcher3/LauncherProvider.java58
3 files changed, 66 insertions, 8 deletions
diff --git a/Android.mk b/Android.mk
index 103edfb74..5cdc0030d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -38,10 +38,10 @@ LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
# LOCAL_SDK_VERSION := 21
-LOCAL_PACKAGE_NAME := Launcher3
+LOCAL_PACKAGE_NAME := Trebuchet
#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 12888962f..4965c0c8e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -19,8 +19,13 @@
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.launcher3">
- <uses-sdk android:targetSdkVersion="21" android:minSdkVersion="16"/>
+ package="com.android.launcher3"
+ android:versionName="@string/application_version"
+ android:versionCode="1000">
+
+ <original-package android:name="com.android.launcher3" />
+
+ <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="16" />
<permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
@@ -54,9 +59,6 @@
android:name="com.android.launcher3.permission.RECEIVE_FIRST_LOAD_BROADCAST"
android:protectionLevel="signatureOrSystem" />
- <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 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