Merge "Camera: Avoid removing valid repeating requests"
diff --git a/core/java/android/hardware/camera2/legacy/RequestQueue.java b/core/java/android/hardware/camera2/legacy/RequestQueue.java
index 407e5e6..fb44402 100644
--- a/core/java/android/hardware/camera2/legacy/RequestQueue.java
+++ b/core/java/android/hardware/camera2/legacy/RequestQueue.java
@@ -30,7 +30,7 @@
public class RequestQueue {
private static final String TAG = "RequestQueue";
- private static final long INVALID_FRAME = -1;
+ public static final long INVALID_FRAME = -1;
private BurstHolder mRepeatingRequest = null;
private final ArrayDeque<BurstHolder> mRequestQueue = new ArrayDeque<BurstHolder>();
diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
index 690df1a..c1091c6 100644
--- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
+++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
@@ -948,8 +948,13 @@
Log.d(TAG, "Stopped repeating request. Last frame number is " +
lastFrameNumber);
}
- mDeviceState.setRepeatingRequestError(lastFrameNumber,
- burstHolder.getRequestId());
+ if (lastFrameNumber != RequestQueue.INVALID_FRAME) {
+ mDeviceState.setRepeatingRequestError(lastFrameNumber,
+ burstHolder.getRequestId());
+ } else {
+ Log.e(TAG, "Repeating request id: " + burstHolder.getRequestId() +
+ " already canceled!");
+ }
}
if (DEBUG) {