OSDN Git Service

If we get web search request in onCreate, just finish the
authorGrace Kloba <klobag@google.com>
Thu, 24 Sep 2009 04:37:25 +0000 (21:37 -0700)
committerGrace Kloba <klobag@google.com>
Thu, 24 Sep 2009 16:39:13 +0000 (09:39 -0700)
current activity. Otherwise it puts the BrowserActivity in
a bad state where there is no current tab.

Fix http://b/issue?id=2142368

src/com/android/browser/BrowserActivity.java

index 8e70355..e5434ed 100644 (file)
@@ -305,6 +305,13 @@ public class BrowserActivity extends Activity
 
         mResolver = getContentResolver();
 
+        // If this was a web search request, pass it on to the default web
+        // search provider and finish this activity.
+        if (handleWebSearchIntent(getIntent())) {
+            finish();
+            return;
+        }
+
         //
         // start MASF proxy service
         //
@@ -412,12 +419,6 @@ public class BrowserActivity extends Activity
         };
         registerReceiver(mPackageInstallationReceiver, filter);
 
-        // If this was a web search request, pass it on to the default web search provider.
-        if (handleWebSearchIntent(getIntent())) {
-            moveTaskToBack(true);
-            return;
-        }
-
         if (!mTabControl.restoreState(icicle)) {
             // clear up the thumbnail directory if we can't restore the state as
             // none of the files in the directory are referenced any more.
@@ -1095,6 +1096,9 @@ public class BrowserActivity extends Activity
             Log.v(LOGTAG, "BrowserActivity.onDestroy: this=" + this);
         }
         super.onDestroy();
+
+        if (mTabControl == null) return;
+
         // Remove the current tab and sub window
         TabControl.Tab t = mTabControl.getCurrentTab();
         if (t != null) {