diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 61eb981ee632..79317ed58546 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1514,12 +1514,7 @@ abstract public class GeckoApp } GeckoAppShell.loadMozGlue(); - if (sGeckoThread == null) { - sGeckoThread = new GeckoThread(); - String uri = getURIFromIntent(getIntent()); - if (uri != null && uri.length() > 0 && !uri.equals("about:home")) - sGeckoThread.start(); - } else { + if (sGeckoThread != null) { // this happens when the GeckoApp activity is destroyed by android // without killing the entire application (see bug 769269) mIsRestoringActivity = true; @@ -1627,17 +1622,19 @@ abstract public class GeckoApp passedUri = "about:empty"; } - sGeckoThread.init(intent, passedUri, mRestoreMode); + if (!mIsRestoringActivity) { + sGeckoThread = new GeckoThread(intent, passedUri, mRestoreMode); + } if (!ACTION_DEBUG.equals(action) && checkAndSetLaunchState(LaunchState.Launching, LaunchState.Launched)) { - sGeckoThread.reallyStart(); + sGeckoThread.start(); } else if (ACTION_DEBUG.equals(action) && checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitForDebugger)) { mMainHandler.postDelayed(new Runnable() { public void run() { Log.i(LOGTAG, "Launching from debug intent after 5s wait"); setLaunchState(LaunchState.Launching); - sGeckoThread.reallyStart(); + sGeckoThread.start(); } }, 1000 * 5 /* 5 seconds */); Log.i(LOGTAG, "Intent : ACTION_DEBUG - waiting 5s before launching"); diff --git a/mobile/android/base/GeckoThread.java b/mobile/android/base/GeckoThread.java index ea8d77870882..5c5b53c18869 100644 --- a/mobile/android/base/GeckoThread.java +++ b/mobile/android/base/GeckoThread.java @@ -14,7 +14,6 @@ import android.os.SystemClock; import android.util.Log; import java.util.Locale; -import java.util.concurrent.CountDownLatch; public class GeckoThread extends Thread { private static final String LOGTAG = "GeckoThread"; @@ -22,23 +21,12 @@ public class GeckoThread extends Thread { Intent mIntent; String mUri; int mRestoreMode; - CountDownLatch mStartSignal; - GeckoThread() { - mStartSignal = new CountDownLatch(1); - setName("Gecko"); - } - - public void init(Intent intent, String uri, int restoreMode) { + GeckoThread(Intent intent, String uri, int restoreMode) { mIntent = intent; mUri = uri; mRestoreMode = restoreMode; - } - - public void reallyStart() { - mStartSignal.countDown(); - if (getState() == Thread.State.NEW) - start(); + setName("Gecko"); } public void run() { @@ -65,11 +53,6 @@ public class GeckoThread extends Thread { GeckoAppShell.loadGeckoLibs(resourcePath); Locale.setDefault(locale); - - try { - mStartSignal.await(); - } catch (Exception e) { } - Resources res = app.getBaseContext().getResources(); Configuration config = res.getConfiguration(); config.locale = locale;