If Camera2Client failed to initialize, it would skip disconnect step,
and thus the camera would be forever marked as busy. By always calling
disconnect it will always call free.
It also adds a new guarantee that Client::disconnect is idempotent
Bug:
7298182
Change-Id: Ic9876f1665b7d9b3c0da692880f63f165e3f4fa5
// tear down the client
CameraService::Client::~Client() {
mCameraService->releaseSound();
+
+ // unconditionally disconnect. function is idempotent
+ Client::disconnect();
}
// ----------------------------------------------------------------------------
return client;
}
+// NOTE: function is idempotent
void CameraService::Client::disconnect() {
mCameraService->removeClient(mCameraClient);
mCameraService->setCameraFree(mCameraId);