Bug 965020 - Use task affinities more clearly to avoid some back-stack issues. r=wesj
authorRichard Newman <rnewman@mozilla.com>
Tue, 28 Jan 2014 15:18:16 -0800
changeset 165638 d757713c39ccdbe9ebe9aee4a0434c0eb6d2f3d3
parent 165637 43a5a5b96019583096122a8c682e6fd95eb11473
child 165639 879adcefc3ab91fb8bbd60b084650bbf10716e5b
push id1014
push userrnewman@mozilla.com
push dateTue, 28 Jan 2014 23:22:52 +0000
treeherderservices-central@d757713c39cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs965020
milestone29.0a1
Bug 965020 - Use task affinities more clearly to avoid some back-stack issues. r=wesj
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/preferences/SyncPreference.java
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -82,16 +82,18 @@
 #else
 		 android:debuggable="true">
 #endif
 
         <!-- If the windowSoftInputMode adjust* flag changes below, the
              setSoftInputMode call in BrowserSearch#onStop must also be updated. -->
         <activity android:name=".App"
                   android:label="@MOZ_APP_DISPLAYNAME@"
+                  android:taskAffinity="@ANDROID_PACKAGE_NAME@.BROWSER"
+                  android:alwaysRetainTaskState="true"
                   android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize"
                   android:windowSoftInputMode="stateUnspecified|adjustResize"
                   android:launchMode="singleTask"
                   android:theme="@style/Gecko.App">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
--- a/mobile/android/base/preferences/SyncPreference.java
+++ b/mobile/android/base/preferences/SyncPreference.java
@@ -1,34 +1,45 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * 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.preferences;
 
+import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity;
 import org.mozilla.gecko.sync.setup.SyncAccounts;
 import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
 
 import android.content.Context;
 import android.content.Intent;
 import android.preference.Preference;
 import android.util.AttributeSet;
 
 class SyncPreference extends Preference {
     private Context mContext;
 
     public SyncPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
         mContext = context;
     }
 
-    @Override
-    protected void onClick() {
+    private void openSync11Settings() {
         // Show Sync setup if no accounts exist; otherwise, show account settings.
         if (SyncAccounts.syncAccountsExist(mContext)) {
             SyncAccounts.openSyncSettings(mContext);
-        } else {
-            Intent intent = new Intent(mContext, SetupSyncActivity.class);
-            mContext.startActivity(intent);
+            return;
         }
+        Intent intent = new Intent(mContext, SetupSyncActivity.class);
+        mContext.startActivity(intent);
+    }
+
+    private void launchFxASetup() {
+        Intent intent = new Intent(mContext, FxAccountGetStartedActivity.class);
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        mContext.startActivity(intent);
+    }
+
+    @Override
+    protected void onClick() {
+        openSync11Settings();
     }
 }