Skip to content

Commit

Permalink
miuicamera: Add misys libs
Browse files Browse the repository at this point in the history
* Required for watermark support with MiuiCamera
  • Loading branch information
rayavanindra committed Aug 17, 2024
1 parent 490787b commit 1bca33d
Show file tree
Hide file tree
Showing 28 changed files with 237 additions and 2 deletions.
2 changes: 2 additions & 0 deletions BoardConfigMiuiCamera.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true
TARGET_SYSTEM_PROP += $(MIUICAMERA_PATH)/system.prop

# Sepolicy
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(MIUICAMERA_PATH)/sepolicy/private
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(MIUICAMERA_PATH)/sepolicy/public
BOARD_VENDOR_SEPOLICY_DIRS += $(MIUICAMERA_PATH)/sepolicy/vendor
7 changes: 7 additions & 0 deletions MiuiCamera.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
# Inherit from the proprietary version
$(call inherit-product, vendor/xiaomi/miuicamera/common/common-vendor.mk)

# HIDL
PRODUCT_PACKAGES += \
android.hidl.base@1.0 \
android.hidl.base@1.0.vendor \
android.hidl.memory.block@1.0 \
android.hidl.memory.block@1.0.vendor

# Priv-app permission
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/privapp-permissions-miui.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-miui.xml
Expand Down
27 changes: 27 additions & 0 deletions common/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,33 @@ android_app_import {
privileged: true,
}

prebuilt_etc_xml {
name: "vendor.xiaomi.hardware.misys@1.0",
owner: "xiaomi/miuicamera",
src: "proprietary/vendor/etc/vintf/manifest/vendor.xiaomi.hardware.misys@1.0.xml",
filename_from_src: true,
sub_dir: "vintf/manifest",
soc_specific: true,
}

prebuilt_etc_xml {
name: "vendor.xiaomi.hardware.misys@2.0",
owner: "xiaomi/miuicamera",
src: "proprietary/vendor/etc/vintf/manifest/vendor.xiaomi.hardware.misys@2.0.xml",
filename_from_src: true,
sub_dir: "vintf/manifest",
soc_specific: true,
}

prebuilt_etc_xml {
name: "vendor.xiaomi.hardware.misys@3.0",
owner: "xiaomi/miuicamera",
src: "proprietary/vendor/etc/vintf/manifest/vendor.xiaomi.hardware.misys@3.0.xml",
filename_from_src: true,
sub_dir: "vintf/manifest",
soc_specific: true,
}

