raspberry-vanilla / android_local_manifest

136 stars 54 forks source link

Camera/ffmpeg support in automotive build #23

Closed dpetrecki closed 1 year ago

dpetrecki commented 1 year ago

Hello, the standard image from https://konstakang.com/devices/rpi4/AOSP13/ contains ffmpeg and v4l2-ctl and basically the USB-connected camera works. But the build aosp_rpi4_car-userdebug doesn't include those two and I can't read from the camera. My camera is UVC-compatible Logitech c920. I've tested it with EvsCameraPreview and OpenCamera (https://opencamera.org.uk/) This is all I've added to the build (aosp_rpi4_car.mk):

PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
    config.override_forced_orient=true \
    persist.bluetooth.enablenewavrcp=false

DEVICE_PACKAGE_OVERLAYS += device/google/cuttlefish/shared/auto/overlay
ENABLE_EVS_SERVICE ?= true
ENABLE_MOCK_EVSHAL ?= true
ENABLE_CAREVSSERVICE_SAMPLE ?= true
ENABLE_SAMPLE_EVS_APP ?= true
ENABLE_CARTELEMETRY_SERVICE ?= true
ENABLE_EVS_SAMPLE  := false
TARGET_BOARD_INFO_FILE ?= device/google/cuttlefish/shared/auto/android-info.txt

CUSTOMIZE_EVS_SERVICE_PARAMETER := true
PRODUCT_COPY_FILES += \
    device/google/cuttlefish/shared/auto/evs/init.evs.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.evs.rc \
    device/google/cuttlefish/shared/auto/evs/evs_app_config.json:$(TARGET_COPY_OUT_SYSTEM)/etc/automotive/evs/config_override.json

BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/auto/sepolicy/evs \
    packages/services/Car/cpp/evs/apps/sepolicy/private \
    packages/services/Car/cpp/evs/apps/sepolicy/cartelemetry

PRODUCT_PACKAGES += \
    CarEvsCameraPreviewAppRRO \
    com.google.android.car.evs \
    EvsHalDefaults \
    CarEvsCameraPreviewApp \
    android.hardware.automotive.evs@1.1-service \
    android.frameworks.automotive.display@1.0-service \
    android.hardware.automotive.evs-aidl-default-service \
    android.automotive.evs.manager@1.1 \
    android.hardware.automotive.evs@1.1-sample \
    librs_jni \
    cameraserver \
    evsmanagerd \
    android.hardware.automotive.evs@1.1-sample \
    evs_app \
    evs_app_support_lib \
    cardisplayproxyd 

PRODUCT_PACKAGE_OVERLAYS += packages/services/Car/tests/SampleRearViewCamera/overlay    

PRODUCT_COPY_FILES += \
    frameworks/base/data/sounds/effects/ogg/camera_click_48k.ogg:$(TARGET_COPY_OUT_PRODUCT)/media/audio/ui/camera_click.ogg \
    frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml \
    device/google/cuttlefish/shared/auto/display_settings.xml:$(TARGET_COPY_OUT_VENDOR)/etc/display_settings.xml

PRODUCT_PACKAGE_OVERLAYS += \
    device/generic/car/common/overlay

and the overlay:

    <string translatable="false" name="config_evsRearviewCameraId">/dev/video0</string>
    <string name="config_evsCameraActivity" translatable="false">
        com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity
    </string>

