Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: mobile/android/base/java/org/mozilla/gecko/home/HomeConfigPrefsBackend.java

Issue 29596710: Issue 5989 - Migration crash after updating to 1.3.0 (Closed)
Patch Set: Created Nov. 3, 2017, 7:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public 2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 5
6 package org.mozilla.gecko.home; 6 package org.mozilla.gecko.home;
7 7
8 import static org.mozilla.gecko.home.HomeConfig.createBuiltinPanelConfig; 8 import static org.mozilla.gecko.home.HomeConfig.createBuiltinPanelConfig;
9 9
10 import java.util.ArrayList; 10 import java.util.ArrayList;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } else if (type == PanelType.DEPRECATED_REMOTE_TABS) { 172 } else if (type == PanelType.DEPRECATED_REMOTE_TABS) {
173 syncIndex = i; 173 syncIndex = i;
174 syncFlags = panelConfig.getFlags(); 174 syncFlags = panelConfig.getFlags();
175 } else if (type == PanelType.COMBINED_HISTORY) { 175 } else if (type == PanelType.COMBINED_HISTORY) {
176 // Partial landing of bug 1220928 combined the History and Sync panels of users who didn't 176 // Partial landing of bug 1220928 combined the History and Sync panels of users who didn't
177 // have home panel customizations (including new users), thus th ey don't this migration. 177 // have home panel customizations (including new users), thus th ey don't this migration.
178 return jsonPanels; 178 return jsonPanels;
179 } 179 }
180 } 180 }
181 181
182 // Since we removed the sync panel, it's expected to not be present at t his point
183 // See https://issues.adblockplus.org/ticket/5989
184 if(syncIndex == -1) {
jens 2017/11/04 10:47:27 Minor, but a space between 'if' and '(' is missing
185 final PanelConfig newPanel = createBuiltinPanelConfig(context, Panel Type.COMBINED_HISTORY, historyFlags);
186 jsonPanels.put(historyIndex, newPanel.toJSON());
187 return jsonPanels;
188 }
189
182 if (historyIndex == -1 || syncIndex == -1) { 190 if (historyIndex == -1 || syncIndex == -1) {
183 throw new IllegalArgumentException("Expected both History and Sync p anels to be present prior to Combined History."); 191 throw new IllegalArgumentException("Expected both History and Sync p anels to be present prior to Combined History.");
184 } 192 }
185 193
186 PanelConfig newPanel; 194 PanelConfig newPanel;
187 int replaceIndex; 195 int replaceIndex;
188 int removeIndex; 196 int removeIndex;
189 197
190 if (historyFlags.contains(PanelConfig.Flags.DISABLED_PANEL) && !syncFlag s.contains(PanelConfig.Flags.DISABLED_PANEL)) { 198 if (historyFlags.contains(PanelConfig.Flags.DISABLED_PANEL) && !syncFlag s.contains(PanelConfig.Flags.DISABLED_PANEL)) {
191 // Replace the Sync panel if it's visible and the History panel is d isabled. 199 // Replace the Sync panel if it's visible and the History panel is d isabled.
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 lbm.unregisterReceiver(mReloadBroadcastReceiver); 662 lbm.unregisterReceiver(mReloadBroadcastReceiver);
655 } 663 }
656 664
657 private class ReloadBroadcastReceiver extends BroadcastReceiver { 665 private class ReloadBroadcastReceiver extends BroadcastReceiver {
658 @Override 666 @Override
659 public void onReceive(Context context, Intent intent) { 667 public void onReceive(Context context, Intent intent) {
660 mReloadListener.onReload(); 668 mReloadListener.onReload();
661 } 669 }
662 } 670 }
663 } 671 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld