Add Camera.getSupportedThumbnailSizes() and Size.equals().
bug:2375986
diff --git a/api/current.xml b/api/current.xml
index 85908c1..9f92b73 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -70360,6 +70360,17 @@
visibility="public"
>
</method>
+<method name="getSupportedJpegThumbnailSizes"
+ return="java.util.List<android.hardware.Camera.Size>"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getSupportedPictureFormats"
return="java.util.List<java.lang.Integer>"
abstract="false"
@@ -340828,7 +340839,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="f" type="java.io.File">
+<parameter name="uri" type="java.lang.String">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
@@ -340845,7 +340856,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="uri" type="java.lang.String">
+<parameter name="f" type="java.io.File">
</parameter>
<exception name="IOException" type="java.io.IOException">
</exception>
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index abb74cd..82012b0 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -658,6 +658,25 @@
width = w;
height = h;
}
+ /**
+ * Compares {@code obj} to this size.
+ *
+ * @param obj the object to compare this size with.
+ * @return {@code true} if the width and height of {@code obj} is the
+ * same as those of this size. {@code false} otherwise.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Size)) {
+ return false;
+ }
+ Size s = (Size) obj;
+ return width == s.width && height == s.height;
+ }
+ @Override
+ public int hashCode() {
+ return width * 32713 + height;
+ }
/** width of the picture */
public int width;
/** height of the picture */
@@ -685,6 +704,7 @@
private static final String KEY_PREVIEW_FRAME_RATE = "preview-frame-rate";
private static final String KEY_PICTURE_SIZE = "picture-size";
private static final String KEY_PICTURE_FORMAT = "picture-format";
+ private static final String KEY_JPEG_THUMBNAIL_SIZE = "jpeg-thumbnail-size";
private static final String KEY_JPEG_THUMBNAIL_WIDTH = "jpeg-thumbnail-width";
private static final String KEY_JPEG_THUMBNAIL_HEIGHT = "jpeg-thumbnail-height";
private static final String KEY_JPEG_THUMBNAIL_QUALITY = "jpeg-thumbnail-quality";
@@ -954,7 +974,9 @@
}
/**
- * Sets the dimensions for EXIF thumbnail in Jpeg picture.
+ * Sets the dimensions for EXIF thumbnail in Jpeg picture. If
+ * applications set both width and height to 0, EXIF will not contain
+ * thumbnail.
*
* @param width the width of the thumbnail, in pixels
* @param height the height of the thumbnail, in pixels
@@ -976,6 +998,18 @@
}
/**
+ * Gets the supported jpeg thumbnail sizes.
+ *
+ * @return a List of Size object. This method will always return a list
+ * with at least two elements. Size 0,0 (no thumbnail) is always
+ * supported.
+ */
+ public List<Size> getSupportedJpegThumbnailSizes() {
+ String str = get(KEY_JPEG_THUMBNAIL_SIZE + SUPPORTED_VALUES_SUFFIX);
+ return splitSize(str);
+ }
+
+ /**
* Sets the quality of the EXIF thumbnail in Jpeg picture.
*
* @param quality the JPEG quality of the EXIF thumbnail. The range is 1