Fixes issues seen when creating new tab

- Fixes issue where the surfaceview
  will be created without blocking.This
  fixes the issue where the new tab creation
  would stall and show white screen.
- Fixes issue seen where the previous
  tab is shown for a split second when
  creating a new tab.

Change-Id: Ibb8d6bbf8fe0c32600610390b30f0a390af7dfc9
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index d83d81d..b5d0a38 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -386,7 +386,12 @@
         if (mAnimScreen == null) {
             mAnimScreen = new AnimScreen(mActivity);
         }
-        mAnimScreen.set(tab.getFullScreenshot());
+        int width = mContentView.getWidth();
+        int height = mContentView.getHeight();
+        Bitmap bm = tab.getFullScreenshot();
+        if (bm == null)
+            bm = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
+        mAnimScreen.set(bm);
         if (mAnimScreen.mMain.getParent() == null) {
             mCustomViewContainer.addView(mAnimScreen.mMain, COVER_SCREEN_PARAMS);
         }
@@ -403,8 +408,6 @@
             toTop = (tab.getWebView() != null) ? tab.getWebView().getVisibleTitleHeight() : 0;
         }
         int toRight = mContentView.getWidth();
-        int width = mContentView.getWidth();
-        int height = mContentView.getHeight();
         int fromLeft = tabview.getLeft() + target.getLeft() - mNavScreen.mScroller.getScrollX();
         int fromTop = tabview.getTop() + target.getTop() - mNavScreen.mScroller.getScrollY();
         int fromRight = fromLeft + target.getDrawable().getIntrinsicWidth();