adapt miui camera for common tree

This commit is contained in:
alucard-storm 2023-02-01 23:22:02 +05:30
parent 110f4cc860
commit 58b4ca4fc0
31 changed files with 137 additions and 5 deletions

View file

@ -9,7 +9,7 @@ android_app_import {
name: "MiuiCamera",
owner: "xiaomi",
apk: "proprietary/system/priv-app/MiuiCamera/MiuiCamera.apk",
overrides: ["Snap", "GoogleCameraGo", "GrapheneCamera", "Camera", "Aperture"],
overrides: ["GrapheneCamera", "Camera2", "Aperture"],
certificate: "platform",
dex_preopt: {
enabled: false,

View file

@ -33,5 +33,11 @@ PRODUCT_COPY_FILES += \
vendor/xiaomi/haydn-miuicamera/common/proprietary/vendor/lib64/vendor.qti.hardware.camera.device@1.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.qti.hardware.camera.device@1.0.so \
vendor/xiaomi/haydn-miuicamera/common/proprietary/vendor/lib64/vendor.qti.hardware.camera.device@3.5.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.qti.hardware.camera.device@3.5.so
TARGET_USE_PREBUILD_CAMERA_SERVICE ?= false
ifeq ($(TARGET_USE_PREBUILD_CAMERA_SERVİCE),true)
PRODUCT_COPY_FILES += \
vendor/xiaomi/haydn-miuicamera/common/proprietary/system/lib64/libcameraservice.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/libcameraservice.so
endif
PRODUCT_PACKAGES += \
MiuiCamera

Binary file not shown.

0
extract-files.sh Executable file → Normal file
View file

18
init/init.miuicamera.rc Normal file
View file

@ -0,0 +1,18 @@
#
# Copyright (C) 2021 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
# Miui camera
on boot && property:ro.boot.hwc=CN
setprop ro.product.mod_device "haydn"
on boot && property:ro.boot.hwc=CN && property:ro.boot.hardware.sku=haydnpro
setprop ro.product.mod_device "haydn"
on boot && property:ro.boot.hwc=GL
setprop ro.product.mod_device "haydn_global"
on boot && property:ro.boot.hwc=IN
setprop ro.product.mod_device "haydn_in_global"

View file

@ -14,6 +14,8 @@
# limitations under the License.
#
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += vendor/xiaomi/haydn-miuicamera/sepolicy/private
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += vendor/xiaomi/haydn-miuicamera/sepolicy/public
BOARD_VENDOR_SEPOLICY_DIRS += vendor/xiaomi/haydn-miuicamera/sepolicy/vendor
include vendor/xiaomi/haydn-miuicamera/common/BoardConfigVendor.mk

View file

@ -23,16 +23,26 @@ PRODUCT_COPY_FILES += \
PRODUCT_COPY_FILES += \
vendor/xiaomi/haydn-miuicamera/configs/sysconfig/miuicamera-hiddenapi-package-whitelist.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/sysconfig/miuicamera-hiddenapi-package-whitelist.xml
# Miui Camera init rc file
PRODUCT_COPY_FILES += \
vendor/xiaomi/haydn-miuicamera/init/init.miuicamera.rc:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/init/init.miuicamera.rc
# Props
PRODUCT_PRODUCT_PROPERTIES += \
ro.com.google.lens.oem_camera_package=com.android.camera
PRODUCT_SYSTEM_PROPERTIES += \
persist.vendor.camera.privapp.list=com.android.camera \
vendor.camera.aux.packagelist=com.android.camera,org.pixelexperience.faceunlock
vendor.camera.aux.packagelist=com.android.camera,org.pixelexperience.faceunlock \
persist.vendor.camera.privapp.list=com.android.camera
PRODUCT_VENDOR_PROPERTIES += \
ro.hardware.camera=xiaomi
PRODUCT_PACKAGES += \
DisableCamera2 \
DisableMiuiCamera
DisableMiuiCamera \
MiuiCameraOverlayLos \
MiuiCameraOverlayAosp
$(call inherit-product, vendor/xiaomi/haydn-miuicamera/common/common-vendor.mk)

View file

@ -1,6 +1,6 @@
# All unpinned blobs below are extracted from miui_HAYDNGlobal_V13.0.1.0.SKKMIXM
-system/priv-app/MiuiCamera/MiuiCamera.apk;OVERRIDES=Snap,GoogleCameraGo
-system/priv-app/MiuiCamera/MiuiCamera.apk;OVERRIDES=GrapheneCamera,Camera2,Aperture
system/lib64/android.hardware.camera.common@1.0.so
system/lib64/libcamera_algoup_jni.xiaomi.so
system/lib64/libcamera_mianode_jni.xiaomi.so

View file

@ -0,0 +1,4 @@
runtime_resource_overlay {
name: "MiuiCameraOverlayAosp",
product_specific: true,
}

View file

@ -0,0 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.overlay.miuicameraosp"
android:versionCode="1"
android:versionName="1.0">
<overlay android:targetPackage="android" android:priority="1" android:isStatic="true"/>
</manifest>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- The list of package IDs that are allowed to use aux cameras.
NOTE: If this list is empty then all apps will be able to use aux cameras. -->
<string-array name="config_cameraAuxPackageAllowList" translatable="false">
<item>com.android.camera</item>
<item>org.lineageos.aperture</item>
<item>org.lineageos.aperture.dev</item>
<item>com.crdroid.faceunlock</item>
<item>org.pixelexperience.faceunlock</item>
</string-array>
</resources>

View file

@ -0,0 +1,4 @@
runtime_resource_overlay {
name: "MiuiCameraOverlayLos",
product_specific: true,
}

View file

@ -0,0 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.overlay.miuicameralos"
android:versionCode="1"
android:versionName="1.0">
<overlay android:targetPackage="lineageos.platform" android:priority="1" android:isStatic="true"/>
</manifest>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- The list of package IDs that are allowed to use aux cameras.
NOTE: If this list is empty then all apps will be able to use aux cameras. -->
<string-array name="config_cameraAuxPackageAllowList" translatable="false">
<item>com.android.camera</item>
<item>org.lineageos.aperture</item>
<item>org.lineageos.aperture.dev</item>
<item>com.crdroid.faceunlock</item>
<item>org.pixelexperience.faceunlock</item>
</string-array>
</resources>

View file

@ -0,0 +1,3 @@
allow cameraserver property_socket:sock_file write;
allow cameraserver init:unix_stream_socket connectto;
set_prop(cameraserver, exported_system_prop)

View file

@ -0,0 +1,2 @@
# Camera
/vendor/camera(/.*)? u:object_r:vendor_configs_file:s0

View file

@ -0,0 +1 @@
hal_client_domain(platform_app, hal_misys)

View file

@ -0,0 +1 @@
hal_client_domain(priv_app, hal_misys)

View file

@ -0,0 +1,2 @@
# Miui Camera
sys.camera.miui.apk u:object_r:exported_system_prop:s0

View file

@ -0,0 +1 @@
hal_attribute_lineage(misys)

3
sepolicy/vendor/file_contexts vendored Normal file
View file

@ -0,0 +1,3 @@
/vendor/bin/hw/vendor\.xiaomi\.hardware\.misys@1\.0-service u:object_r:hal_misys_default_exec:s0
/vendor/bin/hw/vendor\.xiaomi\.hardware\.misys@2\.0-service u:object_r:hal_misys_default_exec:s0
/vendor/bin/hw/vendor\.xiaomi\.hardware\.misys@3\.0-service u:object_r:hal_misys_default_exec:s0

View file

@ -1,7 +1,11 @@
type hal_camerapostproc_xiaomi_hwservice, hwservice_manager_type;
get_prop(hal_camera_default, vendor_fp_prop)
binder_call(hal_camera_default, platform_app)
add_hwservice(hal_camera_default, hal_camerapostproc_xiaomi_hwservice)
allow hal_camera_default mnt_vendor_file:dir { search };
allow hal_camera_default proc_stat:file { open read };
allow hal_camera_default vendor_xdsp_device:chr_file { read };

5
sepolicy/vendor/hal_misys.te vendored Normal file
View file

@ -0,0 +1,5 @@
# HwBinder IPC from client to server
binder_call(hal_misys_client, hal_misys_server)
add_hwservice(hal_misys_server, hal_misys_hwservice)
allow hal_misys_client hal_misys_hwservice:hwservice_manager find;

15
sepolicy/vendor/hal_misys_default.te vendored Normal file
View file

@ -0,0 +1,15 @@
type hal_misys_default, domain;
hal_server_domain(hal_misys_default, hal_misys)
type hal_misys_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_misys_default)
allow hal_misys_default camera_persist_file:file create_file_perms;
allow hal_misys_default camera_persist_file:dir create_dir_perms;
r_dir_file(hal_misys_default, firmware_file)
r_dir_file(hal_misys_default, mnt_vendor_file)
get_prop(hal_misys_default, vendor_camera_prop)
get_prop(hal_misys_default, vendor_camera_sensor_prop);

1
sepolicy/vendor/hwservice.te vendored Normal file
View file

@ -0,0 +1 @@
type hal_misys_hwservice, hwservice_manager_type;

3
sepolicy/vendor/hwservice_contexts vendored Normal file
View file

@ -0,0 +1,3 @@
# Miui camera
vendor.xiaomi.hardware.misys::IMiSys u:object_r:hal_misys_hwservice:s0
vendor.xiaomi.hardware.campostproc::IMiPostProcService u:object_r:hal_camerapostproc_xiaomi_hwservice:s0

View file

@ -5,3 +5,9 @@ binder_call(platform_app, hal_camera_default)
get_prop(platform_app, vendor_camera_sensor_prop);
get_prop(platform_app, vendor_fp_prop)
allow platform_app cgroup:file r_file_perms;
allow platform_app hal_misys_hwservice:hwservice_manager find;
allow platform_app miui_multi_display:service_manager find;

1
sepolicy/vendor/priv_app.te vendored Normal file
View file

@ -0,0 +1 @@
allow priv_app cgroup:file r_file_perms;

1
sepolicy/vendor/service.te vendored Normal file
View file

@ -0,0 +1 @@
type miui_multi_display, service_manager_type;

1
sepolicy/vendor/service_contexts vendored Normal file
View file

@ -0,0 +1 @@
miui_multi_display u:object_r:miui_multi_display:s0

0
setup-makefiles.sh Executable file → Normal file
View file