diff options
author | Zhijun He <zhijunhe@google.com> | 2013-09-25 10:14:30 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2013-09-25 15:36:07 -0700 |
commit | 2b59be89dc245b6e2475d9e8b0c5f2392370e71e (patch) | |
tree | 85564dae05e9343c75e9a5d1f54f7efee4b349f7 /camera | |
parent | d2ac3144e201398340cc5b9bb36e5efe39edd9eb (diff) | |
download | frameworks_av-2b59be89dc245b6e2475d9e8b0c5f2392370e71e.zip frameworks_av-2b59be89dc245b6e2475d9e8b0c5f2392370e71e.tar.gz frameworks_av-2b59be89dc245b6e2475d9e8b0c5f2392370e71e.tar.bz2 |
Camera: Implement getCameraCharacteristics
Bug: 10904541
Bug: 10360518
Change-Id: Ie9ca6b3b0b5f2fe529e6b0decc193096e770a017
Diffstat (limited to 'camera')
-rw-r--r-- | camera/ICameraService.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
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 <camera/ICameraClient.h> #include <camera/camera2/ICameraDeviceUser.h> #include <camera/camera2/ICameraDeviceCallbacks.h> +#include <camera/CameraMetadata.h> 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<ICameraClient>& 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<ICameraClient> cameraClient = |