From 8bf59a6bbddfbcf5036749b15382e917706a72f4 Mon Sep 17 00:00:00 2001 From: Konsta Date: Thu, 30 Oct 2025 10:47:46 +0200 Subject: [PATCH] android: hal: Convert to apex --- src/android/hal/provider/Android.bp | 46 ++++++++++++++++++- ...re.camera.provider-V1-libcamera-service.rc | 9 +++- ...e.camera.provider-V1-libcamera-service.xml | 10 ++++ src/android/hal/provider/apex_file_contexts | 3 ++ src/android/hal/provider/apex_manifest.json | 4 ++ 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.xml create mode 100644 src/android/hal/provider/apex_file_contexts create mode 100644 src/android/hal/provider/apex_manifest.json diff --git a/src/android/hal/provider/Android.bp b/src/android/hal/provider/Android.bp index 40d11a1b..ea376552 100644 --- a/src/android/hal/provider/Android.bp +++ b/src/android/hal/provider/Android.bp @@ -38,6 +38,7 @@ cc_library_shared { srcs: ["LibcameraProvider.cpp"], export_include_dirs: ["."], defaults: ["libcamera_aidl_defaults"], + installable: false, } cc_defaults { @@ -50,6 +51,49 @@ cc_defaults { cc_binary { name: "android.hardware.camera.provider-V1-libcamera-service", - init_rc: ["android.hardware.camera.provider-V1-libcamera-service.rc"], defaults: ["camera_service.libcamera_defaults"], + installable: false, +} + +prebuilt_etc { + name: "android.hardware.camera.provider-V1-libcamera-service.rc", + src: "android.hardware.camera.provider-V1-libcamera-service.rc", + installable: false, +} + +prebuilt_etc { + name: "android.hardware.camera.provider-V1-libcamera-service.xml", + src: "android.hardware.camera.provider-V1-libcamera-service.xml", + sub_dir: "vintf", + installable: false, +} + +apex { + name: "com.android.hardware.camera.libcamera", + manifest: "apex_manifest.json", + file_contexts: "apex_file_contexts", + key: "com.android.hardware.key", + certificate: ":com.android.hardware.certificate", + updatable: false, + vendor: true, + + binaries: [ + "android.hardware.camera.provider-V1-libcamera-service", + ], + native_shared_libs: [ + "camera.libcamera", + ] + select(soong_config_variable("libcamera", "ipa"), { + "pisp": ["ipa_rpi_pisp"], + "vc4": ["ipa_rpi_vc4"], + default: [], + }), + prebuilts: [ + "android.hardware.camera.provider-V1-libcamera-service.rc", + "android.hardware.camera.provider-V1-libcamera-service.xml", + "backend_default_config.json", + ] + select(soong_config_variable("libcamera", "ipa"), { + "pisp": ["libcamera-rpi-ipa_rpi_pisp_data"], + "vc4": ["libcamera-rpi-ipa_rpi_vc4_data"], + default: [], + }), } diff --git a/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.rc b/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.rc index 6f986265..162347b6 100644 --- a/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.rc +++ b/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.rc @@ -1,4 +1,8 @@ -service vendor.camera.provider-libcamera /vendor/bin/hw/android.hardware.camera.provider-V1-libcamera-service +on property:apex.all.ready=true + setprop ro.hardware.camera libcamera + start vendor.camera.provider-libcamera + +service vendor.camera.provider-libcamera /apex/com.android.hardware.camera.libcamera/bin/hw/android.hardware.camera.provider-V1-libcamera-service interface aidl android.hardware.camera.provider.ICameraProvider/libcamera/0 class hal user cameraserver @@ -6,5 +10,8 @@ service vendor.camera.provider-libcamera /vendor/bin/hw/android.hardware.camera. ioprio rt 4 capabilities SYS_NICE task_profiles CameraServiceCapacity MaxPerformance + setenv LIBCAMERA_IPA_CONFIG_PATH /apex/com.android.hardware.camera.libcamera/etc/libcamera/ipa/ + setenv LIBCAMERA_IPA_MODULE_PATH /apex/com.android.hardware.camera.libcamera/lib64/libcamera/ipa/ setenv LIBCAMERA_LOG_LEVELS *:WARN setenv LIBCAMERA_LOG_FILE syslog + disabled diff --git a/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.xml b/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.xml new file mode 100644 index 00000000..b821a72d --- /dev/null +++ b/src/android/hal/provider/android.hardware.camera.provider-V1-libcamera-service.xml @@ -0,0 +1,10 @@ + + + android.hardware.camera.provider + 1 + + ICameraProvider + libcamera/0 + + + diff --git a/src/android/hal/provider/apex_file_contexts b/src/android/hal/provider/apex_file_contexts new file mode 100644 index 00000000..c96d9c21 --- /dev/null +++ b/src/android/hal/provider/apex_file_contexts @@ -0,0 +1,3 @@ +(/.*)? u:object_r:vendor_file:s0 +/etc(/.*)? u:object_r:vendor_configs_file:s0 +/bin/hw/android\.hardware\.camera\.provider-V1-libcamera-service u:object_r:hal_camera_default_exec:s0 diff --git a/src/android/hal/provider/apex_manifest.json b/src/android/hal/provider/apex_manifest.json new file mode 100644 index 00000000..aeb53ee8 --- /dev/null +++ b/src/android/hal/provider/apex_manifest.json @@ -0,0 +1,4 @@ +{ + "name": "com.android.hardware.camera.libcamera", + "version": 1 +}