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

Commit bdf366cc authored by Igor Murashkin's avatar Igor Murashkin
Browse files

camera2: Api change (#getFrameNumber -> long; @hide REQUEST_FRAME_COUNT)

Change-Id: I164011c97a57fb9fb9c504ae4c5f394dcb36a4bc
parent 3a3eb157
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -13031,7 +13031,7 @@ package android.hardware.camera2 {
  public class CaptureResult extends android.hardware.camera2.CameraMetadata {
    method public T get(android.hardware.camera2.CaptureResult.Key<T>);
    method public int getFrameNumber();
    method public long getFrameNumber();
    method public android.hardware.camera2.CaptureRequest getRequest();
    method public int getSequenceId();
    field public static final android.hardware.camera2.CaptureResult.Key BLACK_LEVEL_LOCK;
@@ -13077,7 +13077,6 @@ package android.hardware.camera2 {
    field public static final android.hardware.camera2.CaptureResult.Key LENS_OPTICAL_STABILIZATION_MODE;
    field public static final android.hardware.camera2.CaptureResult.Key LENS_STATE;
    field public static final android.hardware.camera2.CaptureResult.Key NOISE_REDUCTION_MODE;
    field public static final android.hardware.camera2.CaptureResult.Key REQUEST_FRAME_COUNT;
    field public static final android.hardware.camera2.CaptureResult.Key REQUEST_PIPELINE_DEPTH;
    field public static final android.hardware.camera2.CaptureResult.Key SCALER_CROP_REGION;
    field public static final android.hardware.camera2.CaptureResult.Key SENSOR_EXPOSURE_TIME;
+1 −1
Original line number Diff line number Diff line
@@ -1934,7 +1934,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
     * android.sync.frameNumber to a non-negative value).</p>
     * <p>This defines the maximum distance (in number of metadata results),
     * between android.sync.frameNumber and the equivalent
     * android.request.frameCount.</p>
     * frame number for that result.</p>
     * <p>In other words this acts as an upper boundary for how many frames
     * must occur before the camera device knows for a fact that the new
     * submitted camera settings have been applied in outgoing frames.</p>
+2 −1
Original line number Diff line number Diff line
@@ -664,7 +664,7 @@ public abstract class CameraMetadata<TKey> {
    /**
     * <p>Every frame has the requests immediately applied.</p>
     * <p>Furthermore for all results,
     * <code>android.sync.frameNumber == android.request.frameCount</code></p>
     * <code>android.sync.frameNumber == CaptureResult#getFrameNumber()</code></p>
     * <p>Changing controls over multiple requests one after another will
     * produce results that have those controls applied atomically
     * each frame.</p>
@@ -679,6 +679,7 @@ public abstract class CameraMetadata<TKey> {
     * <p>By submitting a series of identical requests, the camera device
     * will eventually have the camera settings applied, but it is
     * unknown when that exact point will be.</p>
     * <p>All LEGACY capability devices will have this as their maxLatency.</p>
     * @see CameraCharacteristics#SYNC_MAX_LATENCY
     */
    public static final int SYNC_MAX_LATENCY_UNKNOWN = -1;
+19 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.camera2;

import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.impl.CaptureResultExtras;
import android.hardware.camera2.impl.PublicKey;
import android.hardware.camera2.impl.SyntheticKey;
import android.hardware.camera2.utils.TypeReference;
@@ -142,12 +143,16 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
    private final CameraMetadataNative mResults;
    private final CaptureRequest mRequest;
    private final int mSequenceId;
    private final long mFrameNumber;

    /**
     * Takes ownership of the passed-in properties object
     *
     * <p>For internal use only</p>
     * @hide
     */
    public CaptureResult(CameraMetadataNative results, CaptureRequest parent, int sequenceId) {
    public CaptureResult(CameraMetadataNative results, CaptureRequest parent,
            CaptureResultExtras extras) {
        if (results == null) {
            throw new IllegalArgumentException("results was null");
        }
@@ -156,12 +161,17 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
            throw new IllegalArgumentException("parent was null");
        }

        if (extras == null) {
            throw new IllegalArgumentException("extras was null");
        }

        mResults = CameraMetadataNative.move(results);
        if (mResults.isEmpty()) {
            throw new AssertionError("Results must not be empty");
        }
        mRequest = parent;
        mSequenceId = sequenceId;
        mSequenceId = extras.getRequestId();
        mFrameNumber = extras.getFrameNumber();
    }

    /**
@@ -190,6 +200,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {

        mRequest = null;
        mSequenceId = sequenceId;
        mFrameNumber = -1;
    }

    /**
@@ -288,11 +299,10 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
     * for every new result or failure; and the scope is the lifetime of the
     * {@link CameraDevice}.</p>
     *
     * @return int frame number
     * @return The frame number
     */
    public int getFrameNumber() {
        // TODO: @hide REQUEST_FRAME_COUNT
        return get(REQUEST_FRAME_COUNT);
    public long getFrameNumber() {
        return mFrameNumber;
    }

    /**
@@ -2026,8 +2036,10 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
     * increases with every new result (that is, each new result has a unique
     * frameCount value).</p>
     * <p>Reset on release()</p>
     * @deprecated
     * @hide
     */
    @PublicKey
    @Deprecated
    public static final Key<Integer> REQUEST_FRAME_COUNT =
            new Key<Integer>("android.request.frameCount", int.class);

+4 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.camera2;

import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.impl.CaptureResultExtras;

import java.util.Collections;
import java.util.List;
@@ -51,8 +52,9 @@ public final class TotalCaptureResult extends CaptureResult {
     * Takes ownership of the passed-in properties object
     * @hide
     */
    public TotalCaptureResult(CameraMetadataNative results, CaptureRequest parent, int sequenceId) {
        super(results, parent, sequenceId);
    public TotalCaptureResult(CameraMetadataNative results, CaptureRequest parent,
            CaptureResultExtras extras) {
        super(results, parent, extras);
    }

    /**
Loading