frameworks: implement system-wide Torch service
Allows Torch and any camera to coexist peacefully. When torch is active
and a camera is opened, the torch will be first shut down, and the
camera will be allowed to continue opening, instead of displaying
"Cannot connect to camera."
Also a squash of the following commits:
add framework torch service
Change-Id: I0c7a055b33fdebe697f23d207b20408e06eb74a8
Signed-off-by:
Roman Birg <roman@cyngn.com>
Fully fix interaction between torch and camera usage.
For doing this, two things are necessary:
- The torch shutdown needs to be synchronous, so that the torch app has
a chance to release the camera before the camera app tries to use it.
- The torch service needs to track camera usage, so that it can notify
the torch app if a camera is busy.
Change-Id: I521091d255ff4c251d97a0e8d65c9d2a80b9dae4
Fix camera usage tracking.
When a Camera object is finalized, it notifies the torch service that
it's no longer using the camera. This call used to not check whether the
caller actually is still using the camera and called release() before,
so depending on timing of the finalizer, it could happen that e.g. the
camera app released the camera user record of the torch app, leading to
the torch usage not being detected on next usage of the camera app.
Fix that by checking whether the caller of onCameraClosed() actually
owned the camera prior to releasing the record.
Also fix synchronization between accesses.
Change-Id: Ic01cbc3c89ab8d855e4613bfa1b2f548de919b73
frameworks: extend TorchService to be able to handle sysfs torch config
Some devices are still using a sysfs node to control the torch. Let's
support those configurations and properly shut the torch down.
Change-Id: I5fa1cccdcffad26dbfef4b2ee0eafe1218a5308b
Signed-off-by:
Roman Birg <roman@cyngn.com>
frameworks: move TorchService to new services location
Change-Id: I392f37dfefe41686388811069999eb031f7eb92c
Signed-off-by:
Roman Birg <roman@cyngn.com>
Change-Id: I37a265ec98391936a6c19e8bcdf8da1efb57d45d
Signed-off-by:
Roman Birg <roman@cyngn.com>
Loading
Please register or sign in to comment