bug 706574 - show native about:home in onCreate() r=dougt a=blassey, java only

This commit is contained in:
Brad Lassey 2011-12-12 12:57:04 -05:00
parent f553c4453b
commit 3a1dd2d282
2 changed files with 17 additions and 17 deletions

View File

@ -1252,6 +1252,7 @@ abstract public class GeckoApp
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
{ {
System.loadLibrary("mozutils"); System.loadLibrary("mozutils");
mMainHandler = new Handler();
Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - onCreate"); Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - onCreate");
if (savedInstanceState != null) { if (savedInstanceState != null) {
mLastUri = savedInstanceState.getString(SAVED_STATE_URI); mLastUri = savedInstanceState.getString(SAVED_STATE_URI);
@ -1259,6 +1260,18 @@ abstract public class GeckoApp
mLastViewport = savedInstanceState.getString(SAVED_STATE_VIEWPORT); mLastViewport = savedInstanceState.getString(SAVED_STATE_VIEWPORT);
mLastScreen = savedInstanceState.getByteArray(SAVED_STATE_SCREEN); 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) { if (Build.VERSION.SDK_INT >= 9) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads().detectDiskWrites().detectNetwork() .detectDiskReads().detectDiskWrites().detectNetwork()
@ -1342,8 +1355,6 @@ abstract public class GeckoApp
if (sGREDir == null) if (sGREDir == null)
sGREDir = new File(this.getApplicationInfo().dataDir); sGREDir = new File(this.getApplicationInfo().dataDir);
mMainHandler = new Handler();
if (!sTryCatchAttached) { if (!sTryCatchAttached) {
sTryCatchAttached = true; sTryCatchAttached = true;
mMainHandler.post(new Runnable() { mMainHandler.post(new Runnable() {

View File

@ -64,16 +64,6 @@ public class GeckoThread extends Thread {
public void run() { public void run() {
final GeckoApp app = GeckoApp.mAppContext; 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 cacheFile = GeckoAppShell.getCacheDir();
File libxulFile = new File(cacheFile, "libxul.so"); File libxulFile = new File(cacheFile, "libxul.so");
@ -106,18 +96,17 @@ public class GeckoThread extends Thread {
// and then fire us up // and then fire us up
final String activityTitle = title;
app.mMainHandler.post(new Runnable() { app.mMainHandler.post(new Runnable() {
public void run() { public void run() {
app.mBrowserToolbar.setTitle(activityTitle); app.mBrowserToolbar.setTitle(mTitle);
} }
}); });
try { try {
Log.w(LOGTAG, "RunGecko - URI = " + uri); Log.w(LOGTAG, "RunGecko - URI = " + mUri);
GeckoAppShell.runGecko(app.getApplication().getPackageResourcePath(), GeckoAppShell.runGecko(app.getApplication().getPackageResourcePath(),
intent.getStringExtra("args"), mIntent.getStringExtra("args"),
uri); mUri);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOGTAG, "top level exception", e); Log.e(LOGTAG, "top level exception", e);
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();