Fix intent handling

 Bug: 5405096
 If state != null, don't process the intent in getIntent, it will be
 stale

Change-Id: Icc854a1d8f11fdbd60c1f7f854053f2294864b0f
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 602df06..edec96f 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -336,8 +336,11 @@
             // TabControl.restoreState() will create a new tab even if
             // restoring the state fails.
             setActiveTab(mTabControl.getCurrentTab());
-            // Handle the intent
-            mIntentHandler.onNewIntent(intent);
+            // Handle the intent if needed. If icicle != null, we are restoring
+            // and the intent will be stale - ignore it.
+            if (icicle == null) {
+                mIntentHandler.onNewIntent(intent);
+            }
         }
         // Read JavaScript flags if it exists.
         String jsFlags = getSettings().getJsEngineFlags();