The camera is connected as /dev/video0 and /dev/video1 (i don't know, why is it twice, but on the non-automotive build v4l2-ctl shows no stream on /dev/video1) :

# for I in /sys/class/video4linux/*; do cat $I/name; done
Logitech Webcam C930e
Logitech Webcam C930e
bcm2835-codec-decode
bcm2835-codec-encode
bcm2835-codec-isp
bcm2835-isp-output0
bcm2835-isp-capture0
bcm2835-isp-capture1
bcm2835-isp-stats2deo4linux #
bcm2835-codec-image_fx
rpivid
bcm2835-isp-output0
bcm2835-isp-capture0
bcm2835-isp-capture1
bcm2835-isp-stats2
bcm2835-codec-encode_image

 # ls -l /sys/class/video4linux/
total 0
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video0 -> ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/video4linux/video0
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video1 -> ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/video4linux/video1
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video10 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-codec/video4linux/video10
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video11 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-codec/video4linux/video11
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video12 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-codec/video4linux/video12
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video13 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video13
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video14 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video14
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video15 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video15
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video16 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video16
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video18 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-codec/video4linux/video18
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video19 -> ../../devices/platform/scb/feb10000.codec/video4linux/video19
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video20 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video20
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video21 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video21
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video22 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video22
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video23 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-isp/video4linux/video23
lrwxrwxrwx 1 root root 0 2023-08-21 10:00 video31 -> ../../devices/platform/soc/fe00b840.mailbox/bcm2835-codec/video4linux/video31

Logcat with evs filter:

2023-08-21 12:05:37.489   691-1252  CarPackage...gerService com.android.car                      D  Updating allowlist and denylist mapping for package: com.google.android.car.evs for UserId: 10
2023-08-21 12:07:14.794  2631-2714  OpenGLRenderer          com.silentlexx.ffmpeggui             I  Davey! duration=704ms; Flags=1, FrameTimelineVsyncId=20537, IntendedVsync=665132607230, Vsync=665719555287, InputEventId=0, HandleInputStart=665730493454, AnimationStart=665730495362, PerformTraversalsStart=665730927584, DrawStart=665830053065, FrameDeadline=665735426396, FrameInterval=665730381732, FrameStartTime=15863215, SyncQueued=665830252528, SyncStart=665830802547, IssueDrawCommandsStart=665830945102, SwapBuffers=665836682713, FrameCompleted=665837926528, DequeueBufferDuration=16741, QueueBufferDuration=468722, GpuCompleted=665836682713, SwapBuffersCompleted=665837926528, DisplayPresentTime=634213716736, CommandSubmissionCompleted=665836682713, 
2023-08-21 12:26:44.903   467-1005  ActivityTaskManager     system_process                       I  START u10 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.google.android.car.evs/.CarEvsCameraActivity} from uid 1010029
2023-08-21 12:26:44.921   467-1005  SplashScre...eptionList system_process                       V  SplashScreen checking exception for package com.google.android.car.evs (target sdk:33) -> false
2023-08-21 12:26:44.968   467-1005  CoreBackPreview         system_process                       D  Window{f007755 u10 Splash Screen com.google.android.car.evs}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@a02a5b, mPriority=0}
2023-08-21 12:26:44.991   467-494   ActivityManager         system_process                       I  Start proc 2999:com.google.android.car.evs/u10a52 for next-top-activity {com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraActivity}
2023-08-21 12:26:45.008  2999-2999  Zygote                  com.google.android.car.evs           I  seccomp disabled by setenforce 0
2023-08-21 12:26:45.099  2999-2999  Compatibil...geReporter com.google.android.car.evs           D  Compat change id reported: 171979766; UID 1010052; state: ENABLED
2023-08-21 12:26:45.156  2999-2999  GraphicsEnvironment     com.google.android.car.evs           V  ANGLE Developer option for 'com.google.android.car.evs' set to: 'default'
2023-08-21 12:26:45.157  2999-2999  GraphicsEnvironment     com.google.android.car.evs           V  ANGLE GameManagerService for com.google.android.car.evs: false
2023-08-21 12:26:45.157  2999-2999  GraphicsEnvironment     com.google.android.car.evs           V  Neither updatable production driver nor prerelease driver is supported.
2023-08-21 12:26:45.160  2999-2999  NetworkSecurityConfig   com.google.android.car.evs           D  No Network Security Config specified, using platform default
2023-08-21 12:26:45.161  2999-2999  NetworkSecurityConfig   com.google.android.car.evs           D  No Network Security Config specified, using platform default
2023-08-21 12:26:45.206  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           I  onCreate
2023-08-21 12:26:45.211  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           I  Starting listener
2023-08-21 12:26:45.217   691-1252  CAR.EVS                 com.android.car                      I  Transition requested: INACTIVE -> REQUESTED
2023-08-21 12:26:45.218   691-1252  ContextImpl             com.android.car                      W  Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1071 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 com.android.car.evs.CarEvsService$StateMachine.handleTransitionToRequestedLocked:552 
2023-08-21 12:26:45.221   467-1005  ActivityTaskManager     system_process                       I  START u0 {act=android.intent.action.MAIN flg=0x18090000 cmp=com.google.android.car.evs/.CarEvsCameraPreviewActivity} from uid 1000
2023-08-21 12:26:45.234   467-1005  SplashScre...eptionList system_process                       V  SplashScreen checking exception for package com.google.android.car.evs (target sdk:33) -> false
2023-08-21 12:26:45.240   691-1252  CAR.EVS                 com.android.car                      I  Transition completed: REQUESTED
2023-08-21 12:26:45.265   467-494   ActivityManager         system_process                       I  Start proc 3021:com.google.android.car.evs/u0a52 for next-top-activity {com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity}
2023-08-21 12:26:45.287  3021-3021  Zygote                  com.google.android.car.evs           I  seccomp disabled by setenforce 0
2023-08-21 12:26:45.340  3021-3021  Compatibil...geReporter com.google.android.car.evs           D  Compat change id reported: 171979766; UID 10052; state: ENABLED
2023-08-21 12:26:45.369  3021-3021  GraphicsEnvironment     com.google.android.car.evs           V  ANGLE Developer option for 'com.google.android.car.evs' set to: 'default'
2023-08-21 12:26:45.369  3021-3021  GraphicsEnvironment     com.google.android.car.evs           V  ANGLE GameManagerService for com.google.android.car.evs: false
2023-08-21 12:26:45.369  3021-3021  GraphicsEnvironment     com.google.android.car.evs           V  Neither updatable production driver nor prerelease driver is supported.
2023-08-21 12:26:45.374  3021-3021  NetworkSecurityConfig   com.google.android.car.evs           D  No Network Security Config specified, using platform default
2023-08-21 12:26:45.375  3021-3021  NetworkSecurityConfig   com.google.android.car.evs           D  No Network Security Config specified, using platform default
2023-08-21 12:26:45.422  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  onCreate
2023-08-21 12:26:45.425  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  decideShowWhenLocked: displayState=2
2023-08-21 12:26:45.440  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           I  CarServiceLifecycleListener
2023-08-21 12:26:45.442  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Requested: STOPPED -> VISIBLE
2023-08-21 12:26:45.444   691-748   CAR.EVS                 com.android.car                      I  Transition requested: REQUESTED -> ACTIVE
2023-08-21 12:26:45.444   691-748   CAR.EVS                 com.android.car                      E  Failed to open a target camera device
2023-08-21 12:26:45.445   691-748   CAR.EVS                 com.android.car                      E  Transition failed: error = -1
2023-08-21 12:26:45.445  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           E  Failed to start a video stream, error = -1
2023-08-21 12:26:45.459  3021-3021  Compatibil...geReporter com.google.android.car.evs           D  Compat change id reported: 210923482; UID 10052; state: ENABLED
2023-08-21 12:26:45.470  3021-3021  Compatibil...geReporter com.google.android.car.evs           D  Compat change id reported: 237531167; UID 10052; state: DISABLED
2023-08-21 12:26:45.479  3021-3037  Parcel                  com.google.android.car.evs           W  Expecting binder but got null!
2023-08-21 12:26:45.488   467-891   CoreBackPreview         system_process                       D  Window{5149991 u0 com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@d724cf7, mPriority=0}
2023-08-21 12:26:45.528  3021-3037  DMABUFHEAPS             com.google.android.car.evs           I  Using : Non-legacy ION heaps
2023-08-21 12:26:45.533  3021-3037  MESA                    com.google.android.car.evs           I  Using IMapper v4 API
2023-08-21 12:26:45.553  3021-3037  EGL-MAIN                com.google.android.car.evs           W  failed to get driver name for fd -1
2023-08-21 12:26:45.554  3021-3037  EGL-MAIN                com.google.android.car.evs           W  MESA-LOADER: failed to retrieve device information
2023-08-21 12:26:45.554  3021-3037  EGL-MAIN                com.google.android.car.evs           W  failed to get driver name for fd -1
2023-08-21 12:26:45.572  3021-3037  OpenGLRenderer          com.google.android.car.evs           W  Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2023-08-21 12:26:45.572  3021-3037  OpenGLRenderer          com.google.android.car.evs           E  Device claims wide gamut support, cannot find matching config, error = EGL_SUCCESS
2023-08-21 12:26:45.573  3021-3037  OpenGLRenderer          com.google.android.car.evs           W  Failed to initialize 101010-2 format, error = EGL_SUCCESS
2023-08-21 12:26:45.598  3021-3037  OpenGLRenderer          com.google.android.car.evs           E  Unable to match the desired swap behavior.
2023-08-21 12:26:45.716   467-484   ActivityTaskManager     system_process                       I  Displayed com.google.android.car.evs/.CarEvsCameraPreviewActivity: +463ms
2023-08-21 12:26:46.182   467-488   InputManager-JNI        system_process                       W  Input channel object 'f007755 Splash Screen com.google.android.car.evs (client)' was disposed without first being removed with the input manager!
2023-08-21 12:26:46.194  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           D  onDestroy
2023-08-21 12:26:47.479  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  onStop
2023-08-21 12:26:47.479  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Requested: STOPPED -> INVISIBLE
2023-08-21 12:26:47.479  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Completed: INVISIBLE
2023-08-21 12:26:47.482  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  onDestroy
2023-08-21 12:26:47.482  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Requested: INVISIBLE -> STOPPED
2023-08-21 12:26:47.483   691-1252  CAR.EVS                 com.android.car                      I  Ignores a video stream request not from current stream client.
2023-08-21 12:26:47.484  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Completed: STOPPED
2023-08-21 12:26:47.489   467-1005  CoreBackPreview         system_process                       D  Window{5149991 u0 com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity}: Setting back callback null
2023-08-21 12:26:47.503   467-1005  InputManager-JNI        system_process                       W  Input channel object '5149991 com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity (client)' was disposed without first being removed with the input manager!
2023-08-21 12:26:50.303  2999-3009  android.car.evs         com.google.android.car.evs           W  Cleared Reference was only reachable from finalizer (only reported once)
2023-08-21 12:26:52.485  3021-3030  android.car.evs         com.google.android.car.evs           W  Cleared Reference was only reachable from finalizer (only reported once)
2023-08-21 12:36:46.290   467-536   ActivityManager         system_process                       D  freezing 2999 com.google.android.car.evs
2023-08-21 12:36:47.479   467-536   ActivityManager         system_process                       D  freezing 3021 com.google.android.car.evs
2023-08-21 12:48:22.979   467-866   ActivityTaskManager     system_process                       I  START u10 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.google.android.car.evs/.CarEvsCameraActivity} from uid 1010029
2023-08-21 12:48:22.999   467-866   SplashScre...eptionList system_process                       V  SplashScreen checking exception for package com.google.android.car.evs (target sdk:33) -> false
2023-08-21 12:48:23.031  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.032  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.032  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.033  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.041   467-487   ActivityManager         system_process                       D  sync unfroze 2999 com.google.android.car.evs
2023-08-21 12:48:23.042  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.044  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.044  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.045  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.045  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.046  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.046  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.047  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.047  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.048  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.049  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.053  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.054  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.054  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.055  2999-3007  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.071  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           I  onCreate
2023-08-21 12:48:23.072  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           I  Starting listener
2023-08-21 12:48:23.075   691-3248  CAR.EVS                 com.android.car                      I  Transition requested: REQUESTED -> REQUESTED
2023-08-21 12:48:23.076   691-3248  ContextImpl             com.android.car                      W  Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1071 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 com.android.car.evs.CarEvsService$StateMachine.handleTransitionToRequestedLocked:552 
2023-08-21 12:48:23.081   467-866   ActivityTaskManager     system_process                       I  START u0 {act=android.intent.action.MAIN flg=0x18090000 cmp=com.google.android.car.evs/.CarEvsCameraPreviewActivity} from uid 1000
2023-08-21 12:48:23.136   467-866   SplashScre...eptionList system_process                       V  SplashScreen checking exception for package com.google.android.car.evs (target sdk:33) -> false
2023-08-21 12:48:23.147   691-3248  CAR.EVS                 com.android.car                      I  Transition completed: REQUESTED
2023-08-21 12:48:23.161   467-1005  CoreBackPreview         system_process                       D  Window{ccc2da2 u10 Splash Screen com.google.android.car.evs}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@5718d1c, mPriority=0}
2023-08-21 12:48:23.185  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.185  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.186  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.186  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.187  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.188  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.188  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.189  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.189  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.190  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.190  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.191  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.192  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.194  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.195  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.195  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.196  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.196   467-487   ActivityManager         system_process                       D  sync unfroze 3021 com.google.android.car.evs
2023-08-21 12:48:23.196  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.196  3021-3028  android.car.evs         com.google.android.car.evs           E  Failed to send jdwp-handshake response.: Broken pipe
2023-08-21 12:48:23.199  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           D  onDestroy
2023-08-21 12:48:23.216  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  onCreate
2023-08-21 12:48:23.218  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  decideShowWhenLocked: displayState=2
2023-08-21 12:48:23.226  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           I  CarServiceLifecycleListener
2023-08-21 12:48:23.228  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Requested: STOPPED -> VISIBLE
2023-08-21 12:48:23.230   691-3248  CAR.EVS                 com.android.car                      I  Transition requested: REQUESTED -> ACTIVE
2023-08-21 12:48:23.231   691-3248  CAR.EVS                 com.android.car                      E  Failed to open a target camera device
2023-08-21 12:48:23.232   691-3248  CAR.EVS                 com.android.car                      E  Transition failed: error = -1
2023-08-21 12:48:23.232  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           E  Failed to start a video stream, error = -1
2023-08-21 12:48:23.260  3021-3037  Parcel                  com.google.android.car.evs           W  Expecting binder but got null!
2023-08-21 12:48:23.269   467-2711  CoreBackPreview         system_process                       D  Window{6fe0776 u0 com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@73621e4, mPriority=0}
2023-08-21 12:48:23.297  3021-3037  OpenGLRenderer          com.google.android.car.evs           E  Unable to match the desired swap behavior.
2023-08-21 12:48:23.395   467-484   ActivityTaskManager     system_process                       I  Displayed com.google.android.car.evs/.CarEvsCameraPreviewActivity: +306ms
2023-08-21 12:48:23.410   467-2784  CoreBackPreview         system_process                       D  Window{ccc2da2 u10 Splash Screen com.google.android.car.evs EXITING}: Setting back callback null
2023-08-21 12:48:23.416   467-2711  InputManager-JNI        system_process                       W  Input channel object 'ccc2da2 Splash Screen com.google.android.car.evs (client)' was disposed without first being removed with the input manager!

