CameraNDK: implement abortCaptures API
Bug: 27102995
Change-Id: Idaf1db02e0bcc60bb9cdb2797b4479ea0389f5f9
diff --git a/camera/ndk/NdkCameraCaptureSession.cpp b/camera/ndk/NdkCameraCaptureSession.cpp
index ab93bd6..d6eff24 100644
--- a/camera/ndk/NdkCameraCaptureSession.cpp
+++ b/camera/ndk/NdkCameraCaptureSession.cpp
@@ -122,7 +122,16 @@
}
EXPORT
-camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession*) {
+camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session) {
ATRACE_CALL();
- return ACAMERA_OK;
+ if (session == nullptr) {
+ ALOGE("%s: Error: session is null", __FUNCTION__);
+ return ACAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (session->isClosed()) {
+ ALOGE("%s: session %p is already closed", __FUNCTION__, session);
+ return ACAMERA_ERROR_SESSION_CLOSED;
+ }
+ return session->abortCaptures();
}