Integrated with Google Camera HAL
Bug: 142084574
Bug: 131342297
Test: Test camera preview/take picture/recording with settings:
Front Back
emulated emulated
emulated webcam0
emulated virtualscene
webcam0 emulated
webcam0 virtualscene
Change-Id: I4c9d85a76e36085c358a4ada031ca389b8e46b5d
diff --git a/camera/EmulatedCameraFactory.cpp b/camera/EmulatedCameraFactory.cpp
index 414289a..7eabe7a 100755
--- a/camera/EmulatedCameraFactory.cpp
+++ b/camera/EmulatedCameraFactory.cpp
@@ -506,12 +506,11 @@
}
bool EmulatedCameraFactory::isFakeCameraEmulationOn(bool backCamera) {
- /*
- * Defined by 'qemu.sf.fake_camera' boot property. If the property exists,
- * and if it's set to 'both', then fake cameras are used to emulate both
- * sides. If it's set to 'back' or 'front', then a fake camera is used only
- * to emulate the back or front camera, respectively.
- */
+ // Always return false, because another HAL (Google Camera HAL)
+ // will create the fake cameras
+ if (!property_get_bool("ro.kernel.qemu.legacy_fake_camera", false)) {
+ return false;
+ }
char prop[PROPERTY_VALUE_MAX];
if ((property_get("qemu.sf.fake_camera", prop, nullptr) > 0) &&
(!strcmp(prop, "both") ||
diff --git a/manifest.camera.xml b/manifest.camera.xml
index 908c05c..2f81c07 100644
--- a/manifest.camera.xml
+++ b/manifest.camera.xml
@@ -5,6 +5,7 @@
<version>2.4</version>
<interface>
<name>ICameraProvider</name>
+ <instance>internal/0</instance>
<instance>legacy/0</instance>
</interface>
</hal>
diff --git a/sepolicy/common/file_contexts b/sepolicy/common/file_contexts
index 6bcc673..f475b67 100644
--- a/sepolicy/common/file_contexts
+++ b/sepolicy/common/file_contexts
@@ -41,6 +41,7 @@
/vendor/bin/hw/android\.hardware\.health@2\.0-service.goldfish u:object_r:hal_health_default_exec:s0
/vendor/bin/hw/android\.hardware\.power@1\.1-service.ranchu u:object_r:hal_power_default_exec:s0
/vendor/bin/hw/android\.hardware\.thermal@2\.0-service.mock u:object_r:hal_thermal_default_exec:s0
+/vendor/bin/hw/android\.hardware\.camera\.provider@2\.4-service-google u:object_r:hal_camera_default_exec:s0
/vendor/lib(64)?/hw/vulkan\.ranchu\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/hw/gralloc\.ranchu\.so u:object_r:same_process_hal_file:s0
diff --git a/vendor.mk b/vendor.mk
index 8d9a0eb..43fd858 100644
--- a/vendor.mk
+++ b/vendor.mk
@@ -41,6 +41,8 @@
DISABLE_RILD_OEM_HOOK := true
DEVICE_MANIFEST_FILE := device/generic/goldfish/manifest.xml
+PRODUCT_SOONG_NAMESPACES += hardware/google/camera
+PRODUCT_SOONG_NAMESPACES += vendor/google/camera
# Device modules
PRODUCT_PACKAGES += \
@@ -151,7 +153,10 @@
camera.goldfish \
camera.goldfish.jpeg \
camera.ranchu \
- camera.ranchu.jpeg
+ camera.ranchu.jpeg \
+ android.hardware.camera.provider@2.4-service-google \
+ libgooglecamerahwl_impl \
+ android.hardware.camera.provider@2.4-impl-google
DEVICE_MANIFEST_FILE += device/generic/goldfish/manifest.camera.xml
endif
@@ -235,4 +240,7 @@
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/av/services/audiopolicy/config/surround_sound_configuration_5_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/surround_sound_configuration_5_0.xml \
- device/generic/goldfish/data/etc/permissions/privapp-permissions-goldfish.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-goldfish.xml
+ device/generic/goldfish/data/etc/permissions/privapp-permissions-goldfish.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-goldfish.xml \
+ hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_back.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_back.json \
+ hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_front.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_front.json \
+ hardware/google/camera/devices/EmulatedCamera/hwl/configs/emu_camera_depth.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/emu_camera_depth.json \