summaryrefslogtreecommitdiff
path: root/src/android
AgeCommit message (Collapse)Author
2019-08-19android: camera_hal_manager: Clean up resources when terminatingLaurent Pinchart
The CameraHalManager starts the libcamera CameraManager and creates CameraProxy instances for each camera in the system. Clean up those resources when the CameraHalManager terminates. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-19android: camera_hal_manager: Remove unused close() methodLaurent Pinchart
The CameraHalManager::close() method isn't used, remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-19android: camera_hal_manager: Stop thread when destroyingLaurent Pinchart
The CameraHalManager starts a thread that is never stopped. This leads to the thread being destroyed while running, which causes a crash. Fix this by stopping the thread and waiting for it to finish in the destructor of the CameraHalManager. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-19android: Pass Camera shared pointer to CameraProxy by const referenceLaurent Pinchart
The CameraProxy is constructed with a Camera instance passed through a shared pointer. It forwards it to the CameraDevice constructor, which takes a reference used for the sole purpose of making an internal copy of the shared pointer. Both constructors can thus take a const reference instead of a value or a mutable reference. This optimises the constructors slightly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-19android: Simplify thread RPC with Object::invokeMethod()Laurent Pinchart
Replace the manual implementation of asynchronous method invocation through a custom message with Object::invokeMethod(). This simplifies the thread RPC implementation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-15hal: Fix comparison of unsigned integer < 0Laurent Pinchart
The CameraHalManager::getCameraInfo() validates the camera id it receives from the camera service, and in doing so generates a compiler error with gcc as the id is an unsigned integer and can never be negative: ../src/android/camera_hal_manager.cpp: In member function ‘CameraProxy* CameraHalManager::open(unsigned int, const hw_module_t*)’: ../src/android/camera_hal_manager.cpp:89:9: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] if (id < 0 || id >= numCameras()) { Fix it by removing the unneeded comparison. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-12hal: Fix comparison of integers of different signsLaurent Pinchart
The CameraHalManager::getCameraInfo() validates the camera id it receives from the camera service, and in doing so compares it with an unsigned integer, generating a compiler error: src/android/camera_hal_manager.cpp:121:9: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare] if (id >= numCameras() || id < 0) { ~~ ^ ~~~~~~~~~~~~ Fix this by turning the id into an unsigned int, as camera ids can't be negative. If a negative id is received from the camera service it will be converted to a large unsigned integer that will fail the comparison with numCameras(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-12android: hal: Add Camera3 HALJacopo Mondi
Add libcamera Android Camera HALv3 implementation. The initial camera HAL implementation supports the LIMITED hardware level and uses statically defined metadata and camera characteristics. Add a build option named 'android' and adjust the build system to selectively compile the Android camera HAL and link it against the required Android libraries. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-08-12android: metadata: Add SPDX tagJacopo Mondi
Add SPDX tag to the android metadata library files licensed under Apache-2.0. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-08-12android: Add camera metadata libraryJacopo Mondi
Import the Android camera metadata library from the ChromiumOS build system. The camera metadata library has been copied from https://chromium.googlesource.com/chromiumos/platform2 at revision 9e65ddd2c496e712f005ada9715decd2ff8e4a03 The original path in the Cros platform2/ repository is: camera/android/libcamera_metadata/src Create a new build target for the camera metadata library to create a static library to link against libcamera. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>