Bug 1251362 - Part 18 - Migrate (customised) home panel configurations. r=liuche
For people with customised home panels, we need to explicitly remove the Recent Tabs panel. We also unhide the Combined History panel if it was previously hidden and additionally turn it into the default panel if the Recent Tabs panel was the previous default panel.
MozReview-Commit-ID: 5CSJUTRysQU
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeConfigPrefsBackend.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeConfigPrefsBackend.java
@@ -30,17 +30,17 @@ import android.content.SharedPreferences
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.util.Log;
public class HomeConfigPrefsBackend implements HomeConfigBackend {
private static final String LOGTAG = "GeckoHomeConfigBackend";
// Increment this to trigger a migration.
- private static final int VERSION = 6;
+ private static final int VERSION = 7;
// This key was originally used to store only an array of panel configs.
public static final String PREFS_CONFIG_KEY_OLD = "home_panels";
// This key is now used to store a version number with the array of panel configs.
public static final String PREFS_CONFIG_KEY = "home_panels_with_version";
// Keys used with JSON object stored in prefs.
@@ -398,16 +398,21 @@ public class HomeConfigPrefsBackend impl
// This is the fix for bug 1264136 where we lost track of the default panel during some migrations.
ensureDefaultPanelForV5(context, jsonPanels);
break;
case 6:
jsonPanels = removePanel(context, jsonPanels,
PanelType.DEPRECATED_READING_LIST, PanelType.BOOKMARKS, false);
break;
+
+ case 7:
+ jsonPanels = removePanel(context, jsonPanels,
+ PanelType.RECENT_TABS, PanelType.COMBINED_HISTORY, true);
+ break;
}
}
// Save the new panel config and the new version number.
final JSONObject newJson = new JSONObject();
newJson.put(JSON_KEY_PANELS, jsonPanels);
newJson.put(JSON_KEY_VERSION, VERSION);