Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf60d9f5 authored by Jay Shrauner's avatar Jay Shrauner Committed by Android (Google) Code Review
Browse files

Merge "Add constructor without zoom"

parents ce7eb6da 85d3eec2
Loading
Loading
Loading
Loading
+42 −29
Original line number Diff line number Diff line
@@ -25,6 +25,16 @@ import android.os.Parcelable;
 */
public final class CameraCapabilities implements Parcelable {

    /**
     * The width of the camera video in pixels.
     */
    private final int mWidth;

    /**
     * The height of the camera video in pixels.
     */
    private final int mHeight;

    /**
     * Whether the camera supports zoom.
     */
@@ -36,28 +46,29 @@ public final class CameraCapabilities implements Parcelable {
    private final float mMaxZoom;

    /**
     * The width of the camera video in pixels.
     */
    private final int mWidth;

    /**
     * The height of the camera video in pixels.
     * Create a call camera capabilities instance that doesn't support zoom.
     *
     * @param width The width of the camera video (in pixels).
     * @param height The height of the camera video (in pixels).
     */
    private final int mHeight;
    public CameraCapabilities(int width, int height) {
        this(width, height, false, 1.0f);
    }

    /**
     * Create a call camera capabilities instance.
     *
     * @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).
     * @param zoomSupported True when camera supports zoom.
     * @param maxZoom Maximum zoom supported by camera.
     * @hide
     */
    public CameraCapabilities(boolean zoomSupported, float maxZoom, int width, int height) {
        mZoomSupported = zoomSupported;
        mMaxZoom = maxZoom;
    public CameraCapabilities(int width, int height, boolean zoomSupported, float maxZoom) {
        mWidth = width;
        mHeight = height;
        mZoomSupported = zoomSupported;
        mMaxZoom = maxZoom;
    }

    /**
@@ -73,12 +84,12 @@ public final class CameraCapabilities implements Parcelable {
                 */
                @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,37 +119,39 @@ public final class CameraCapabilities implements Parcelable {
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte((byte) (isZoomSupported() ? 1 : 0));
        dest.writeFloat(getMaxZoom());
        dest.writeInt(getWidth());
        dest.writeInt(getHeight());
        dest.writeByte((byte) (isZoomSupported() ? 1 : 0));
        dest.writeFloat(getMaxZoom());
    }

    /**
     * Whether the camera supports zoom.
     * The width of the camera video in pixels.
     */
    public boolean isZoomSupported() {
        return mZoomSupported;
    public int getWidth() {
        return mWidth;
    }

    /**
     * The maximum zoom supported by the camera.
     * The height of the camera video in pixels.
     */
    public float getMaxZoom() {
        return mMaxZoom;
    public int getHeight() {
        return mHeight;
    }

    /**
     * The width of the camera video in pixels.
     * Whether the camera supports zoom.
     * @hide
     */
    public int getWidth() {
        return mWidth;
    public boolean isZoomSupported() {
        return mZoomSupported;
    }

    /**
     * The height of the camera video in pixels.
     * The maximum zoom supported by the camera.
     * @hide
     */
    public int getHeight() {
        return mHeight;
    public float getMaxZoom() {
        return mMaxZoom;
    }
}