[libcamera-devel,3/3] android: camera_device: Default the camera location to Front
diff mbox series

Message ID 20210211085527.44667-4-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • Add Unknown camera location
Related show

Commit Message

Paul Elder Feb. 11, 2021, 8:55 a.m. UTC
Since the libcamera camera now has an Unknown location, we can know if
the camera's location is actually unknown. In this case, set the android
camera location to front, as some systems may not support external
cameras.

This allows the following CTS test to pass:
- android.hardware.camera2.cts.CameraManagerTest#testCameraManagerGetDeviceIdList

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/android/camera_device.cpp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kieran Bingham Feb. 11, 2021, 1:53 p.m. UTC | #1
Hi Paul,

On 11/02/2021 08:55, Paul Elder wrote:
> Since the libcamera camera now has an Unknown location, we can know if
> the camera's location is actually unknown. In this case, set the android
> camera location to front, as some systems may not support external
> cameras.
> 
> This allows the following CTS test to pass:
> - android.hardware.camera2.cts.CameraManagerTest#testCameraManagerGetDeviceIdList
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  src/android/camera_device.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 1e2a5b5f..3d815d21 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -407,6 +407,9 @@ int CameraDevice::initialize()
>  		case properties::CameraLocationExternal:
>  			facing_ = CAMERA_FACING_EXTERNAL;
>  			break;

This 'might' be worth an explanation to say why we chose 'FRONT'
specifically here, but that will be in the git history too.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> +		case properties::CameraLocationUnknown:
> +			facing_ = CAMERA_FACING_FRONT;
> +			break;
>  		}
>  	}
>  
>
Laurent Pinchart Feb. 11, 2021, 9:46 p.m. UTC | #2
Hi Paul,

Thank you for the patch.

On Thu, Feb 11, 2021 at 01:53:38PM +0000, Kieran Bingham wrote:
> On 11/02/2021 08:55, Paul Elder wrote:
> > Since the libcamera camera now has an Unknown location, we can know if
> > the camera's location is actually unknown. In this case, set the android
> > camera location to front, as some systems may not support external
> > cameras.
> > 
> > This allows the following CTS test to pass:
> > - android.hardware.camera2.cts.CameraManagerTest#testCameraManagerGetDeviceIdList
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > ---
> >  src/android/camera_device.cpp | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > index 1e2a5b5f..3d815d21 100644
> > --- a/src/android/camera_device.cpp
> > +++ b/src/android/camera_device.cpp
> > @@ -407,6 +407,9 @@ int CameraDevice::initialize()
> >  		case properties::CameraLocationExternal:
> >  			facing_ = CAMERA_FACING_EXTERNAL;
> >  			break;
> 
> This 'might' be worth an explanation to say why we chose 'FRONT'
> specifically here, but that will be in the git history too.

Git history or comment in the code both work for me in this case.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > +		case properties::CameraLocationUnknown:
> > +			facing_ = CAMERA_FACING_FRONT;
> > +			break;
> >  		}
> >  	}
> >

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 1e2a5b5f..3d815d21 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -407,6 +407,9 @@  int CameraDevice::initialize()
 		case properties::CameraLocationExternal:
 			facing_ = CAMERA_FACING_EXTERNAL;
 			break;
+		case properties::CameraLocationUnknown:
+			facing_ = CAMERA_FACING_FRONT;
+			break;
 		}
 	}