Loading api/current.txt +4 −4 Original line number Diff line number Diff line Loading @@ -24014,8 +24014,8 @@ package android.media { method public int getMaxImages(); method public android.view.Surface getSurface(); method public int getWidth(); method public static android.media.ImageReader newInstance(int, int, int, int); method public static android.media.ImageReader newInstance(int, int, int, int, long); method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int); method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long); method public void setOnImageAvailableListener(android.media.ImageReader.OnImageAvailableListener, android.os.Handler); } Loading @@ -24028,8 +24028,8 @@ package android.media { method public android.media.Image dequeueInputImage(); method public int getFormat(); method public int getMaxImages(); method public static android.media.ImageWriter newInstance(android.view.Surface, int); method public static android.media.ImageWriter newInstance(android.view.Surface, int, int); method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int); method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int, int); method public void queueInputImage(android.media.Image); method public void setOnImageReleasedListener(android.media.ImageWriter.OnImageReleasedListener, android.os.Handler); } graphics/java/android/graphics/ImageFormat.java +38 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,43 @@ package android.graphics; import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; public class ImageFormat { /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(value = { UNKNOWN, RGB_565, YV12, Y8, Y16, NV16, NV21, YUY2, JPEG, DEPTH_JPEG, YUV_420_888, YUV_422_888, YUV_444_888, FLEX_RGB_888, FLEX_RGBA_8888, RAW_SENSOR, RAW_PRIVATE, RAW10, RAW12, DEPTH16, DEPTH_POINT_CLOUD, RAW_DEPTH, PRIVATE, HEIC }) public @interface Format { } /* * these constants are chosen to be binary compatible with their previous * location in PixelFormat.java Loading Loading @@ -731,7 +767,7 @@ public class ImageFormat { * @return the number of bits per pixel of the given format or -1 if the * format doesn't exist or is not supported. */ public static int getBitsPerPixel(int format) { public static int getBitsPerPixel(@Format int format) { switch (format) { case RGB_565: return 16; Loading Loading @@ -781,7 +817,7 @@ public class ImageFormat { * * @hide */ public static boolean isPublicFormat(int format) { public static boolean isPublicFormat(@Format int format) { switch (format) { case RGB_565: case NV16: Loading media/java/android/media/ImageReader.java +15 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package android.media; import android.annotation.IntRange; import android.annotation.NonNull; import android.graphics.ImageFormat; import android.graphics.ImageFormat.Format; import android.hardware.HardwareBuffer; import android.hardware.HardwareBuffer.Usage; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -120,7 +124,11 @@ public class ImageReader implements AutoCloseable { * Must be greater than 0. * @see Image */ public static ImageReader newInstance(int width, int height, int format, int maxImages) { public static @NonNull ImageReader newInstance( @IntRange(from = 1) int width, @IntRange(from = 1) int height, @Format int format, @IntRange(from = 1) int maxImages) { // If the format is private don't default to USAGE_CPU_READ_OFTEN since it may not // work, and is inscrutable anyway return new ImageReader(width, height, format, maxImages, Loading Loading @@ -210,8 +218,12 @@ public class ImageReader implements AutoCloseable { * @see Image * @see HardwareBuffer */ public static ImageReader newInstance(int width, int height, int format, int maxImages, long usage) { public static @NonNull ImageReader newInstance( @IntRange(from = 1) int width, @IntRange(from = 1) int height, @Format int format, @IntRange(from = 1) int maxImages, @Usage long usage) { // TODO: Check this - can't do it just yet because format support is different // Unify formats! The only reliable way to validate usage is to just try it and see. Loading media/java/android/media/ImageWriter.java +7 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ package android.media; import android.annotation.IntRange; import android.annotation.NonNull; import android.graphics.ImageFormat; import android.graphics.ImageFormat.Format; import android.graphics.PixelFormat; import android.graphics.Rect; import android.hardware.camera2.utils.SurfaceUtils; Loading Loading @@ -124,7 +127,8 @@ public class ImageWriter implements AutoCloseable { * {@link #dequeueInputImage()}. * @return a new ImageWriter instance. */ public static ImageWriter newInstance(Surface surface, int maxImages) { public static @NonNull ImageWriter newInstance(@NonNull Surface surface, @IntRange(from = 1) int maxImages) { return new ImageWriter(surface, maxImages, ImageFormat.UNKNOWN); } Loading Loading @@ -169,7 +173,8 @@ public class ImageWriter implements AutoCloseable { * * @return a new ImageWriter instance. */ public static ImageWriter newInstance(Surface surface, int maxImages, int format) { public static @NonNull ImageWriter newInstance(@NonNull Surface surface, @IntRange(from = 1) int maxImages, @Format int format) { if (!ImageFormat.isPublicFormat(format) && !PixelFormat.isPublicFormat(format)) { throw new IllegalArgumentException("Invalid format is specified: " + format); } Loading Loading
api/current.txt +4 −4 Original line number Diff line number Diff line Loading @@ -24014,8 +24014,8 @@ package android.media { method public int getMaxImages(); method public android.view.Surface getSurface(); method public int getWidth(); method public static android.media.ImageReader newInstance(int, int, int, int); method public static android.media.ImageReader newInstance(int, int, int, int, long); method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int); method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long); method public void setOnImageAvailableListener(android.media.ImageReader.OnImageAvailableListener, android.os.Handler); } Loading @@ -24028,8 +24028,8 @@ package android.media { method public android.media.Image dequeueInputImage(); method public int getFormat(); method public int getMaxImages(); method public static android.media.ImageWriter newInstance(android.view.Surface, int); method public static android.media.ImageWriter newInstance(android.view.Surface, int, int); method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int); method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int, int); method public void queueInputImage(android.media.Image); method public void setOnImageReleasedListener(android.media.ImageWriter.OnImageReleasedListener, android.os.Handler); }
graphics/java/android/graphics/ImageFormat.java +38 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,43 @@ package android.graphics; import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; public class ImageFormat { /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(value = { UNKNOWN, RGB_565, YV12, Y8, Y16, NV16, NV21, YUY2, JPEG, DEPTH_JPEG, YUV_420_888, YUV_422_888, YUV_444_888, FLEX_RGB_888, FLEX_RGBA_8888, RAW_SENSOR, RAW_PRIVATE, RAW10, RAW12, DEPTH16, DEPTH_POINT_CLOUD, RAW_DEPTH, PRIVATE, HEIC }) public @interface Format { } /* * these constants are chosen to be binary compatible with their previous * location in PixelFormat.java Loading Loading @@ -731,7 +767,7 @@ public class ImageFormat { * @return the number of bits per pixel of the given format or -1 if the * format doesn't exist or is not supported. */ public static int getBitsPerPixel(int format) { public static int getBitsPerPixel(@Format int format) { switch (format) { case RGB_565: return 16; Loading Loading @@ -781,7 +817,7 @@ public class ImageFormat { * * @hide */ public static boolean isPublicFormat(int format) { public static boolean isPublicFormat(@Format int format) { switch (format) { case RGB_565: case NV16: Loading
media/java/android/media/ImageReader.java +15 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package android.media; import android.annotation.IntRange; import android.annotation.NonNull; import android.graphics.ImageFormat; import android.graphics.ImageFormat.Format; import android.hardware.HardwareBuffer; import android.hardware.HardwareBuffer.Usage; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -120,7 +124,11 @@ public class ImageReader implements AutoCloseable { * Must be greater than 0. * @see Image */ public static ImageReader newInstance(int width, int height, int format, int maxImages) { public static @NonNull ImageReader newInstance( @IntRange(from = 1) int width, @IntRange(from = 1) int height, @Format int format, @IntRange(from = 1) int maxImages) { // If the format is private don't default to USAGE_CPU_READ_OFTEN since it may not // work, and is inscrutable anyway return new ImageReader(width, height, format, maxImages, Loading Loading @@ -210,8 +218,12 @@ public class ImageReader implements AutoCloseable { * @see Image * @see HardwareBuffer */ public static ImageReader newInstance(int width, int height, int format, int maxImages, long usage) { public static @NonNull ImageReader newInstance( @IntRange(from = 1) int width, @IntRange(from = 1) int height, @Format int format, @IntRange(from = 1) int maxImages, @Usage long usage) { // TODO: Check this - can't do it just yet because format support is different // Unify formats! The only reliable way to validate usage is to just try it and see. Loading
media/java/android/media/ImageWriter.java +7 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ package android.media; import android.annotation.IntRange; import android.annotation.NonNull; import android.graphics.ImageFormat; import android.graphics.ImageFormat.Format; import android.graphics.PixelFormat; import android.graphics.Rect; import android.hardware.camera2.utils.SurfaceUtils; Loading Loading @@ -124,7 +127,8 @@ public class ImageWriter implements AutoCloseable { * {@link #dequeueInputImage()}. * @return a new ImageWriter instance. */ public static ImageWriter newInstance(Surface surface, int maxImages) { public static @NonNull ImageWriter newInstance(@NonNull Surface surface, @IntRange(from = 1) int maxImages) { return new ImageWriter(surface, maxImages, ImageFormat.UNKNOWN); } Loading Loading @@ -169,7 +173,8 @@ public class ImageWriter implements AutoCloseable { * * @return a new ImageWriter instance. */ public static ImageWriter newInstance(Surface surface, int maxImages, int format) { public static @NonNull ImageWriter newInstance(@NonNull Surface surface, @IntRange(from = 1) int maxImages, @Format int format) { if (!ImageFormat.isPublicFormat(format) && !PixelFormat.isPublicFormat(format)) { throw new IllegalArgumentException("Invalid format is specified: " + format); } Loading