Ensure picture isn't recording in createBitmap

Picture#draw() will silently due an #endRecording() if it
wasn't called. Bitmap.createBitmap doesn't do this until
after it's too late.

So do an up-front #endRecording() to ensure state is
good to go

Bug: 80539264
Test: HardwareBitmapTests#testReadbackThroughPictureNoEndRecording
Change-Id: Ic66c41462e88880b73c5093d7541c4ce3d71adeb
This commit is contained in:
John Reck
2018-06-01 12:39:50 -07:00
parent 1031bf5f76
commit 44fc6317f1
2 changed files with 4 additions and 0 deletions

View File

@@ -1232,6 +1232,7 @@ public final class Bitmap implements Parcelable {
if (config == null) {
throw new IllegalArgumentException("Config must not be null");
}
source.endRecording();
if (source.requiresHardwareAcceleration() && config != Config.HARDWARE) {
StrictMode.noteSlowCall("GPU readback");
}