Merge change 509 into donut
* changes: Fix a media server crash (bug 1807910): part one Add a factory method that creates a Camera object from a remote client
This commit is contained in:
@@ -78,8 +78,8 @@ 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);
|
Camera(const sp<ICamera>& camera); // to be removed
|
||||||
|
static sp<Camera> create(const sp<ICamera>& camera);
|
||||||
static sp<Camera> connect();
|
static sp<Camera> connect();
|
||||||
~Camera();
|
~Camera();
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -75,6 +75,19 @@ Camera::Camera(const sp<ICamera>& camera)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sp<Camera> Camera::create(const sp<ICamera>& camera)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
camera->asBinder()->linkToDeath(c);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
void Camera::init()
|
void Camera::init()
|
||||||
{
|
{
|
||||||
mStatus = UNKNOWN_ERROR;
|
mStatus = UNKNOWN_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user