Fixes to Edge Navigation for missing bitmaps

- Show prominent color from favicon when bitmap capture of a
  navigation entry is missing
- More active purging of bitmaps on navigation

Change-Id: I2c137385bd1b1179dbbb16c0c3e933783d499c34
diff --git a/src/com/android/browser/EdgeSwipeView.java b/src/com/android/browser/EdgeSwipeView.java
index a777c26..bce8aef 100644
--- a/src/com/android/browser/EdgeSwipeView.java
+++ b/src/com/android/browser/EdgeSwipeView.java
@@ -135,10 +135,10 @@
         return (mViewGroup.getHeight() < mViewGroup.getWidth());
     }
 
-    private void setBitmap(ImageView view, Bitmap bitmap) {
+    private void setBitmap(ImageView view, Bitmap bitmap, int color) {
         clampViewIfNeeded(view);
         if (bitmap == null) {
-            bitmap = getColorBitmap(Color.DKGRAY);
+            bitmap = getColorBitmap(color);
         }
 
         int offset = 0;
@@ -146,6 +146,12 @@
             offset = mTitleBar.getNavigationBar().getMeasuredHeight();
         }
 
+        if ((view.getMeasuredHeight() > view.getMeasuredWidth()) !=
+                (bitmap.getHeight() > bitmap.getWidth())) {
+            view.setImageBitmap(bitmap);
+            return;
+        }
+
         int bitmap_height = bitmap.getHeight();
 
         if (view.getMeasuredHeight() != 0) {
@@ -161,18 +167,18 @@
         }
     }
 
-    public void setStationaryViewBitmap(Bitmap bitmap) {
+    public void setStationaryViewBitmap(Bitmap bitmap, int color) {
         mbStationaryViewBMSet = null != bitmap;
-        setBitmap(mStationaryView, bitmap);
+        setBitmap(mStationaryView, bitmap, color);
     }
 
     public void setStationaryViewAlpha(float alpha) {
         mStationaryView.setAlpha(alpha);
     }
 
-    public void setSlidingViewBitmap(Bitmap bitmap) {
+    public void setSlidingViewBitmap(Bitmap bitmap, int color) {
         mbSlidingViewBMSet = null != bitmap;
-        setBitmap(mSlidingView, bitmap);
+        setBitmap(mSlidingView, bitmap, color);
     }
 
     public boolean slidingViewHasImage() {