summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2009-04-27 12:01:59 -0700
committerJames Dong <jdong@google.com>2009-04-27 12:01:59 -0700
commitd2dc9ac87bbdbbe465a0a07b63843282fb28eee7 (patch)
tree81353fd56e648c945020fd67bdb770d9a5edcba4
parent9d206fa56f77ae6c32bf5144db4f95b0a6cfcb62 (diff)
downloadframeworks_native-d2dc9ac87bbdbbe465a0a07b63843282fb28eee7.zip
frameworks_native-d2dc9ac87bbdbbe465a0a07b63843282fb28eee7.tar.gz
frameworks_native-d2dc9ac87bbdbbe465a0a07b63843282fb28eee7.tar.bz2
Bug fix(1807910): media recorder crash due to the use of locked camera object (last part)
- remove an unused Camera constructor - add a check on the argument in Camera::create() method
-rw-r--r--include/ui/Camera.h1
-rw-r--r--libs/ui/Camera.cpp20
2 files changed, 7 insertions, 14 deletions
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
index 12fa20f..fd851d9 100644
--- a/include/ui/Camera.h
+++ b/include/ui/Camera.h
@@ -78,7 +78,6 @@ class Camera : public BnCameraClient, public IBinder::DeathRecipient
{
public:
// construct a camera client from an existing remote
- Camera(const sp<ICamera>& camera); // to be removed
static sp<Camera> create(const sp<ICamera>& camera);
static sp<Camera> connect();
~Camera();
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp
index 0fba82c..41577c4 100644
--- a/libs/ui/Camera.cpp
+++ b/libs/ui/Camera.cpp
@@ -64,22 +64,16 @@ Camera::Camera()
init();
}
-Camera::Camera(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);
- }
-}
-
-
+// construct a camera client from an existing camera remote
sp<Camera> Camera::create(const sp<ICamera>& camera)
{
+ LOGV("create");
+ if (camera == 0) {
+ LOGE("camera remote is a NULL pointer");
+ return 0;
+ }
+
sp<Camera> c = new Camera();
- // connect this client to existing camera remote
if (camera->connect(c) == NO_ERROR) {
c->mStatus = NO_ERROR;
c->mCamera = camera;