From e7c158f1148ddd774e33a33ff3db216726b04f5c Mon Sep 17 00:00:00 2001 From: Yin-Chia Yeh Date: Tue, 19 Feb 2019 15:52:08 -0800 Subject: Add annotations for ImageReader/ImageWriter factory methods Test: make update-api && make Bug: 124766727 Change-Id: I7f7c5afd013370ab6e42c28b96b3cfa93e8dc615 --- graphics/java/android/graphics/ImageFormat.java | 40 +++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'graphics/java') diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java index 62647741dcfa..15d855e9560c 100644 --- a/graphics/java/android/graphics/ImageFormat.java +++ b/graphics/java/android/graphics/ImageFormat.java @@ -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 @@ -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; @@ -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: -- cgit v1.2.3-59-g8ed1b