fixed multiple tabs selected bug, open new tab to home page
http://b/issue?id=2975213

Change-Id: I21c37cb54ab309568386e0bc5f83a30bb16779b8
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 9f1f3ba..d69140f 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -1317,7 +1317,6 @@
         // doesn't come for action bar buttons
         if (item.getItemId() == R.id.newtab) {
             openTabToHomePage();
-            mHandler.sendMessage(mHandler.obtainMessage(OPEN_BOOKMARKS));
             return true;
         }
         if (!mCanChord) {
diff --git a/src/com/android/browser/TabScrollView.java b/src/com/android/browser/TabScrollView.java
index 13abb50..b411416 100644
--- a/src/com/android/browser/TabScrollView.java
+++ b/src/com/android/browser/TabScrollView.java
@@ -113,6 +113,12 @@
     }
 
     void removeTab(View tab) {
+        int ix = mContentView.indexOfChild(tab);
+        if (ix == mSelected) {
+            mSelected = -1;
+        } else if (ix < mSelected) {
+            mSelected--;
+        }
         mContentView.removeView(tab);
     }