diff options
author | Igor Murashkin <iam@google.com> | 2014-07-25 16:54:20 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2014-07-29 15:09:45 -0700 |
commit | bdf366cc70639b0e16b8f84eebe612a48a8b8b06 (patch) | |
tree | 16462c554cb11a21016fbcf032f2519a8cbdead8 | |
parent | 3a3eb157417fb5618518b29d889c23e8831b081c (diff) | |
download | frameworks_base-bdf366cc70639b0e16b8f84eebe612a48a8b8b06.zip frameworks_base-bdf366cc70639b0e16b8f84eebe612a48a8b8b06.tar.gz frameworks_base-bdf366cc70639b0e16b8f84eebe612a48a8b8b06.tar.bz2 |
camera2: Api change (#getFrameNumber -> long; @hide REQUEST_FRAME_COUNT)
Change-Id: I164011c97a57fb9fb9c504ae4c5f394dcb36a4bc
6 files changed, 42 insertions, 19 deletions
diff --git a/api/current.txt b/api/current.txt index 63f546a..7dc9ca2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -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; diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 6cb6a24..dd16f6f 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -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> diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index ebbfc63..9f7ae60 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -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; diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 20a04f0..4f80bc4 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -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); diff --git a/core/java/android/hardware/camera2/TotalCaptureResult.java b/core/java/android/hardware/camera2/TotalCaptureResult.java index 226f09d..ec4bc7d 100644 --- a/core/java/android/hardware/camera2/TotalCaptureResult.java +++ b/core/java/android/hardware/camera2/TotalCaptureResult.java @@ -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); } /** diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index ed4e457..18b1202 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -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() { |