remote-android / redroid-doc

redroid (Remote-Android) is a multi-arch, GPU enabled, Android in Cloud solution. Track issues / docs here
4.26k stars 308 forks source link

add emulator camera support on redroid-11 #52

Open llzz9595 opened 3 years ago

llzz9595 commented 3 years ago

我添加了goldfish相关模块如下,但我发现android11 goldfish camera模块上不会生成camera.goldfish.so,camera依然无法起效。

PRODUCT_SOONG_NAMESPACES += external/mesa3d device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
PRODUCT_PACKAGES += \
    hwcomposer.redroid \
    gralloc.gbm \
    gralloc.redroid \
    libEGL_angle \
    libGLESv1_CM_angle \
    libGLESv2_angle \
    vulkan.pastel \
    libGLES_mesa \
    vulkan.radv \
    ipconfigstore \
    camera.goldfish \
    camera.goldfish.jpeg \
    camera.ranchu \
    camera.ranchu.jpeg \
PRODUCT_PROPERTY_OVERRIDES += \
    ro.kernel.qemu=1 \
    ro.hardware=redroid \
    ro.sf.lcd_density=320 \
    persist.sys.fuse=1 \

# Phone App required
PRODUCT_PACKAGES += \
    rild

# WiFi required by SystemUI
PRODUCT_PACKAGES += \
    android.hardware.wifi@1.0-service

PRODUCT_COPY_FILES += \
    frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \

# required HIDL
PRODUCT_PACKAGES += \
    audio.r_submix.default \
    android.hardware.audio.service \
    android.hardware.audio@4.0-impl \
    android.hardware.audio.effect@4.0-impl \
    android.hardware.drm@1.0-service \
    android.hardware.drm@1.0-impl \
    android.hardware.drm@1.3-service.clearkey \
    android.hardware.gatekeeper@1.0-service.software \
    android.hardware.graphics.allocator@2.0-service \
    android.hardware.graphics.allocator@2.0-impl \
    android.hardware.graphics.mapper@2.0-impl-2.1 \
    android.hardware.graphics.composer@2.1-service \
    android.hardware.graphics.composer@2.1-impl \
    android.hardware.health@2.1-service \
    android.hardware.health@2.1-impl \
    android.hardware.keymaster@3.0-service \
    android.hardware.keymaster@3.0-impl \
    camera.device@1.0-impl \
    android.hardware.camera.provider@2.4-service \
    android.hardware.camera.provider@2.4-impl \

PRODUCT_COPY_FILES += \
    device/generic/goldfish/camera/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
    device/generic/goldfish/camera/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
    frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
    device/generic/goldfish/audio/policy/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
    device/generic/goldfish/audio/policy/primary_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml \
    frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
    frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
    frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
    frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \
    $(LOCAL_PATH)/gpu_config.sh:$(TARGET_COPY_OUT_VENDOR)/bin/gpu_config.sh \
    $(LOCAL_PATH)/init.redroid.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.redroid.rc \
    frameworks/native/data/etc/android.hardware.camera.ar.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.ar.xml \
    frameworks/native/data/etc/android.hardware.camera.autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.autofocus.xml \
    frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
    device/generic/goldfish/camera/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
    device/generic/goldfish/camera/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \

docker容器报错: Could not get passthrough implementation for android.hardware.camera.provider@2.4::ICameraProvider/legacy/0.

zhouziyang commented 3 years ago

try to set ro.hardware.camera=goldfish or ro.hardware.camera=ranchu

llzz9595 commented 3 years ago

camera is running! cameraserver 64 1 0 09:30:52 136:0 00:00:00 android.hardware.camera.provider@2.4-service cameraserver 234 1 0 09:30:54 136:0 00:00:00 cameraserver u0_a118 9007 232 1 09:54:00 136:0 00:00:00 com.android.example.camera2.basic

but the docker has some error like this : 10-25 09:51:12.551 734 1205 E AHardwareBuffer: GraphicBuffer(w=4, h=4, lc=1) failed (Out of memory), handle=0x0

camera still not working

zhouziyang commented 3 years ago

personally, I tested on redroid-9, but redroid-11 should work out of the box. I will look into this soon. you may try some running under software rendering docker run ... redroid.gpu.mode=guest

llzz9595 commented 3 years ago

10-25 11:04:53.930 1833 1833 V CAM_CameraController: Closing camera 10-25 11:04:53.931 1833 1862 W CAM2PORT_AndCamAgntImp: Releasing camera without any camera opened. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No back-facing camera found. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No external camera found. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No front-facing camera found. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No external camera found.

llzz9595 commented 3 years ago

personally, I tested on redroid-9, but redroid-11 should work out of the box. I will look into this soon. you may try some running under software rendering docker run ... redroid.gpu.mode=guest

It ran some error like this when i opened camera:

W ServiceManager: Permission failure: android.permission.SYSTEM_CAMERA from uid=10119 pid=23846

y-shevchenko commented 3 years ago

Work?

zhouziyang commented 2 years ago

for goldfish / ranchu emulator camera, need create a camera service to feed metadata / video stream; and change qemupipe to some other IPC mechanism (socket etc,)

vanokh commented 2 years ago

Is there an easy way to connect camera emulator to v4l2(/dev/video0)? As I understand goldfish is an emulator and included in redroid-11, right?

zhouziyang commented 2 years ago

redroid is a totally different solution compared with goldfish emulator. redroid is a pure container solution, and can access all devices in Host directly. Well, Camera is not emulated in redroid, but feasible. The goldfish camera Hal and v4l2 Hal in AOSP codebase are good samples.

Sent from my iPhone

On Dec 27, 2021, at 11:22 PM, vanokh @.***> wrote:



Is there an easy way to connect camera emulator to v4l2 (/dev/video0)? As I understand goldfish is an emulator and included in redroid-11, right?

— Reply to this email directly, view it on GitHubhttps://github.com/remote-android/redroid-doc/issues/52#issuecomment-1001597839, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAP5VMSHUJAWLBAGPOMOYBLUTB2XDANCNFSM5GUYRQPQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were assigned.Message ID: @.***>

ArtBreguez commented 2 years ago

personally, I tested on redroid-9, but redroid-11 should work out of the box. I will look into this soon. you may try some running under software rendering docker run ... redroid.gpu.mode=guest

It ran some error like this when i opened camera:

W ServiceManager: Permission failure: android.permission.SYSTEM_CAMERA from uid=10119 pid=23846

@llzz9595 did you resolved this error? i'm facing the same thing