Bug 917538 - Fix Fennec Restarter flags and remove System.exit(0). r=blassey, a=akeybl
authorBrian Nicholson <bnicholson@mozilla.com>
Thu, 26 Sep 2013 16:34:38 -0700
changeset 160484 f7271bceffa15e053bdd8803a3182013f68390aa
parent 160483 f75dbfe92bcc1a2ddcf37f5e236795bf2f5e96d1
child 160485 e0353f4ef66296c06440b980f87007cab1da75ae
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, akeybl
bugs917538
milestone26.0a2
Bug 917538 - Fix Fennec Restarter flags and remove System.exit(0). r=blassey, a=akeybl
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/GeckoApp.java
mobile/android/base/Restarter.java
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -196,16 +196,17 @@
         <receiver android:name="org.mozilla.gecko.ReferrerReceiver" android:exported="true">
             <intent-filter>
                 <action android:name="com.android.vending.INSTALL_REFERRER" />
             </intent-filter>
         </receiver>
 
         <activity android:name="org.mozilla.gecko.Restarter"
                   android:process="@ANDROID_PACKAGE_NAME@Restarter"
+                  android:noHistory="true"
                   android:theme="@style/Gecko">
           <intent-filter>
             <action android:name="org.mozilla.gecko.restart"/>
             <action android:name="org.mozilla.gecko.restart_update"/>
           </intent-filter>
         </activity>
 
 #include ../services/manifests/AnnouncementsAndroidManifest_activities.xml.in
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -2133,18 +2133,16 @@ abstract public class GeckoApp
     }
 
     public void doRestart(String action, String args) {
         Log.d(LOGTAG, "doRestart(\"" + action + "\")");
         try {
             Intent intent = new Intent(action);
             intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, RESTARTER_CLASS);
             /* TODO: addEnvToIntent(intent); */
-            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
-                            Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
             if (args != null)
                 intent.putExtra("args", args);
             intent.putExtra("didRestart", true);
             Log.d(LOGTAG, "Restart intent: " + intent.toString());
             GeckoAppShell.killAnyZombies();
             startActivity(intent);
         } catch (Exception e) {
             Log.e(LOGTAG, "Error effecting restart.", e);
--- a/mobile/android/base/Restarter.java
+++ b/mobile/android/base/Restarter.java
@@ -10,16 +10,18 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
 
 public class Restarter extends Activity {
     private static final String LOGTAG = "GeckoRestarter";
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
         Log.i(LOGTAG, "Trying to restart " + AppConstants.MOZ_APP_NAME);
         try {
             int countdown = 40;
             while (GeckoAppShell.checkForGeckoProcs() &&  --countdown > 0) {
                 // Wait for the old process to die before we continue
                 try {
                     Thread.sleep(100);
                 } catch (InterruptedException ie) {}
@@ -41,20 +43,15 @@ public class Restarter extends Activity 
         }
         try {
             Intent intent = new Intent(Intent.ACTION_MAIN);
             intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
                                 AppConstants.BROWSER_INTENT_CLASS);
             Bundle b = getIntent().getExtras();
             if (b != null)
                 intent.putExtras(b);
-            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
             Log.i(LOGTAG, intent.toString());
             startActivity(intent);
         } catch (Exception e) {
             Log.i(LOGTAG, e.toString());
         }
-        // Give the new process time to start before we die
-        GeckoAppShell.waitForAnotherGeckoProc();
-        System.exit(0);
     }
 }