Force engine initialization during onCreate
- During stress test on browser we noticed that
registerActivityLifecycleCallbacks.onActivityCreated was not
getting called. This call was required to ensure that the engine was
initialized before launching an activity.Added code to ensure engine is
initialized in onCreate of activity that use engine API's directly.
- Added null check for ComboView.hide method
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java
index 8270cfb..d79b957 100644
--- a/src/com/android/browser/Browser.java
+++ b/src/com/android/browser/Browser.java
@@ -119,6 +119,8 @@
// SWE: Avoid initializing the engine for sandboxed processes.
if (!isSandboxContext) {
+ if (LOGV_ENABLED)
+ Log.v(LOGTAG, "Browser.onCreate: Main Application");
BrowserSettings.initialize((Context) this);
Preloader.initialize((Context) this);
}
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 9bb74b5..4840d43 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -19,6 +19,7 @@
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
+import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceActivity;
@@ -65,13 +66,12 @@
@Override
public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- if (icicle != null) {
- return;
- }
if (!EngineInitializer.isInitialized()) {
Log.e(LOGTAG, "Engine not Initialized");
- finish();
+ EngineInitializer.initializeSync((Context) getApplicationContext());
+ }
+ super.onCreate(icicle);
+ if (icicle != null) {
return;
}
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index dd18c19..e629952 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -114,7 +114,8 @@
@Override
public void hideComboView() {
- mComboView.hideViews();
+ if (mComboView != null)
+ mComboView.hideViews();
}
@Override