OSDN Git Service

Camera2: Fix missing capture result callback issue
authorZhijun He <zhijunhe@google.com>
Mon, 31 Mar 2014 23:11:33 +0000 (16:11 -0700)
committerZhijun He <zhijunhe@google.com>
Tue, 1 Apr 2014 00:34:29 +0000 (17:34 -0700)
When configuring output right after submitting some capture request, the
waitUntilIdle clears the capture mCaptureListenerMap and
mRepeatingRequestIdDeletedList. This caused the listener is cleared before
the capture result is delivered to application side. Since the listener is
already removed properly, it is really not needed to clear them right after
idling the device.

It also doesn't make sense to add the repeating request id that has no
listener hooked up to the mRepeatingRequestIdDeletedList, this caused
out of sync between id deleted list and the mCaptureListenerMap for
repeating request.

Bug: 13730119
Change-Id: I94ab7a5515f841ffd97b103c2c1b71d92afd955a

core/java/android/hardware/camera2/impl/CameraDevice.java

index 2c8a5c2..ecc461e 100644 (file)
@@ -335,7 +335,9 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
                 mRepeatingRequestId = REQUEST_ID_NONE;
 
                 // Queue for deletion after in-flight requests finish
-                mRepeatingRequestIdDeletedList.add(requestId);
+                if (mCaptureListenerMap.get(requestId) != null) {
+                    mRepeatingRequestIdDeletedList.add(requestId);
+                }
 
                 try {
                     mRemoteDevice.cancelRequest(requestId);
@@ -367,8 +369,6 @@ public class CameraDevice implements android.hardware.camera2.CameraDevice {
             }
 
             mRepeatingRequestId = REQUEST_ID_NONE;
-            mRepeatingRequestIdDeletedList.clear();
-            mCaptureListenerMap.clear();
         }
     }