From 2b59be89dc245b6e2475d9e8b0c5f2392370e71e Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Wed, 25 Sep 2013 10:14:30 -0700 Subject: Camera: Implement getCameraCharacteristics Bug: 10904541 Bug: 10360518 Change-Id: Ie9ca6b3b0b5f2fe529e6b0decc193096e770a017 --- camera/ICameraService.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'camera') diff --git a/camera/ICameraService.cpp b/camera/ICameraService.cpp index 3debe22..5fc89fb 100644 --- a/camera/ICameraService.cpp +++ b/camera/ICameraService.cpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace android { @@ -119,6 +120,29 @@ public: return result; } + // get camera characteristics (static metadata) + virtual status_t getCameraCharacteristics(int cameraId, + CameraMetadata* cameraInfo) { + Parcel data, reply; + data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); + data.writeInt32(cameraId); + remote()->transact(BnCameraService::GET_CAMERA_CHARACTERISTICS, data, &reply); + + if (readExceptionCode(reply)) return -EPROTO; + status_t result = reply.readInt32(); + + CameraMetadata out; + if (reply.readInt32() != 0) { + out.readFromParcel(&reply); + } + + if (cameraInfo != NULL) { + cameraInfo->swap(out); + } + + return result; + } + // connect to camera service (android.hardware.Camera) virtual status_t connect(const sp& cameraClient, int cameraId, const String16 &clientPackageName, int clientUid, @@ -239,6 +263,18 @@ status_t BnCameraService::onTransact( reply->writeInt32(cameraInfo.orientation); return NO_ERROR; } break; + case GET_CAMERA_CHARACTERISTICS: { + CHECK_INTERFACE(ICameraService, data, reply); + CameraMetadata info; + status_t result = getCameraCharacteristics(data.readInt32(), &info); + reply->writeNoException(); + reply->writeInt32(result); + + // out-variables are after exception and return value + reply->writeInt32(1); // means the parcelable is included + info.writeToParcel(reply); + return NO_ERROR; + } break; case CONNECT: { CHECK_INTERFACE(ICameraService, data, reply); sp cameraClient = -- cgit v1.1