bug 706574 - show native about:home in onCreate() r=dougt a=blassey, java only
authorBrad Lassey <blassey@mozilla.com>
Mon, 12 Dec 2011 12:57:04 -0500
changeset 82443 d07b605240b4f2803a9bebcab46f52af0184ab28
parent 82442 fd241426865cfe9574246190f4705be162e58155
child 82444 cf9b7ca68ef58d80c2b87e0233acb2aab318b184
push id21605
push userblassey@mozilla.com
push dateMon, 12 Dec 2011 17:58:09 +0000
treeherdermozilla-central@d07b605240b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt, blassey, java
bugs706574
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 706574 - show native about:home in onCreate() r=dougt a=blassey, java only
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoThread.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1247,23 +1247,36 @@ abstract public class GeckoApp
         });
     }
 
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         System.loadLibrary("mozutils");
+        mMainHandler = new Handler();
         Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - onCreate");
         if (savedInstanceState != null) {
             mLastUri = savedInstanceState.getString(SAVED_STATE_URI);
             mLastTitle = savedInstanceState.getString(SAVED_STATE_TITLE);
             mLastViewport = savedInstanceState.getString(SAVED_STATE_VIEWPORT);
             mLastScreen = savedInstanceState.getByteArray(SAVED_STATE_SCREEN);
         }
+        String uri = getIntent().getDataString();
+        String title = uri;
+        if (uri != null && uri.length() > 0) {
+            mLastUri = uri;
+            mLastTitle = title;
+        }
+
+        if (mLastUri == null || mLastUri.equals("") ||
+            mLastUri.equals("about:home")) {
+            showAboutHome();
+        }
+
         if (Build.VERSION.SDK_INT >= 9) {
             StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                                        .detectDiskReads().detectDiskWrites().detectNetwork()
                                        .penaltyLog().build());
             StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().penaltyLog().build());
         }
 
         super.onCreate(savedInstanceState);
@@ -1337,18 +1350,16 @@ abstract public class GeckoApp
 
         mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container);
 
         Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - UI almost up");
 
         if (sGREDir == null)
             sGREDir = new File(this.getApplicationInfo().dataDir);
 
-        mMainHandler = new Handler();
-
         if (!sTryCatchAttached) {
             sTryCatchAttached = true;
             mMainHandler.post(new Runnable() {
                 public void run() {
                     try {
                         Looper.loop();
                     } catch (Exception e) {
                         Log.e(LOGTAG, "top level exception", e);
--- a/mobile/android/base/GeckoThread.java
+++ b/mobile/android/base/GeckoThread.java
@@ -59,26 +59,16 @@ public class GeckoThread extends Thread 
     GeckoThread (Intent intent, String uri, String title) {
         mIntent = intent;
         mUri = uri;
         mTitle = title;
     }
 
     public void run() {
         final GeckoApp app = GeckoApp.mAppContext;
-        Intent intent = mIntent;
-        String uri = intent.getDataString();
-        String title = uri;
-        if (!app.mUserDefinedProfile && (uri == null || uri.length() == 0)) {
-            uri = mUri;
-            title = mTitle;
-        }
-        if (uri == null || uri.equals("") || uri.equals("about:home")) {
-            app.showAboutHome();
-        }
         File cacheFile = GeckoAppShell.getCacheDir();
         File libxulFile = new File(cacheFile, "libxul.so");
 
         if ((!libxulFile.exists() ||
              new File(app.getApplication().getPackageResourcePath()).lastModified() >= libxulFile.lastModified())) {
             File[] libs = cacheFile.listFiles(new FilenameFilter() {
                 public boolean accept(File dir, String name) {
                     return name.endsWith(".so");
@@ -101,28 +91,27 @@ public class GeckoThread extends Thread 
         Configuration config = res.getConfiguration();
         config.locale = locale;
         res.updateConfiguration(config, res.getDisplayMetrics());
 
         Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - runGecko");
 
         // and then fire us up
 
-        final String activityTitle = title;
         app.mMainHandler.post(new Runnable() {
             public void run() {
-                app.mBrowserToolbar.setTitle(activityTitle);
+                app.mBrowserToolbar.setTitle(mTitle);
             }
         });
         try {
-            Log.w(LOGTAG, "RunGecko - URI = " + uri);
+            Log.w(LOGTAG, "RunGecko - URI = " + mUri);
 
             GeckoAppShell.runGecko(app.getApplication().getPackageResourcePath(),
-                                   intent.getStringExtra("args"),
-                                   uri);
+                                   mIntent.getStringExtra("args"),
+                                   mUri);
         } catch (Exception e) {
             Log.e(LOGTAG, "top level exception", e);
             StringWriter sw = new StringWriter();
             PrintWriter pw = new PrintWriter(sw);
             e.printStackTrace(pw);
             pw.flush();
             GeckoAppShell.reportJavaCrash(sw.toString());
         }