summaryrefslogtreecommitdiffstats
path: root/libs/ui/Camera.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ui/Camera.cpp')
-rw-r--r--libs/ui/Camera.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp
index b3cbda1..41577c4 100644
--- a/libs/ui/Camera.cpp
+++ b/libs/ui/Camera.cpp
@@ -64,15 +64,22 @@ Camera::Camera()
init();
}
-Camera::Camera(const sp<ICamera>& camera)
+// construct a camera client from an existing camera remote
+sp<Camera> Camera::create(const sp<ICamera>& camera)
{
- init();
- // connect this client to existing camera remote
- if (camera->connect(this) == NO_ERROR) {
- mStatus = NO_ERROR;
- mCamera = camera;
- camera->asBinder()->linkToDeath(this);
+ LOGV("create");
+ if (camera == 0) {
+ LOGE("camera remote is a NULL pointer");
+ return 0;
+ }
+
+ sp<Camera> c = new Camera();
+ if (camera->connect(c) == NO_ERROR) {
+ c->mStatus = NO_ERROR;
+ c->mCamera = camera;
+ camera->asBinder()->linkToDeath(c);
}
+ return c;
}
void Camera::init()