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
diff --git a/src/com/android/browser/LocationButton.java b/src/com/android/browser/LocationButton.java
index e805e43..4136d6e 100644
--- a/src/com/android/browser/LocationButton.java
+++ b/src/com/android/browser/LocationButton.java
@@ -74,9 +74,15 @@
         init();
     }
 
-    private void init() {
-        mGeolocationPermissions = GeolocationPermissions.getInstance();
+    private void updateGeolocationPermissions() {
+        mGeolocationPermissions = mCurrentIncognito ?
+                                    GeolocationPermissions.getIncognitoInstance() :
+                                    GeolocationPermissions.getInstance();
         mGeolocationPermissions.registerOnGeolocationPolicyModifiedListener(this);
+    }
+
+    // TODO: Perform this initilalization only after the engine initialization is complete.
+    private void init() {
         mCurrentTabId = -1;
         mCurrentOrigin = null;
         mCurrentIncognito = false;
@@ -86,11 +92,8 @@
             public void onClick(View v) {
                 if (!mCurrentOrigin.isEmpty()) {
                     final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
-                    final GeolocationPermissions geolocationPermissions =
-                            (mCurrentIncognito ?
-                                    GeolocationPermissions.getIncognitoInstance() :
-                                    GeolocationPermissions.getInstance());
-
+                    updateGeolocationPermissions();
+                    final GeolocationPermissions geolocationPermissions = mGeolocationPermissions;
                     DialogInterface.OnClickListener alertDialogListener =
                             new AlertDialog.OnClickListener() {
                         public void onClick(DialogInterface dlg, int which) {
@@ -182,16 +185,6 @@
         if (mCurrentTabId != tabId) {
             mCurrentTabId = tabId;
             mCurrentOrigin = origin;
-
-            // Switch GeolocationPermissions if we went from a regular to an
-            // incognito tab or vice versa
-            if (mCurrentIncognito != incognito) {
-                mCurrentIncognito = incognito;
-                mGeolocationPermissions = mCurrentIncognito ?
-                        GeolocationPermissions.getIncognitoInstance() :
-                            GeolocationPermissions.getInstance();
-                mGeolocationPermissions.registerOnGeolocationPolicyModifiedListener(this);
-            }
             update();
         }
         // Update icon if we are in the same tab and origin has changed
@@ -205,6 +198,7 @@
 
     public void update() {
         if (mCurrentOrigin != null) {
+            updateGeolocationPermissions();
             mGeolocationPermissions.hasOrigin(mCurrentOrigin,
                     new ValueCallback<Boolean>() {
                 public void onReceiveValue(Boolean hasOrigin) {