android: camera_hal_manager: Remove cameraLocation()

Inline the function as it is only used in a single place and does not do
anything complicated. This also lets the `operator==` of `std::optional`
take care of the proper comparison instead of defaulting the value to -1
and comparing that.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2025-11-03 15:31:01 +01:00
parent 4eacabf5c6
commit 9a608ed72d
2 changed files with 1 additions and 8 deletions

View File

@@ -125,7 +125,7 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
* Now check if this is an external camera and assign
* its id accordingly.
*/
if (cameraLocation(cam.get()) == properties::CameraLocationExternal) {
if (cam->properties().get(properties::Location) == properties::CameraLocationExternal) {
isCameraExternal = true;
id = nextExternalCameraId_;
} else {
@@ -227,11 +227,6 @@ void CameraHalManager::cameraRemoved(std::shared_ptr<Camera> cam)
LOG(HAL, Debug) << "Camera ID: " << id << " removed successfully.";
}
int32_t CameraHalManager::cameraLocation(const Camera *cam)
{
return cam->properties().get(properties::Location).value_or(-1);
}
CameraDevice *CameraHalManager::cameraDeviceFromHalId(unsigned int id)
{
auto iter = std::find_if(cameras_.begin(), cameras_.end(),

View File

@@ -48,8 +48,6 @@ private:
CameraHalManager();
static int32_t cameraLocation(const libcamera::Camera *cam);
void cameraAdded(std::shared_ptr<libcamera::Camera> cam);
void cameraRemoved(std::shared_ptr<libcamera::Camera> cam);