diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index e9a7ab48b14..45cf3b067e1 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1438,6 +1438,7 @@ abstract public class GeckoApp @Override public void onCreate(Bundle savedInstanceState) { + ((GeckoApplication)getApplication()).initialize(); GeckoAppShell.registerGlobalExceptionHandler(); mAppContext = this; diff --git a/mobile/android/base/GeckoApplication.java b/mobile/android/base/GeckoApplication.java index db11d90d5d0..bdf23d2bfe0 100644 --- a/mobile/android/base/GeckoApplication.java +++ b/mobile/android/base/GeckoApplication.java @@ -10,22 +10,24 @@ import java.util.ArrayList; public class GeckoApplication extends Application { + private boolean mInited; private boolean mInBackground; - @Override - public void onCreate() { + protected void initialize() { + if (mInited) + return; + // workaround for http://code.google.com/p/android/issues/detail?id=20915 try { Class.forName("android.os.AsyncTask"); } catch (ClassNotFoundException e) {} - super.onCreate(); - GeckoConnectivityReceiver.getInstance().init(getApplicationContext()); GeckoBatteryManager.getInstance().init(getApplicationContext()); GeckoBatteryManager.getInstance().start(); GeckoNetworkManager.getInstance().init(getApplicationContext()); MemoryMonitor.getInstance().init(getApplicationContext()); + mInited = true; } protected void onActivityPause(GeckoActivity activity) { diff --git a/mobile/android/base/UpdateService.java b/mobile/android/base/UpdateService.java index 878cdccb47e..74fea19892d 100644 --- a/mobile/android/base/UpdateService.java +++ b/mobile/android/base/UpdateService.java @@ -119,7 +119,7 @@ public class UpdateService extends IntentService { protected void onHandleIntent (Intent intent) { if (UpdateServiceHelper.ACTION_REGISTER_FOR_UPDATES.equals(intent.getAction())) { registerForUpdates(false); - } if (UpdateServiceHelper.ACTION_CHECK_FOR_UPDATE.equals(intent.getAction())) { + } else if (UpdateServiceHelper.ACTION_CHECK_FOR_UPDATE.equals(intent.getAction())) { startUpdate(intent.getIntExtra(UpdateServiceHelper.EXTRA_UPDATE_FLAGS_NAME, 0)); } else if (UpdateServiceHelper.ACTION_APPLY_UPDATE.equals(intent.getAction())) { applyUpdate(intent.getStringExtra(UpdateServiceHelper.EXTRA_PACKAGE_PATH_NAME));