From 52bc78fc4ae9bc196595acbdc5b179029d27b94c Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Sun, 22 Apr 2012 09:58:25 -0700 Subject: [PATCH] Bug 747181 - Profile migration migrates tag folders. r=rnewman a=blocking-fennec-beta --- mobile/android/base/ProfileMigrator.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/ProfileMigrator.java b/mobile/android/base/ProfileMigrator.java index fd1ba8ad057..df588ba0b6b 100644 --- a/mobile/android/base/ProfileMigrator.java +++ b/mobile/android/base/ProfileMigrator.java @@ -124,6 +124,9 @@ public class ProfileMigrator { private static final String ROOT_NAME = "root_name"; private static final String ROOT_FOLDER_ID = "folder_id"; + // We use this to ignore the tags folder during migration. + private static final String ROOT_TAGS_FOLDER_NAME = "tags"; + private static final String BOOKMARK_QUERY_SELECT = "SELECT places.url AS p_url," + " bookmark.guid AS b_guid," + @@ -557,6 +560,7 @@ public class ProfileMigrator { private class PlacesRunnable implements Runnable { private Map mRerootMap; + private Long mTagsPlacesFolderId; private ArrayList mOperations; private int mMaxEntries; // We support 2 classes of schemas: Firefox Places 12-13 @@ -644,6 +648,12 @@ public class ProfileMigrator { mRerootMap.put(placesFolderId, getFolderId(name)); Log.v(LOGTAG, "Name: " + name + ", pid=" + placesFolderId + ", nid=" + mRerootMap.get(placesFolderId)); + + // Keep track of the tags folder id so we can avoid + // migrating tags later. + if (ROOT_TAGS_FOLDER_NAME.equals(name)) + mTagsPlacesFolderId = placesFolderId; + cursor.moveToNext(); } cursor.close(); @@ -1051,9 +1061,10 @@ public class ProfileMigrator { int type = cursor.getInt(typeCol); long parent = cursor.getLong(parentCol); - // Places has an explicit root folder, id=1 parent=0. - // Skip that. - if (id == 1 && parent == 0 && type == PLACES_TYPE_FOLDER) { + // Places has an explicit root folder, id=1 parent=0. Skip that. + // Also, skip tags, since we don't use those in native fennec. + if ((id == 1 && parent == 0 && type == PLACES_TYPE_FOLDER) || + parent == mTagsPlacesFolderId) { cursor.moveToNext(); continue; }