summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shuzhen Wang <shuzhenwang@google.com> 2022-06-30 23:50:27 +0000
committer Shuzhen Wang <shuzhenwang@google.com> 2022-08-18 01:23:02 +0000
commit572a0642abfce5c3de44a2fb0c5e74f6ad12618a (patch)
tree4e5d6cf162fb3a89f2c4bf5b0de120201d1421eb
parente390016891d1bb34dbdfa50806ccdbd165d25541 (diff)
Handle @format annotation for PixelFormat and ImageFormat
This is to address the lint error when passing a PixelFormat integer to ImageReader.newInstance(). Also add the IntDef for YCBCR_P010. Test: Copy annotations.zip to SDK, and observe no lint error in AS Bug: 176408464 Change-Id: I224190b5124d6871c4ef04dc5086c6d7c91d4daa
-rw-r--r--graphics/java/android/graphics/ImageFormat.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java
index b341a4e27e67..c93b733a3f63 100644
--- a/graphics/java/android/graphics/ImageFormat.java
+++ b/graphics/java/android/graphics/ImageFormat.java
@@ -26,10 +26,21 @@ public class ImageFormat {
@Retention(RetentionPolicy.SOURCE)
@IntDef(value = {
UNKNOWN,
+ /**
+ * Since some APIs accept either ImageFormat or PixelFormat (and the two
+ * enums do not overlap since they're both partial versions of the
+ * internal format enum), add PixelFormat values here so linting
+ * tools won't complain when method arguments annotated with
+ * ImageFormat are provided with PixelFormat values.
+ */
+ PixelFormat.RGBA_8888,
+ PixelFormat.RGBX_8888,
+ PixelFormat.RGB_888,
RGB_565,
YV12,
Y8,
Y16,
+ YCBCR_P010,
NV16,
NV21,
YUY2,