Merge change 602 into donut

* changes:
  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
This commit is contained in:
Android (Google) Code Review
2009-04-27 13:42:05 -07:00
2 changed files with 7 additions and 14 deletions

View File

@@ -78,7 +78,6 @@ class Camera : public BnCameraClient, public IBinder::DeathRecipient
{ {
public: public:
// construct a camera client from an existing remote // 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> create(const sp<ICamera>& camera);
static sp<Camera> connect(); static sp<Camera> connect();
~Camera(); ~Camera();

View File

@@ -64,22 +64,16 @@ Camera::Camera()
init(); init();
} }
Camera::Camera(const sp<ICamera>& camera) // construct a camera client from an existing camera remote
{
init();
// connect this client to existing camera remote
if (camera->connect(this) == NO_ERROR) {
mStatus = NO_ERROR;
mCamera = camera;
camera->asBinder()->linkToDeath(this);
}
}
sp<Camera> Camera::create(const sp<ICamera>& camera) 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(); sp<Camera> c = new Camera();
// connect this client to existing camera remote
if (camera->connect(c) == NO_ERROR) { if (camera->connect(c) == NO_ERROR) {
c->mStatus = NO_ERROR; c->mStatus = NO_ERROR;
c->mCamera = camera; c->mCamera = camera;