Full logcat when opening EvsCameraPreview:

2023-08-21 12:49:33.333   467-2784  ActivityTaskManager     system_process                       I  START u10 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.google.android.car.evs/.CarEvsCameraActivity} from uid 1010029
2023-08-21 12:49:33.337   467-2784  CellBroadcastUtils      system_process                       E  getDefaultCellBroadcastReceiverPackageName: no package found
2023-08-21 12:49:33.345   467-2784  SplashScre...eptionList system_process                       V  SplashScreen checking exception for package com.google.android.car.evs (target sdk:33) -> false
2023-08-21 12:49:33.366  1649-1858  SplashScreenView        com.android.car.carlauncher          D  Build android.window.SplashScreenView{e974d28 V.E...... ......ID 0,0-0,0}
                                                                                                    Icon: view: android.widget.ImageView{4de3a41 V.ED..... ......I. 0,0-0,0 #10204dd android:id/splashscreen_icon_view} drawable: com.android.wm.shell.startingsurface.SplashscreenIconDrawableFactory$ImmobileIconDrawable@7a4cbe6 size: 150
                                                                                                    Branding: view: android.view.View{12f1527 G.ED..... ......I. 0,0-0,0 #10204dc android:id/splashscreen_branding_view} drawable: null size w: 0 h: 0
2023-08-21 12:49:33.386  1649-1803  Parcel                  com.android.car.carlauncher          W  Expecting binder but got null!
2023-08-21 12:49:33.393   467-2784  CoreBackPreview         system_process                       D  Window{a2cc880 u10 Splash Screen com.google.android.car.evs}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@1d752fe, mPriority=0}
2023-08-21 12:49:33.397   467-2784  ActivityTaskManager     system_process                       W  Tried to set launchTime (0) < mLastActivityLaunchTime (3134078)
2023-08-21 12:49:33.398   747-782   KeyguardService         com.android.systemui                 D  setOccluded(true)
2023-08-21 12:49:33.399   747-782   KeyguardViewMediator    com.android.systemui                 D  setOccluded(true)
2023-08-21 12:49:33.400   747-747   KeyguardViewMediator    com.android.systemui                 D  handleSetOccluded(true)
2023-08-21 12:49:33.417  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           I  onCreate
2023-08-21 12:49:33.421   691-748   CAR.AM                  com.android.car                      I  onForegroundActivitiesChanged uid 1010052 pid 2999 fg true
2023-08-21 12:49:33.424  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           I  Starting listener
2023-08-21 12:49:33.428   691-3248  CAR.EVS                 com.android.car                      I  Transition requested: REQUESTED -> REQUESTED
2023-08-21 12:49:33.429   691-3248  ContextImpl             com.android.car                      W  Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1071 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 com.android.car.evs.CarEvsService$StateMachine.handleTransitionToRequestedLocked:552 
2023-08-21 12:49:33.429   691-3248  ContextImpl             com.android.car                      W  Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1083 android.app.ContextImpl.startActivity:1072 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 android.content.ContextWrapper.startActivity:432 
2023-08-21 12:49:33.431   467-2711  ActivityTaskManager     system_process                       I  START u0 {act=android.intent.action.MAIN flg=0x18090000 cmp=com.google.android.car.evs/.CarEvsCameraPreviewActivity} from uid 1000
2023-08-21 12:49:33.435   467-2711  CellBroadcastUtils      system_process                       E  getDefaultCellBroadcastReceiverPackageName: no package found
2023-08-21 12:49:33.439  1649-1803  OpenGLRenderer          com.android.car.carlauncher          E  Unable to match the desired swap behavior.
2023-08-21 12:49:33.444   467-2711  SplashScre...eptionList system_process                       V  SplashScreen checking exception for package com.google.android.car.evs (target sdk:33) -> false
2023-08-21 12:49:33.448   691-3248  CAR.EVS                 com.android.car                      I  Transition completed: REQUESTED
2023-08-21 12:49:33.460   691-691   CarPackage...gerService com.android.car                      D  onWindowChange event received
2023-08-21 12:49:33.478   467-2711  ActivityTaskManager     system_process                       W  Tried to set launchTime (0) < mLastActivityLaunchTime (3134239)
2023-08-21 12:49:33.479   747-1920  KeyguardService         com.android.systemui                 D  setOccluded(false)
2023-08-21 12:49:33.480   747-1920  KeyguardViewMediator    com.android.systemui                 D  setOccluded(false)
2023-08-21 12:49:33.481   747-747   KeyguardViewMediator    com.android.systemui                 D  handleSetOccluded(false)
2023-08-21 12:49:33.489  2999-2999  CarEvsCameraActivity    com.google.android.car.evs           D  onDestroy
2023-08-21 12:49:33.496   691-3248  CAR.AM                  com.android.car                      I  onForegroundActivitiesChanged uid 10052 pid 3021 fg true
2023-08-21 12:49:33.496   691-3248  CAR.AM                  com.android.car                      I  onForegroundActivitiesChanged uid 1010052 pid 2999 fg false
2023-08-21 12:49:33.502  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  onCreate
2023-08-21 12:49:33.502  1649-1649  FocusParkingView        com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] lost focus
2023-08-21 12:49:33.504  1649-1649  FocusAreaHelper         com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] lost focus
2023-08-21 12:49:33.504  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  decideShowWhenLocked: displayState=2
2023-08-21 12:49:33.508   747-782   KeyguardService         com.android.systemui                 D  setOccluded(true)
2023-08-21 12:49:33.508   747-782   KeyguardViewMediator    com.android.systemui                 D  setOccluded(true)
2023-08-21 12:49:33.509  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           I  CarServiceLifecycleListener
2023-08-21 12:49:33.510  1649-1649  FocusAreaHelper         com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] lost focus
2023-08-21 12:49:33.513  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           D  Requested: STOPPED -> VISIBLE
2023-08-21 12:49:33.514   691-748   CAR.EVS                 com.android.car                      I  Transition requested: REQUESTED -> ACTIVE
2023-08-21 12:49:33.517   691-748   CarServiceJNI           com.android.car                      E  /dev/video0 is not available
2023-08-21 12:49:33.517   691-748   CarServiceJNI           com.android.car                      E  Failed to open a camera device
2023-08-21 12:49:33.517   691-748   CAR.EVS                 com.android.car                      E  Failed to open a target camera device
2023-08-21 12:49:33.517   691-748   CAR.EVS                 com.android.car                      E  Transition failed: error = -1
2023-08-21 12:49:33.517  3021-3021  CarEvsCame...ewActivity com.google.android.car.evs           E  Failed to start a video stream, error = -1
2023-08-21 12:49:33.526   747-747   KeyguardViewMediator    com.android.systemui                 D  handleSetOccluded(true)
2023-08-21 12:49:33.529  3021-3037  Parcel                  com.google.android.car.evs           W  Expecting binder but got null!
2023-08-21 12:49:33.538   467-2784  CoreBackPreview         system_process                       D  Window{65e8de5 u0 com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@6ea0b6b, mPriority=0}
2023-08-21 12:49:33.552  1649-1649  FocusParkingView        com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] gained focus
2023-08-21 12:49:33.553  1649-1649  FocusAreaHelper         com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] gained focus
2023-08-21 12:49:33.554  1649-1649  FocusAreaHelper         com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] gained focus
2023-08-21 12:49:33.555   747-747   CarSystemBarController  com.android.systemui                 D  refreshSystemBar: locked?: false homeDisabled: false notificationDisabled: false qcDisabled: false systemIconsDisabled: false
2023-08-21 12:49:33.559  3021-3037  OpenGLRenderer          com.google.android.car.evs           E  Unable to match the desired swap behavior.
2023-08-21 12:49:33.568   691-691   CarPackage...gerService com.android.car                      D  onWindowChange event received
2023-08-21 12:49:33.570   691-691   CarPackage...gerService com.android.car                      D  onWindowChange event received
2023-08-21 12:49:33.581   467-866   CoreBackPreview         system_process                       D  Window{a2cc880 u10 Splash Screen com.google.android.car.evs EXITING}: Setting back callback null
2023-08-21 12:49:33.585   467-866   InputManager-JNI        system_process                       W  Input channel object 'a2cc880 Splash Screen com.google.android.car.evs (client)' was disposed without first being removed with the input manager!
2023-08-21 12:49:33.599   292-382   TransactionTracing      surfaceflinger                       W  Could not find layer handle 0xb400007d40401db0
2023-08-21 12:49:33.600   292-382   TransactionTracing      surfaceflinger                       W  Could not find layer handle 0xb400007d403fcd10
2023-08-21 12:49:33.612  1649-1649  FocusParkingView        com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] lost focus
2023-08-21 12:49:33.613  1649-1649  FocusAreaHelper         com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] lost focus
2023-08-21 12:49:33.613  1649-1649  FocusAreaHelper         com.android.car.carlauncher          D  The window of Activity [com.android.car.carlauncher.AppGridActivity@1398f7d] lost focus
2023-08-21 12:49:33.635   467-484   ActivityTaskManager     system_process                       I  Displayed com.google.android.car.evs/.CarEvsCameraPreviewActivity: +189ms
2023-08-21 12:49:33.647   467-866   InputMetho...gerService system_process                       W  A background user is requesting window. Hiding IME.
2023-08-21 12:49:33.647   467-866   InputMetho...gerService system_process                       W  If you need to impersonate a foreground user/profile from a background user, use EditorInfo.targetInputMethodUser with INTERACT_ACROSS_USERS_FULL permission.
2023-08-21 12:49:33.775   292-382   TransactionTracing      surfaceflinger                       W  Could not find layer id -1
2023-08-21 12:49:33.776   292-382   TransactionTracing      surfaceflinger                       W  Could not find layer id -1
2023-08-21 12:49:35.181   292-382   TransactionTracing      surfaceflinger                       W  Could not find layer id -1
2023-08-21 12:49:35.181   292-382   TransactionTracing      surfaceflinger                       W  Could not find layer id -1

