Fix blank bitmaps in tab switcher
- Tab switcher was showing white bitmaps when
a link was opened in new tab.
CR-Fixed: SWE-5690
Change-Id: I4dead264e4332196af3fcfd3ad049d9e09d2b798
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index d3ce38c..f1444c8 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -182,6 +182,7 @@
private int mCaptureWidth;
private int mCaptureHeight;
private Bitmap mCapture;
+ private Bitmap mViewportCapture;
private Handler mHandler;
private boolean mUpdateThumbnail;
private Timestamp timestamp;
@@ -738,8 +739,6 @@
mWebViewController.attachSubWindow(Tab.this);
transport.setWebView(mSubView);
} else {
- capture();
-
final Tab newTab = mWebViewController.openTab(url,
Tab.this, true, true);
// This is special case for rendering links on a webpage in
@@ -1951,13 +1950,21 @@
updateListener.onThumbnailUpdated(this);
}
}
+
+ if (mViewportCapture != null) {
+ mWebViewController.onThumbnailCapture(mViewportCapture);
+ mViewportCapture.recycle();
+ mViewportCapture = null;
+ } else {
+ mWebViewController.onThumbnailCapture(mCapture);
+ }
}
protected void capture() {
if (mMainView == null || mCapture == null || !mMainView.isReady() ||
mMainView.getContentWidth() <= 0 || mMainView.getContentHeight() <= 0 ||
!mFirstVisualPixelPainted || mMainView.isShowingCrashView()) {
-
+ mViewportCapture = null;
initCaptureBitmap();
thumbnailUpdated();
return;
@@ -1967,6 +1974,8 @@
new ValueCallback<Bitmap>() {
@Override
public void onReceiveValue(Bitmap bitmap) {
+ mViewportCapture = bitmap;
+
if (mCapture == null) {
initCaptureBitmap();
}