summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/BrowserSettings.java
diff options
context:
space:
mode:
authorKulanthaivel Palanichamy <kulanthaivel@codeaurora.org>2014-10-28 11:52:06 -0700
committerWebTech Code Review <code-review@localhost>2014-11-19 11:40:29 -0800
commit779426812b2f693e4e0818e2d60b87884668955d (patch)
treea8f316c279331b1cddf72e8aa124f357931e8db6 /src/com/android/browser/BrowserSettings.java
parente24f852d33843cd083d5482c8792e2f4ebc3d68b (diff)
downloadandroid_packages_apps_Gello-779426812b2f693e4e0818e2d60b87884668955d.tar.gz
android_packages_apps_Gello-779426812b2f693e4e0818e2d60b87884668955d.tar.bz2
android_packages_apps_Gello-779426812b2f693e4e0818e2d60b87884668955d.zip
Improve browser startup time
A number of optimizations are made to improve the time to interact with the UI quicker. Steps are made to parallelize the web engine initialization while others removed impediments to the UI bring up. Changes: - Engine Initialization is moved to an async task. - A new NoShow BrowserLauncher activity is added to chain-load BrowserActivity at startup obviating the blank white screen shown. - Native libraries are loaded asynchronously in a background thread. - ResourceExtractor is started much earlier than before. - BrowserSettings is synced to native only after engine initialization. - Other parts of UI are made aware of engine initialization state to throttle actions. Change-Id: Icd4959769fa9813170baf7023c46b696b30dfed1
Diffstat (limited to 'src/com/android/browser/BrowserSettings.java')
-rw-r--r--src/com/android/browser/BrowserSettings.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index b9588542..255aaf82 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -130,6 +130,9 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
private static String sFactoryResetUrl;
+ private boolean mEngineInitialized = false;
+ private boolean mSyncManagedSettings = false;
+
public static synchronized void initialize(final Context context) {
if (sInstance == null)
sInstance = new BrowserSettings(context);
@@ -142,7 +145,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
private BrowserSettings(Context context) {
mContext = context.getApplicationContext();
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- mAutofillHandler = new AutofillHandler(mContext);
mManagedSettings = new LinkedList<WeakReference<WebSettings>>();
mCustomUserAgents = new WeakHashMap<WebSettings, String>();
BackgroundHandler.execute(mSetup);
@@ -150,7 +152,16 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
public void setController(Controller controller) {
mController = controller;
- if (sInitialized) {
+ mNeedsSharedSync = true;
+ }
+
+ public void onEngineInitializationComplete() {
+ mEngineInitialized = true;
+ mAutofillHandler = new AutofillHandler(mContext);
+ if (mSyncManagedSettings) {
+ syncManagedSettings();
+ }
+ if (mNeedsSharedSync) {
syncSharedSettings();
}
}
@@ -402,6 +413,11 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
}
private void syncManagedSettings() {
+ if (!mEngineInitialized) {
+ mSyncManagedSettings = true;
+ return;
+ }
+ mSyncManagedSettings = false;
syncSharedSettings();
synchronized (mManagedSettings) {
Iterator<WeakReference<WebSettings>> iter = mManagedSettings.iterator();