DO NOT MERGE Add constructor without zoom
Add constructor without zoom params. Reorder params in constructor
with zoom to move zoom params to the end of the param list (API
guidelines). Reorder code to match param ordering. Tag all zoom related
methods with @hide.
Bug:20160534
Change-Id: Ic2149af82a5450666c49b8757daf6950bcb68977
diff --git a/telecomm/java/android/telecom/CameraCapabilities.java b/telecomm/java/android/telecom/CameraCapabilities.java
index f968c13..6eaf6a2 100644
--- a/telecomm/java/android/telecom/CameraCapabilities.java
+++ b/telecomm/java/android/telecom/CameraCapabilities.java
@@ -26,16 +26,6 @@
public final class CameraCapabilities implements Parcelable {
/**
- * Whether the camera supports zoom.
- */
- private final boolean mZoomSupported;
-
- /**
- * The maximum zoom supported by the camera.
- */
- private final float mMaxZoom;
-
- /**
* The width of the camera video in pixels.
*/
private final int mWidth;
@@ -46,18 +36,39 @@
private final int mHeight;
/**
- * Create a call camera capabilities instance.
+ * Whether the camera supports zoom.
+ */
+ private final boolean mZoomSupported;
+
+ /**
+ * The maximum zoom supported by the camera.
+ */
+ private final float mMaxZoom;
+
+ /**
+ * Create a call camera capabilities instance that doesn't support zoom.
*
- * @param zoomSupported True when camera supports zoom.
- * @param maxZoom Maximum zoom supported by camera.
* @param width The width of the camera video (in pixels).
* @param height The height of the camera video (in pixels).
*/
- public CameraCapabilities(boolean zoomSupported, float maxZoom, int width, int height) {
- mZoomSupported = zoomSupported;
- mMaxZoom = maxZoom;
+ public CameraCapabilities(int width, int height) {
+ this(width, height, false, 1.0f);
+ }
+
+ /**
+ * Create a call camera capabilities instance.
+ *
+ * @param width The width of the camera video (in pixels).
+ * @param height The height of the camera video (in pixels).
+ * @param zoomSupported True when camera supports zoom.
+ * @param maxZoom Maximum zoom supported by camera.
+ * @hide
+ */
+ public CameraCapabilities(int width, int height, boolean zoomSupported, float maxZoom) {
mWidth = width;
mHeight = height;
+ mZoomSupported = zoomSupported;
+ mMaxZoom = maxZoom;
}
/**
@@ -73,12 +84,12 @@
*/
@Override
public CameraCapabilities createFromParcel(Parcel source) {
- boolean supportsZoom = source.readByte() != 0;
- float maxZoom = source.readFloat();
int width = source.readInt();
int height = source.readInt();
+ boolean supportsZoom = source.readByte() != 0;
+ float maxZoom = source.readFloat();
- return new CameraCapabilities(supportsZoom, maxZoom, width, height);
+ return new CameraCapabilities(width, height, supportsZoom, maxZoom);
}
@Override
@@ -108,24 +119,10 @@
*/
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeByte((byte) (isZoomSupported() ? 1 : 0));
- dest.writeFloat(getMaxZoom());
dest.writeInt(getWidth());
dest.writeInt(getHeight());
- }
-
- /**
- * Whether the camera supports zoom.
- */
- public boolean isZoomSupported() {
- return mZoomSupported;
- }
-
- /**
- * The maximum zoom supported by the camera.
- */
- public float getMaxZoom() {
- return mMaxZoom;
+ dest.writeByte((byte) (isZoomSupported() ? 1 : 0));
+ dest.writeFloat(getMaxZoom());
}
/**
@@ -141,4 +138,20 @@
public int getHeight() {
return mHeight;
}
+
+ /**
+ * Whether the camera supports zoom.
+ * @hide
+ */
+ public boolean isZoomSupported() {
+ return mZoomSupported;
+ }
+
+ /**
+ * The maximum zoom supported by the camera.
+ * @hide
+ */
+ public float getMaxZoom() {
+ return mMaxZoom;
+ }
}