CameraService: Adds support for longshot mode
- This change introduces additional functionality inside
CameraClient for supporting continuous compressed data
callbacks. This is needed for 'Burst/Long shot' mode
where we could have indefinite number of callbacks after
capture is triggered.
CRs-Fixed: 514199
Change-Id: I8b155e305a836729b071e5388a7046c6347bb9f3
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 8215870..8ff9cb1 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -960,6 +960,7 @@
LOG1("Client::Client E (pid %d, id %d)", callingPid, cameraId);
mRemoteCallback = cameraClient;
+ mLongshotEnabled = false;
cameraService->setCameraBusy(cameraId);
cameraService->loadSound();
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index afad3a4..1864fbb 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -267,11 +267,11 @@
virtual void notifyError();
- // Initialized in constructor
// - The app-side Binder interface to receive callbacks from us
sp<ICameraClient> mRemoteCallback;
+ bool mLongshotEnabled;
}; // class Client
class ProClient : public BnProCameraUser, public BasicClient {
diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp
index 5ab99ba..d557794 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -693,6 +693,12 @@
enableMsgType(CAMERA_MSG_META_DATA);
} else if (cmd == CAMERA_CMD_METADATA_OFF) {
disableMsgType(CAMERA_MSG_META_DATA);
+ } else if ( cmd == CAMERA_CMD_LONGSHOT_ON ) {
+ mLongshotEnabled = true;
+ } else if ( cmd == CAMERA_CMD_LONGSHOT_OFF ) {
+ mLongshotEnabled = false;
+ disableMsgType(CAMERA_MSG_SHUTTER);
+ disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);
#endif
}
@@ -871,7 +877,9 @@
c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
}
- disableMsgType(CAMERA_MSG_SHUTTER);
+ if ( !mLongshotEnabled ) {
+ disableMsgType(CAMERA_MSG_SHUTTER);
+ }
mLock.unlock();
}
@@ -954,7 +962,7 @@
if (mBurstCnt)
mBurstCnt--;
- if (!mBurstCnt) {
+ if (!mBurstCnt && !mLongshotEnabled) {
LOG1("handleCompressedPicture mBurstCnt = %d", mBurstCnt);
#endif
disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);