install_symlink {
name: "libcamera_algoup_jni.xiaomi_libcamera_algoup_jni.xiaomi_symlink64",
installed_location: "system/priv-app/MiuiCamera/lib/arm64/libcamera_algoup_jni.xiaomi.so",
Expand Down
21 changes: 19 additions & 2 deletions common/common-vendor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,28 @@ PRODUCT_COPY_FILES += \
vendor/xiaomi/miuicamera/common/proprietary/system/lib64/libgallery_mpbase.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/libgallery_mpbase.so \
vendor/xiaomi/miuicamera/common/proprietary/system/lib64/libmibokeh_gallery.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/libmibokeh_gallery.so \
vendor/xiaomi/miuicamera/common/proprietary/system/lib64/librefocus.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/librefocus.so \
vendor/xiaomi/miuicamera/common/proprietary/system/lib64/librefocus_mibokeh.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/librefocus_mibokeh.so
vendor/xiaomi/miuicamera/common/proprietary/system/lib64/librefocus_mibokeh.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/librefocus_mibokeh.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/bin/hw/vendor.xiaomi.hardware.misys@1.0-service:$(TARGET_COPY_OUT_VENDOR)/bin/hw/vendor.xiaomi.hardware.misys@1.0-service \
vendor/xiaomi/miuicamera/common/proprietary/vendor/bin/hw/vendor.xiaomi.hardware.misys@2.0-service:$(TARGET_COPY_OUT_VENDOR)/bin/hw/vendor.xiaomi.hardware.misys@2.0-service \
vendor/xiaomi/miuicamera/common/proprietary/vendor/bin/hw/vendor.xiaomi.hardware.misys@3.0-service:$(TARGET_COPY_OUT_VENDOR)/bin/hw/vendor.xiaomi.hardware.misys@3.0-service \
vendor/xiaomi/miuicamera/common/proprietary/vendor/etc/init/vendor.xiaomi.hardware.misys@1.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.xiaomi.hardware.misys@1.0-service.rc \
vendor/xiaomi/miuicamera/common/proprietary/vendor/etc/init/vendor.xiaomi.hardware.misys@2.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.xiaomi.hardware.misys@2.0-service.rc \
vendor/xiaomi/miuicamera/common/proprietary/vendor/etc/init/vendor.xiaomi.hardware.misys@3.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.xiaomi.hardware.misys@3.0-service.rc \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/hw/vendor.xiaomi.hardware.misys@1.0-impl.so:$(TARGET_COPY_OUT_VENDOR)/lib64/hw/vendor.xiaomi.hardware.misys@1.0-impl.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/hw/vendor.xiaomi.hardware.misys@2.0-impl.so:$(TARGET_COPY_OUT_VENDOR)/lib64/hw/vendor.xiaomi.hardware.misys@2.0-impl.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/hw/vendor.xiaomi.hardware.misys@3.0-impl.so:$(TARGET_COPY_OUT_VENDOR)/lib64/hw/vendor.xiaomi.hardware.misys@3.0-impl.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/libcheckpid.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libcheckpid.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/liblogwrap_vendor.so:$(TARGET_COPY_OUT_VENDOR)/lib64/liblogwrap_vendor.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/vendor.xiaomi.hardware.misys@1.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.xiaomi.hardware.misys@1.0.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/vendor.xiaomi.hardware.misys@2.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.xiaomi.hardware.misys@2.0.so \
vendor/xiaomi/miuicamera/common/proprietary/vendor/lib64/vendor.xiaomi.hardware.misys@3.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.xiaomi.hardware.misys@3.0.so

PRODUCT_PACKAGES += \
MiuiCamera \
MiuiExtraPhoto
MiuiExtraPhoto \
vendor.xiaomi.hardware.misys@1.0 \
vendor.xiaomi.hardware.misys@2.0 \
vendor.xiaomi.hardware.misys@3.0

PRODUCT_PACKAGES += \
libcamera_algoup_jni.xiaomi_libcamera_algoup_jni.xiaomi_symlink64 \
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on fs
mkdir /mnt/vendor/persist/stability 0755 system system
mkdir /mnt/vendor/persist/misys 0755 system system

service vendor.misys /vendor/bin/hw/vendor.xiaomi.hardware.misys@1.0-service
class hal
user system
group system root
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on fs
mkdir /mnt/vendor/persist/stability 0755 system system
mkdir /mnt/vendor/persist/misys 0755 system system

service vendor.misys@2.0 /vendor/bin/hw/vendor.xiaomi.hardware.misys@2.0-service
class hal
user system
group system
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on fs
mkdir /mnt/vendor/persist/stability 0755 system system
mkdir /mnt/vendor/persist/misys 0755 system system

service vendor.misys@3.0 /vendor/bin/hw/vendor.xiaomi.hardware.misys@3.0-service
class hal
user system
group system
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.xiaomi.hardware.misys</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IMiSys</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.xiaomi.hardware.misys</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IMiSys</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.xiaomi.hardware.misys</name>
<transport>hwbinder</transport>
<version>3.0</version>
<interface>
<name>IMiSys</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added common/proprietary/vendor/lib64/libcheckpid.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions proprietary-files.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# All unpinned blobs below are extracted from V14.0.4.0.SJWMIXM (CURTANAGlobal)

# MiSys
vendor/bin/hw/vendor.xiaomi.hardware.misys@1.0-service
vendor/bin/hw/vendor.xiaomi.hardware.misys@2.0-service
vendor/bin/hw/vendor.xiaomi.hardware.misys@3.0-service
vendor/etc/init/vendor.xiaomi.hardware.misys@1.0-service.rc
vendor/etc/init/vendor.xiaomi.hardware.misys@2.0-service.rc
vendor/etc/init/vendor.xiaomi.hardware.misys@3.0-service.rc
vendor/etc/vintf/manifest/vendor.xiaomi.hardware.misys@1.0.xml
vendor/etc/vintf/manifest/vendor.xiaomi.hardware.misys@2.0.xml
vendor/etc/vintf/manifest/vendor.xiaomi.hardware.misys@3.0.xml
vendor/lib64/hw/vendor.xiaomi.hardware.misys@1.0-impl.so
vendor/lib64/hw/vendor.xiaomi.hardware.misys@2.0-impl.so
vendor/lib64/hw/vendor.xiaomi.hardware.misys@3.0-impl.so
vendor/lib64/libcheckpid.so
vendor/lib64/liblogwrap_vendor.so
vendor/lib64/vendor.xiaomi.hardware.misys@1.0.so
vendor/lib64/vendor.xiaomi.hardware.misys@2.0.so
vendor/lib64/vendor.xiaomi.hardware.misys@3.0.so

# MiuiCamera
system/lib64/libcamera_algoup_jni.xiaomi.so;SYMLINK=system/priv-app/MiuiCamera/lib/arm64/libcamera_algoup_jni.xiaomi.so
system/lib64/libcamera_mianode_jni.xiaomi.so;SYMLINK=system/priv-app/MiuiCamera/lib/arm64/libcamera_mianode_jni.xiaomi.so
Expand Down
1 change: 1 addition & 0 deletions sepolicy/private/platform_app.te
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hal_client_domain(platform_app, hal_misys)
1 change: 1 addition & 0 deletions sepolicy/private/priv_app.te
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hal_client_domain(priv_app, hal_misys)
1 change: 1 addition & 0 deletions sepolicy/public/attributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hal_attribute_lineage(misys)
4 changes: 4 additions & 0 deletions sepolicy/vendor/file_contexts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Misys
/(vendor|system/vendor)/bin/hw/vendor\.xiaomi\.hardware\.misys@1\.0-service u:object_r:hal_misys_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.xiaomi\.hardware\.misys@2\.0-service u:object_r:hal_misys_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.xiaomi\.hardware\.misys@3\.0-service u:object_r:hal_misys_default_exec:s0
5 changes: 5 additions & 0 deletions sepolicy/vendor/hal_misys.te
Original file line number Diff line number Diff line change
@@ -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;
13 changes: 13 additions & 0 deletions sepolicy/vendor/hal_misys_default.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 rw_file_perms;
allow hal_misys_default camera_persist_file:dir rw_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)

0 comments on commit 1bca33d

Please sign in to comment.