summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2015-04-14 13:43:47 -0700
committerRuben Brunk <rubenbrunk@google.com>2015-04-15 12:15:30 -0700
commita485dfec4ad98283b911cf983566b0ce947343b6 (patch)
tree5702364ebfaa73e3b4956260ae623587272bc74e /services
parent4f9576bf48c5909782c12490e8a9faa974ae68d6 (diff)
downloadframeworks_av-a485dfec4ad98283b911cf983566b0ce947343b6.zip
frameworks_av-a485dfec4ad98283b911cf983566b0ce947343b6.tar.gz
frameworks_av-a485dfec4ad98283b911cf983566b0ce947343b6.tar.bz2
camera: Actually pass device errors to client for Camera2Device.
Bug: 19186859 Change-Id: Ib58588dfd99956b719c34e62c596ea604d97edcb
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/api1/Camera2Client.cpp34
-rw-r--r--services/camera/libcameraservice/api1/Camera2Client.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index 6f44aee..44977da 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -1709,6 +1709,40 @@ status_t Camera2Client::commandSetVideoBufferCountL(size_t count) {
return mStreamingProcessor->setRecordingBufferCount(count);
}
+void Camera2Client::notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
+ const CaptureResultExtras& resultExtras) {
+ int32_t err = CAMERA_ERROR_UNKNOWN;
+ switch(errorCode) {
+ case ICameraDeviceCallbacks::ERROR_CAMERA_DISCONNECTED:
+ err = CAMERA_ERROR_RELEASED;
+ break;
+ case ICameraDeviceCallbacks::ERROR_CAMERA_DEVICE:
+ err = CAMERA_ERROR_UNKNOWN;
+ break;
+ case ICameraDeviceCallbacks::ERROR_CAMERA_SERVICE:
+ err = CAMERA_ERROR_SERVER_DIED;
+ break;
+ case ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST:
+ case ICameraDeviceCallbacks::ERROR_CAMERA_RESULT:
+ case ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER:
+ ALOGW("%s: Received recoverable error %d from HAL - ignoring, requestId %" PRId32,
+ __FUNCTION__, errorCode, resultExtras.requestId);
+ return;
+ default:
+ err = CAMERA_ERROR_UNKNOWN;
+ break;
+ }
+
+ ALOGE("%s: Error condition %d reported by HAL, requestId %" PRId32, __FUNCTION__, errorCode,
+ resultExtras.requestId);
+
+ SharedCameraCallbacks::Lock l(mSharedCameraCallbacks);
+ if (l.mRemoteCallback != nullptr) {
+ l.mRemoteCallback->notifyCallback(CAMERA_MSG_ERROR, err, 0);
+ }
+}
+
+
/** Device-related methods */
void Camera2Client::notifyAutoFocus(uint8_t newState, int triggerId) {
ALOGV("%s: Autofocus state now %d, last trigger %d",
diff --git a/services/camera/libcameraservice/api1/Camera2Client.h b/services/camera/libcameraservice/api1/Camera2Client.h
index 5a8241f..a988037 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.h
+++ b/services/camera/libcameraservice/api1/Camera2Client.h
@@ -77,6 +77,8 @@ public:
virtual status_t setParameters(const String8& params);
virtual String8 getParameters() const;
virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
+ virtual void notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
+ const CaptureResultExtras& resultExtras);
/**
* Interface used by CameraService