Camera: Switch camera2 to auto-gen C++ binder interfaces
- Move camera service AIDL files to frameworks/av
- Build C++ interface stubs with AIDL tools
- Add necessary native-side parcelables and update existing ones
- Remove manually-written stubs, rearrange remaining manual stubs
- Adjust implementations to work with auto-generated stubs
- Adjust method signatures for auto-gen differences
- Add rich error messages using binder::Status
Bug: 25091611
Change-Id: I6f69f34b9d1a3f8d1fb7db87357363f8fa8483ff
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.cpp b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
index 4a812b4..2cc150d 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
@@ -169,14 +169,15 @@
template <typename TClientBase>
-void Camera2ClientBase<TClientBase>::disconnect() {
+binder::Status Camera2ClientBase<TClientBase>::disconnect() {
ATRACE_CALL();
Mutex::Autolock icl(mBinderSerializationLock);
+ binder::Status res = binder::Status::ok();
// Allow both client and the media server to disconnect at all times
int callingPid = getCallingPid();
if (callingPid != TClientBase::mClientPid &&
- callingPid != TClientBase::mServicePid) return;
+ callingPid != TClientBase::mServicePid) return res;
ALOGV("Camera %d: Shutting down", TClientBase::mCameraId);
@@ -185,6 +186,8 @@
CameraService::BasicClient::disconnect();
ALOGV("Camera %d: Shut down complete complete", TClientBase::mCameraId);
+
+ return res;
}
template <typename TClientBase>
@@ -228,7 +231,7 @@
template <typename TClientBase>
void Camera2ClientBase<TClientBase>::notifyError(
- ICameraDeviceCallbacks::CameraErrorCode errorCode,
+ int32_t errorCode,
const CaptureResultExtras& resultExtras) {
ALOGE("Error condition %d reported by HAL, requestId %" PRId32, errorCode,
resultExtras.requestId);
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.h b/services/camera/libcameraservice/common/Camera2ClientBase.h
index 81bae7b..6eea2f4 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.h
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.h
@@ -38,8 +38,8 @@
/**
* Base binder interface (see ICamera/ICameraDeviceUser for details)
*/
- virtual status_t connect(const sp<TCamCallbacks>& callbacks);
- virtual void disconnect();
+ virtual status_t connect(const sp<TCamCallbacks>& callbacks);
+ virtual binder::Status disconnect();
/**
* Interface used by CameraService
@@ -63,7 +63,7 @@
* CameraDeviceBase::NotificationListener implementation
*/
- virtual void notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
+ virtual void notifyError(int32_t errorCode,
const CaptureResultExtras& resultExtras);
virtual void notifyIdle();
virtual void notifyShutter(const CaptureResultExtras& resultExtras,
diff --git a/services/camera/libcameraservice/common/CameraDeviceBase.h b/services/camera/libcameraservice/common/CameraDeviceBase.h
index 6fd2b39..ccb3bc8 100644
--- a/services/camera/libcameraservice/common/CameraDeviceBase.h
+++ b/services/camera/libcameraservice/common/CameraDeviceBase.h
@@ -24,7 +24,6 @@
#include <utils/Timers.h>
#include <utils/List.h>
-#include <camera/camera2/ICameraDeviceCallbacks.h>
#include "hardware/camera2.h"
#include "hardware/camera3.h"
#include "camera/CameraMetadata.h"
@@ -32,6 +31,7 @@
#include "common/CameraModule.h"
#include "gui/IGraphicBufferProducer.h"
#include "device3/Camera3StreamInterface.h"
+#include "binder/Status.h"
namespace android {
@@ -195,7 +195,7 @@
// API1 and API2.
// Required for API 1 and 2
- virtual void notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
+ virtual void notifyError(int32_t errorCode,
const CaptureResultExtras &resultExtras) = 0;
// Required only for API2