Bug 794642 - Avoid unnecessary GeckoApplication initialization in services r=kats

--HG--
extra : rebase_source : b406d8ee24c74b0185e9c31b15a4e6e20629d5f5
This commit is contained in:
James Willcox 2012-09-27 10:52:59 -04:00
parent c863356300
commit 31cd926957
3 changed files with 8 additions and 5 deletions

View File

@ -1438,6 +1438,7 @@ abstract public class GeckoApp
@Override
public void onCreate(Bundle savedInstanceState)
{
((GeckoApplication)getApplication()).initialize();
GeckoAppShell.registerGlobalExceptionHandler();
mAppContext = this;

View File

@ -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) {

View File

@ -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));