Bug 738676 - Pair a device not working a second time. r=rnewman, a=blocking-fennec,akeybl
authorChenxia Liu <liuche@mozilla.com>
Tue, 08 May 2012 15:14:48 -0700
changeset 95763 5ce30c9e6f27f7654d468d1a681570924375003d
parent 95762 2919c14e90bd0a45478967dfad637863fe10b79d
child 95764 8edbfdefcc264dbbc193559e146dec6453f56b2e
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, blocking-fennec, akeybl
bugs738676
milestone14.0a2
Bug 738676 - Pair a device not working a second time. r=rnewman, a=blocking-fennec,akeybl
mobile/android/base/sync/setup/activities/SetupSuccessActivity.java
mobile/android/base/sync/setup/activities/SetupSyncActivity.java
mobile/android/sync/manifests/SyncAndroidManifest_activities.xml.in
--- a/mobile/android/base/sync/setup/activities/SetupSuccessActivity.java
+++ b/mobile/android/base/sync/setup/activities/SetupSuccessActivity.java
@@ -33,28 +33,28 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 package org.mozilla.gecko.sync.setup.activities;
 
 import org.mozilla.gecko.R;
+import org.mozilla.gecko.sync.Logger;
 import org.mozilla.gecko.sync.setup.Constants;
 
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.view.View;
 import android.widget.TextView;
 
 public class SetupSuccessActivity extends Activity {
-  @SuppressWarnings("unused")
   private final static String LOG_TAG = "SetupSuccessActivity";
   private TextView setupSubtitle;
   private Context mContext;
 
   @Override
   public void onCreate(Bundle savedInstanceState) {
     setTheme(R.style.SyncTheme);
     super.onCreate(savedInstanceState);
@@ -65,22 +65,27 @@ public class SetupSuccessActivity extend
     if (extras != null) {
       boolean isSetup = extras.getBoolean(Constants.INTENT_EXTRA_IS_SETUP);
       if (!isSetup) {
         setupSubtitle.setText(getString(R.string.sync_subtitle_manage));
       }
     }
   }
 
+  @Override
+  public void onDestroy() {
+    Logger.debug(LOG_TAG, "onDestroy() called.");
+    super.onDestroy();
+  }
+
   /* Click Handlers */
   public void settingsClickHandler(View target) {
     Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
-    intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
+    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
     startActivity(intent);
-    finish();
   }
 
   public void pairClickHandler(View target) {
     Intent intent = new Intent(mContext, SetupSyncActivity.class);
     intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
     intent.putExtra(Constants.INTENT_EXTRA_IS_SETUP, false);
     startActivity(intent);
   }
--- a/mobile/android/base/sync/setup/activities/SetupSyncActivity.java
+++ b/mobile/android/base/sync/setup/activities/SetupSyncActivity.java
@@ -148,23 +148,31 @@ public class SetupSyncActivity extends A
 
   @Override
   public void onPause() {
     super.onPause();
 
     if (jClient != null) {
       jClient.abort(Constants.JPAKE_ERROR_USERABORT);
     }
+    if (pairWithPin) {
+      finish();
+    }
   }
 
   @Override
   public void onNewIntent(Intent intent) {
     Logger.debug(LOG_TAG, "Started SetupSyncActivity with new intent.");
     setIntent(intent);
-    onResume();
+  }
+
+  @Override
+  public void onDestroy() {
+    Logger.debug(LOG_TAG, "onDestroy() called.");
+    super.onDestroy();
   }
 
   /* Click Handlers */
   public void manualClickHandler(View target) {
     Intent accountIntent = new Intent(this, AccountActivity.class);
     accountIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
     startActivity(accountIntent);
     overridePendingTransition(0, 0);
--- a/mobile/android/sync/manifests/SyncAndroidManifest_activities.xml.in
+++ b/mobile/android/sync/manifests/SyncAndroidManifest_activities.xml.in
@@ -10,17 +10,19 @@
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
         </activity>
         <activity
             android:clearTaskOnLaunch="true"
             android:name="org.mozilla.gecko.sync.setup.activities.AccountActivity"
             android:windowSoftInputMode="adjustPan|stateHidden"/>
         <activity
+            android:noHistory="true"
             android:name="org.mozilla.gecko.sync.setup.activities.SetupFailureActivity" />
         <activity
+            android:noHistory="true"
             android:name="org.mozilla.gecko.sync.setup.activities.SetupSuccessActivity" />
         <receiver
             android:name="org.mozilla.gecko.sync.receivers.UpgradeReceiver">
             <intent-filter>
                 <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
             </intent-filter>
         </receiver>