Bug 1017142 - Show old Sync users their synced tabs instead of new sync setup in remote tabs panel. r=nalexander
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 28 May 2014 14:10:18 -0700
changeset 185427 bc643e9ee8422e3a52258b613fedf1b36d42b023
parent 185426 baf6ec3031f5d9ac81524f8085dec9428972f8cb
child 185428 94c7c9f4e27edc17ac4c775652b3e8a36eb3f30e
push id26853
push userttaubert@mozilla.com
push dateThu, 29 May 2014 04:39:32 +0000
treeherdermozilla-central@c8252fd40ba7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1017142
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1017142 - Show old Sync users their synced tabs instead of new sync setup in remote tabs panel. r=nalexander
mobile/android/base/tabspanel/RemoteTabsPanel.java
--- a/mobile/android/base/tabspanel/RemoteTabsPanel.java
+++ b/mobile/android/base/tabspanel/RemoteTabsPanel.java
@@ -1,18 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.tabspanel;
 
 import org.mozilla.gecko.R;
-
 import org.mozilla.gecko.fxa.FirefoxAccounts;
 import org.mozilla.gecko.fxa.login.State;
+import org.mozilla.gecko.sync.setup.SyncAccounts;
 import org.mozilla.gecko.tabspanel.TabsPanel.PanelView;
 
 import android.content.Context;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.FrameLayout;
 
@@ -74,19 +74,26 @@ class RemoteTabsPanel extends FrameLayou
             currentPanelType = newPanelType;
             currentPanel = inflatePanel(currentPanelType);
             currentPanel.setTabsPanel(tabsPanel);
             addView((View) currentPanel);
         }
     }
 
     private RemotePanelType getPanelTypeFromAccountState() {
-        final State accountState = FirefoxAccounts.getFirefoxAccountState(getContext());
+        final Context context = getContext();
+        final State accountState = FirefoxAccounts.getFirefoxAccountState(context);
         if (accountState == null) {
-            return RemotePanelType.SETUP;
+            // If old Sync exists, we want to show their synced tabs,
+            // rather than the new Sync setup screen.
+            if (SyncAccounts.syncAccountsExist(context)) {
+                return RemotePanelType.CONTAINER;
+            } else {
+                return RemotePanelType.SETUP;
+            }
         }
 
         if (accountState.getNeededAction() == State.Action.NeedsVerification) {
             return RemotePanelType.VERIFICATION;
         }
 
         return RemotePanelType.CONTAINER;
     }