Merge "PrintSpooler: fix monkey crash if height&width small than 0" am: 4a41744919 am: c970268397

am: a022d0d783

Change-Id: Ie15f031818f735cae40b63775aca1da50892c346
This commit is contained in:
huiwan
2017-08-15 00:55:19 +00:00
committed by android-build-merger

View File

@@ -486,6 +486,12 @@ public final class PageAdapter extends Adapter<ViewHolder> {
loadingContent.layout(0, 0, loadingContent.getMeasuredWidth(),
loadingContent.getMeasuredHeight());
// To create a bitmap, height & width should be larger than 0
if (mPageContentHeight <= 0 || mPageContentWidth <= 0) {
Log.w(LOG_TAG, "Unable to create bitmap, height or width smaller than 0!");
return;
}
Bitmap loadingBitmap = Bitmap.createBitmap(mPageContentWidth, mPageContentHeight,
Bitmap.Config.ARGB_8888);
loadingContent.draw(new Canvas(loadingBitmap));