Fixed favicon bug

  Bug: 2955542
  Fixed a bug where navigating from a site with a favicon to a site
  without a favicon displayed the old site's favicon instead of a
  generic icon.

Change-Id: I830706166283d2ae425f4a9680cdbb4ef31b1de9
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 36566c1..910f753 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -510,7 +510,7 @@
                 mActivity.onPageStarted(view, url, favicon);
             }
             if (getTabChangeListener() != null) {
-                getTabChangeListener().onPageStarted(Tab.this);
+                getTabChangeListener().onPageStarted(Tab.this, favicon);
             }
         }
 
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index b2c687d..9d58675 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -68,6 +68,8 @@
     private boolean mTitleVisible;
     private boolean mShowUrlMode;
 
+    private Drawable mGenericFavicon;
+
     public TabBar(BrowserActivity context, TabControl tabcontrol, TitleBarXLarge titlebar) {
         super(context);
         Resources res = context.getResources();
@@ -86,6 +88,7 @@
         mTabs = (TabScrollView) findViewById(R.id.tabs);
         mNewTab = (ImageButton) findViewById(R.id.newtab);
         mNewTab.setOnClickListener(this);
+        mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
 
         // TODO: Change enabled states based on whether you can go
         // back/forward.  Probably should be done inside onPageStarted.
@@ -365,7 +368,7 @@
             array[0] = new PaintDrawable(Color.BLACK);
             array[1] = new PaintDrawable(Color.WHITE);
             if (icon == null) {
-//                array[2] = mGenericFavicon;
+                array[2] = mGenericFavicon;
             } else {
                 array[2] = new BitmapDrawable(icon);
             }
@@ -441,7 +444,11 @@
     }
 
     @Override
-    public void onPageStarted(Tab tab) {
+    public void onPageStarted(Tab tab, Bitmap favicon) {
+        TabViewData tvd = mTabMap.get(tab);
+        if (tvd != null) {
+            tvd.setFavicon(favicon);
+        }
     }
 
 
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 294e750..55bfb48 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -695,7 +695,7 @@
 
         public void onFavicon(Tab tab, Bitmap favicon);
 
-        public void onPageStarted(Tab tab);
+        public void onPageStarted(Tab tab, Bitmap favicon);
 
         public void onPageFinished(Tab tab);