From 8fff220ee1ba2c200d3727324b882739593571a1 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Wed, 14 Dec 2011 12:35:58 -0500 Subject: [PATCH] bug 710751 - Updater is broken, backout aebdec71790e r=mfinle a=java-only --- mobile/android/base/GeckoApp.java | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 9871db63e2b..e27a592700f 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -913,7 +913,6 @@ abstract public class GeckoApp setLaunchState(GeckoApp.LaunchState.GeckoRunning); GeckoAppShell.sendPendingEventsToGecko(); connectGeckoLayerClient(); - Looper.myQueue().addIdleHandler(new UpdateIdleHandler()); } else if (event.equals("ToggleChrome:Hide")) { mMainHandler.post(new Runnable() { public void run() { @@ -1431,7 +1430,32 @@ abstract public class GeckoApp mSmsReceiver = new GeckoSmsManager(); registerReceiver(mSmsReceiver, smsFilter); - final GeckoApp self = this; + final GeckoApp self = this; + + mMainHandler.postDelayed(new Runnable() { + public void run() { + + Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - pre checkLaunchState"); + + /* + XXXX see bug 635342 + We want to disable this code if possible. It is about 145ms in runtime + SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); + String localeCode = settings.getString(getPackageName() + ".locale", ""); + if (localeCode != null && localeCode.length() > 0) + GeckoAppShell.setSelectedLocale(localeCode); + */ + + if (!checkLaunchState(LaunchState.Launched)) { + return; + } + + // it would be good only to do this if MOZ_UPDATER was defined + long startTime = new Date().getTime(); + checkAndLaunchUpdate(); + Log.w(LOGTAG, "checking for an update took " + (new Date().getTime() - startTime) + "ms"); + } + }, 50); } /** @@ -1696,21 +1720,6 @@ abstract public class GeckoApp GeckoAppShell.handleNotification(action, alertName, alertCookie); } - // it would be good only to do this if MOZ_UPDATER was defined - private class UpdateIdleHandler implements MessageQueue.IdleHandler { - public boolean queueIdle() { - mMainHandler.post(new Runnable() { - public void run() { - long startTime = new Date().getTime(); - checkAndLaunchUpdate(); - Log.w(LOGTAG, "checking for an update took " + (new Date().getTime() - startTime) + "ms"); - } - }); - // only need to run this once. - return false; - } - } - private void checkAndLaunchUpdate() { Log.i(LOGTAG, "Checking for an update");