DeviceAsWebcam
This system app performs the function of advertising the
android device as a webcam to other hosts - currently as
a UVC camera over USB.
The system app broadly consists of 2 parts :
1) Foreground Service : The system app receives the
ACTION_USB_STATE broadcast from the system when the
user wants the device to behave like a webcam. Upon
receiving the broadcast and confirming that the webcam
function was selected starts a foreground service which
through JNI, uses the linux kernel's UVC gadget driver
to listen to events on a /dev/video* v4l2 node the first
one which has the VIDEO_OUTPUT capability). Through
processing exceptional or write events on these nodes
the native service starts the capturing frames using
the camera2 sdk api and writes them to buffers requested
from the UVC gadget driver.
2) Camera preview activity : This activity displays camera
preview for framing the scene and viewing the webcam stream
that will be sent over to the host. This preview can run
independantly of the webcam actually streaming. As a result,
the user can frame the scene before opening up a client
app on the host that will request the webcam stream.
Bug: 242344221
Test: Select 'Webcam' option from the USB preferences page
on the Settings App -> Open preview to frame
scene -> use various apps on major host OSes to use
the webcam stream.
Change-Id: I7a81c30f2756ef123cbd652b0942c58374b33df5
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
25 files changed