Any idea, how to use the camera in the automotive build?

KonstaT commented 1 year ago

FFmpeg is included in Raspberry Vanilla Automotive builds and it does what it's intended (decoding H.264/H.265/AV1/etc videos).

v4l-utils are debugging tools and are not included in Raspberry Vanilla builds by default. v4l2-ctl is not needed for camera to function. You could easily add it to your build if you need it for debugging. Add https://github.com/lineage-rpi/android_external_v4l-utils/tree/lineage-20.0 to the device manifest and add the tool you want to build in device.mk, e.g.:

PRODUCT_PACKAGES += \
    v4l2-ctl

Raspberry Vanilla includes two camera HALs. libcamera for CSI camera modules: https://github.com/raspberry-vanilla/android_external_libcamera/tree/android-13.0 https://github.com/raspberry-vanilla/android_device_brcm_rpi4/blob/android-13.0/device.mk#L98-L118

Android external camera HAL for UVC webcams: https://source.android.com/docs/core/camera/external-usb-cameras https://github.com/raspberry-vanilla/android_device_brcm_rpi4/blob/android-13.0/device.mk#L89-L96

Both work on Automotive builds as well given you've enabled the default camera service (ENABLE_CAMERA_SERVICE := true). https://android.googlesource.com/platform/packages/services/Car/+/refs/tags/android-13.0.0_r67/car_product/build/car_base.mk#63

