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
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index e8ede94..95a0c56 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -1232,6 +1232,7 @@
         if (config == null) {
             throw new IllegalArgumentException("Config must not be null");
         }
+        source.endRecording();
         if (source.requiresHardwareAcceleration() && config != Config.HARDWARE) {
             StrictMode.noteSlowCall("GPU readback");
         }
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index d01ff6f..ac38697 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -123,6 +123,9 @@
      * drawn to a hardware-accelerated canvas. If this returns true then this Picture can only
      * be drawn to another Picture or to a Canvas where canvas.isHardwareAccelerated() is true.
      *
+     * Note this value is only updated after recording has finished by a call to
+     * {@link #endRecording()}. Prior to that it will be the default value of false.
+     *
      * @return true if the Picture can only be drawn to a hardware-accelerated canvas,
      *         false otherwise.
      */