android-rpi/device_brcm_rpi3

Support of the official raspberry Pi camera on android-rpi

issamy opened this issue · 4 comments

I am currently using android-7.1.2_r19 on my raspberry pi 3.
I would like to get working an official Rapsberry pi camera v1.3 or v2, connected through the CSI port of the raspberry pi.
I installed a camera apk but when launching the application it crashes with error CameraService::Connect rejected (camera Hal module not loaded)

Is there anything to do to add support of official rpi camera on Android (modify the rpi3.mk, init file, buils some additional code - camera hal- ...)
If anyone has succeded, help would be much appreciated.

Hasn't anyone used the camera using android-rpi on raspberry pi.
If I add camera.default in rpi3.mk to add default camera hal to the compilation, I then have a crash:

01-01 00:06:20.684 3337 3337 I CameraService: CameraService process starting
01-01 00:06:20.689 3337 3337 I CameraService: Loaded "Default Camera HAL" camera module
01-01 00:06:20.690 3337 3337 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 3337 (cameraserver)
01-01 00:06:20.755 3342 3342 F DEBUG : pid: 3337, tid: 3337, name: cameraserver >>> /system/bin/cameraserver <<<
01-01 00:06:20.762 3342 3342 F DEBUG : #00 pc 0005fc0e /system/lib/libcameraservice.so (_ZN7android12CameraModule31deriveCameraCharacteristicsKeysEjRNS_14CameraMetadataE+233)
01-01 00:06:20.762 3342 3342 F DEBUG : #1 pc 00060895 /system/lib/libcameraservice.so (_ZN7android12CameraModule13getCameraInfoEiP11camera_info+424)
01-01 00:06:20.762 3342 3342 F DEBUG : #2 pc 0005bb87 /system/lib/libcameraservice.so (_ZN7android16CameraFlashlight23createFlashlightControlERKNS_7String8E+146)
01-01 00:06:20.762 3342 3342 F DEBUG : #3 pc 0005bea5 /system/lib/libcameraservice.so (_ZN7android16CameraFlashlight14findFlashUnitsEv+96)
01-01 00:06:20.762 3342 3342 F DEBUG : #4 pc 0004ffa7 /system/lib/libcameraservice.so (_ZN7android13CameraService10onFirstRefEv+302)
01-01 00:06:20.762 3342 3342 F DEBUG : #5 pc 00000be3 /system/bin/cameraserver
01-01 00:06:20.762 3342 3342 F DEBUG : #6 pc 00000b25 /system/bin/cameraserver
01-01 00:06:20.763 3342 3342 F DEBUG : #8 pc 00000a18 /system/bin/cameraserver
01-01 00:06:26.230 3349 3349 I cameraserver: ServiceManager: 0xa8a19380
01-01 00:06:26.230 3349 3349 I CameraService: CameraService started (pid=3349)
01-01 00:06:26.230 3349 3349 I CameraService: CameraService process starting

Anyone can help ?
PS: camera is supported (at least USB camera which I tested) on android-things. From the trace I saw that the following camera hal is used: V4L2CameraHAL

Not sure if I should try to to integrate this on android-rpi or debug the above crash using default camera hal

Still trying to get USB camera working with default Camera application on Android rpi.
Tried to integrate v4l2 camera hal from https://github.com/antmicro/android-camera-hal
Now able to initialize the camera HAL but a gralloc memory allocation failure occurs.
Any help ?
logcat is below (note that some debug traces had been added) :
01-01 00:03:11.573 1740 1740 V CAM_CameraAppUI: onPreviewStarted
01-01 00:03:11.580 1740 2239 I RequestQueue: Repeating capture request set.
01-01 00:03:11.582 1740 2239 D CAM_CommandExecutor: Executing command: com.android.camera.one.v2.commands.PreviewCommand@d4c9e52 END
01-01 00:03:11.613 1740 2231 W LegacyRequestMapper: convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
01-01 00:03:11.615 1740 2231 W LegacyRequestMapper: mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
01-01 00:03:11.616 1740 2231 W LegacyMetadataMapper: convertAfModeToLegacy - ignoring unsupported mode 4, defaulting to fixed
01-01 00:03:11.617 1740 2231 W LegacyRequestMapper: convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
01-01 00:03:11.627 140 1312 E Camera3-Device: configureStreamsLocked: ISSAM ENTERED configureStreamsLocked
01-01 00:03:11.627 140 1312 E Camera3-Device: configureStreamsLocked: ISSAM Starting stream configuration
01-01 00:03:11.627 140 1312 E Camera3-Device: configureStreamsLocked: ISSAM outputStream size is 2
01-01 00:03:11.627 140 1312 E Camera3-Device: configureStreamsLocked: ISSAM get outputStream
01-01 00:03:11.627 140 1312 E Camera3-Device: configureStreamsLocked: ISSAM get outputStream
01-01 00:03:11.655 140 1312 W Camera3-OutputStream: A frame is dropped for stream 0
01-01 00:03:11.656 140 1312 W Camera3-OutputStream: A frame is dropped for stream 0
01-01 00:03:11.656 140 1312 W Camera3-OutputStream: A frame is dropped for stream 0
01-01 00:03:11.657 134 165 E GRALLOC-RPI: gralloc0 allocation failed: -22 (Invalid argument)
01-01 00:03:11.657 134 165 E GraphicBufferAllocator: Failed to allocate (2768896 x 1) format 33 usage 51: 5
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: Allocated buffers:
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa66c00a8: 3.50 KiB | 22 ( 32) x 28 | 1 | 0x00008933 | Sprite
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa66c0118: 3600.00 KiB | 1280 (1280) x 720 | 5 | 0x00001a00 | FramebufferSurface
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa66c01f8: 3600.00 KiB | 1280 (1280) x 720 | 5 | 0x00001a00 | FramebufferSurface
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa66c02d8: 28800.00 KiB | 2880 (2880) x 2560 | 2 | 0x00000933 | com.android.systemui.ImageWallpaper
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b1150: 3600.00 KiB | 1280 (1280) x 720 | 1 | 0x00000933 | StrictModeFlash
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b11c0: 0.02 KiB | 1 ( 4) x 1 | 1 | 0x00000933 | StrictModeFlash
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b12a0: 120.00 KiB | 1280 (1280) x 24 | 5 | 0x00000900 | StatusBar
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b1310: 120.00 KiB | 1280 (1280) x 24 | 5 | 0x00000900 | StatusBar
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b14d0: 120.00 KiB | 1280 (1280) x 24 | 5 | 0x00000900 | StatusBar
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b1540: 240.00 KiB | 1280 (1280) x 48 | 5 | 0x00000900 | NavigationBar
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b15b0: 240.00 KiB | 1280 (1280) x 48 | 5 | 0x00000900 | NavigationBar
01-01 00:03:11.658 134 165 D GraphicBufferAllocator: 0xa75b1620: 240.00 KiB | 1280 (1280) x 48 |
01-01 00:03:11.658 134 165 E : GraphicBufferAlloc::createGraphicBuffer(w=2768896, h=1) failed (Out of memory), handle=0x0
01-01 00:03:11.658 140 1312 E BufferQueueProducer: [Camera2-JpegConsumer] dequeueBuffer: createGraphicBuffer failed

I am also facing same error.
have you got any solution?

Hi Vinay,
Unfortunately, I have not been able to solve this "out of memory" error and I had to give up trying to get the camera working for now.
If you or someone else finds a solution, please share the solution for the community ;-)