I haven't looked into the EVS HAL or if it's even supposed to work with UVC webcams. Again, reading https://android.googlesource.com/platform/packages/services/Car/+/refs/tags/android-13.0.0_r67/car_product/build/car_base.mk, this doesn't seem to be correct way to enable EVS. You would simply need to add:

ENABLE_EVS_SERVICE := true
CUSTOMIZE_EVS_SERVICE_PARAMETER := true #not sure if needed
ENABLE_EVS_SAMPLE := true
ENABLE_CAREVSSERVICE_SAMPLE := true
ENABLE_REAR_VIEW_CAMERA_SAMPLE := true

Error message is very clear at least. Could be e.g. permissions issue (https://github.com/raspberry-vanilla/android_device_brcm_rpi4/blob/android-13.0/ramdisk/ueventd.rpi4.rc#L7) if it's present otherwise.

2023-08-21 12:49:33.517   691-748   CarServiceJNI           com.android.car                      E  /dev/video0 is not available
2023-08-21 12:49:33.517   691-748   CarServiceJNI           com.android.car                      E  Failed to open a camera device
2023-08-21 12:49:33.517   691-748   CAR.EVS                 com.android.car                      E  Failed to open a target camera device
KonstaT commented 1 year ago

EVS HAL and the sample EVS camera preview app seem to work with USB UVC webcam. Image is a bit stretched but I'm not sure if that's intentional. CSI camera modules are not supported with EVS.

Please sync your sources.

Screenshot_20230822-175930

dpetrecki commented 1 year ago

You're awesome! 😍 I've spent a week investigating this issue.