am c1efd6d8: am 12b57ce6: am 92f2d610: Merge "camera2: Api change (#getFrameNumber -> long; @hide REQUEST_FRAME_COUNT)" into lmp-dev

* commit 'c1efd6d8e9f69eac39bec309b76514afcb401fcb':
  camera2: Api change (#getFrameNumber -> long; @hide REQUEST_FRAME_COUNT)
This commit is contained in:
Igor Murashkin
2014-07-30 14:28:03 +00:00
committed by Android Git Automerger
6 changed files with 42 additions and 19 deletions

View File

@@ -13029,7 +13029,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;
@@ -13075,7 +13075,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;

View File

@@ -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>

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}
/**

View File

@@ -313,6 +313,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
return mCameraId;
}
@Override
public void configureOutputs(List<Surface> outputs) throws CameraAccessException {
// Treat a null input the same an empty list
if (outputs == null) {
@@ -448,6 +449,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
}
}
@Override
public int capture(CaptureRequest request, CaptureListener listener, Handler handler)
throws CameraAccessException {
if (DEBUG) {
@@ -458,6 +460,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
return submitCaptureRequest(requestList, listener, handler, /*streaming*/false);
}
@Override
public int captureBurst(List<CaptureRequest> requests, CaptureListener listener,
Handler handler) throws CameraAccessException {
if (requests == null || requests.isEmpty()) {
@@ -610,6 +613,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
}
}
@Override
public int setRepeatingRequest(CaptureRequest request, CaptureListener listener,
Handler handler) throws CameraAccessException {
List<CaptureRequest> requestList = new ArrayList<CaptureRequest>();
@@ -617,6 +621,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
return submitCaptureRequest(requestList, listener, handler, /*streaming*/true);
}
@Override
public int setRepeatingBurst(List<CaptureRequest> requests, CaptureListener listener,
Handler handler) throws CameraAccessException {
if (requests == null || requests.isEmpty()) {
@@ -625,6 +630,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
return submitCaptureRequest(requests, listener, handler, /*streaming*/true);
}
@Override
public void stopRepeating() throws CameraAccessException {
synchronized(mInterfaceLock) {
@@ -675,6 +681,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
}
}
@Override
public void flush() throws CameraAccessException {
synchronized(mInterfaceLock) {
checkIfCameraClosedOrInError();
@@ -1031,8 +1038,10 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
CaptureResultExtras resultExtras) throws RemoteException {
int requestId = resultExtras.getRequestId();
long frameNumber = resultExtras.getFrameNumber();
if (DEBUG) {
Log.v(TAG, "Received result frame " + resultExtras.getFrameNumber() + " for id "
Log.v(TAG, "Received result frame " + frameNumber + " for id "
+ requestId);
}
@@ -1051,7 +1060,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
// Update tracker (increment counter) when it's not a partial result.
if (!isPartialResult) {
mFrameNumberTracker.updateTracker(resultExtras.getFrameNumber(),
mFrameNumberTracker.updateTracker(frameNumber,
/*error*/false);
}
@@ -1060,7 +1069,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
if (DEBUG) {
Log.d(TAG,
"holder is null, early return at frame "
+ resultExtras.getFrameNumber());
+ frameNumber);
}
return;
}
@@ -1069,7 +1078,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
if (DEBUG) {
Log.d(TAG,
"camera is closed, early return at frame "
+ resultExtras.getFrameNumber());
+ frameNumber);
}
return;
}
@@ -1082,7 +1091,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
// Either send a partial result or the final capture completed result
if (isPartialResult) {
final CaptureResult resultAsCapture =
new CaptureResult(result, request, requestId);
new CaptureResult(result, request, resultExtras);
// Partial result
resultDispatch = new Runnable() {
@@ -1098,7 +1107,7 @@ public class CameraDeviceImpl extends android.hardware.camera2.CameraDevice {
};
} else {
final TotalCaptureResult resultAsCapture =
new TotalCaptureResult(result, request, requestId);
new TotalCaptureResult(result, request, resultExtras);
// Final capture result
resultDispatch = new Runnable() {