Reland "Add an SkImageGenerator that uses NDK APIs"

This reverts commit 07438b0cdaa326d5e4b969e03bfb67e0c8066f13.

Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: I4ca07d832dbd6a9d8cff0faea975fd70da00718f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308185
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 4d5380d..61f7beb 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -820,6 +820,13 @@
   ]
 }
 
+optional("ndk_decode") {
+  enabled = skia_use_ndk_decode
+  public_defines = [ "SK_ENABLE_NDK_DECODING" ]
+  sources = [ "src/ports/SkImageGeneratorNDK.cpp" ]
+  libs = [ "jnigraphics" ]
+}
+
 optional("pdf") {
   enabled = skia_use_zlib && skia_enable_pdf
   public_defines = [ "SK_SUPPORT_PDF" ]
@@ -1044,6 +1051,7 @@
     ":hsw",
     ":jpeg_decode",
     ":jpeg_encode",
+    ":ndk_decode",
     ":none",
     ":png_decode",
     ":png_encode",