Initial MiuiCamera for zeus

This commit is contained in:
Arian 2023-07-09 23:17:33 +02:00
commit 8559d0e599
12 changed files with 216 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
MiuiCamera/

16
BoardConfig.mk Normal file
View File

@ -0,0 +1,16 @@
#
# Copyright (C) 2023 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
# Inherit from the proprietary version
include vendor/xiaomi/miuicamera-zeus/BoardConfigVendor.mk
MIUICAMERA_PATH := device/xiaomi/miuicamera-zeus
# Properties
TARGET_SYSTEM_PROP += $(MIUICAMERA_PATH)/system.prop
# Sepolicy
BOARD_VENDOR_SEPOLICY_DIRS += $(MIUICAMERA_PATH)/sepolicy/vendor

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<hidden-api-whitelisted-app package="com.android.camera" />
</config>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="com.android.camera">
<permission name="android.permission.WRITE_MEDIA_STORAGE" />
<permission name="android.permission.WRITE_SECURE_SETTINGS" />
<permission name="android.permission.INTERACT_ACROSS_USERS" />
<permission name="mediatek.permission.ACCESS_APU_SYS" />
<permission name="android.permission.LOG_COMPAT_CHANGE" />
<permission name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
<permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
<permission name="android.permission.SYSTEM_CAMERA" />
</privapp-permissions>
</permissions>

20
device.mk Normal file
View File

@ -0,0 +1,20 @@
#
# Copyright (C) 2023 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
# Inherit from the proprietary version
$(call inherit-product, vendor/xiaomi/miuicamera-zeus/miuicamera-zeus-vendor.mk)
# Priv-app permission
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/privapp-permissions-miuicamera.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-miuicamera.xml
# Shims
PRODUCT_PACKAGES += \
libgui_shim_miuicamera
# Sysconfig
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/miuicamera-hiddenapi-package-allowlist.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/sysconfig/miuicamera-hiddenapi-package-allowlist.xml

72
extract-files.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
DEVICE=miuicamera-zeus
VENDOR=xiaomi
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.."
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"
# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true
KANG=
SECTION=
while [ "${#}" -gt 0 ]; do
case "${1}" in
-n | --no-cleanup )
CLEAN_VENDOR=false
;;
-k | --kang )
KANG="--kang"
;;
-s | --section )
SECTION="${2}"; shift
CLEAN_VENDOR=false
;;
* )
SRC="${1}"
;;
esac
shift
done
if [ -z "${SRC}" ]; then
SRC="adb"
fi
function blob_fixup() {
case "${1}" in
system/lib64/libcamera_algoup_jni.xiaomi.so|system/lib64/libcamera_mianode_jni.xiaomi.so)
"${PATCHELF}" --add-needed "libgui_shim_miuicamera.so" "${2}"
;;
system/lib64/libmicampostproc_client.so)
"${PATCHELF}" --remove-needed "libhidltransport.so" "${2}"
;;
esac
}
# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
"${MY_DIR}/setup-makefiles.sh"

8
proprietary-files.txt Normal file
View File

@ -0,0 +1,8 @@
# All unpinned blobs below are extracted from zeus V14.0.7.0.TLBMIXM
product/priv-app/MiuiCamera/MiuiCamera.apk:system/priv-app/MiuiCamera/MiuiCamera.apk|962075aefbc57006f05aabf79cfdfc96e5bf0682
system/etc/public.libraries-xiaomi.txt
system/lib64/libcamera_algoup_jni.xiaomi.so
system/lib64/libcamera_mianode_jni.xiaomi.so
system/lib64/libmicampostproc_client.so
system/lib64/vendor.xiaomi.hardware.campostproc@1.0.so

18
sepolicy/vendor/platform_app.te vendored Normal file
View File

@ -0,0 +1,18 @@
hal_client_domain(platform_app, vendor_hal_camerapostproc_xiaomi)
binder_use(platform_app)
binder_call(platform_app, vendor_hal_camerapostproc_xiaomi)
allow platform_app vendor_hal_camerapostproc_xiaomi_hwservice:hwservice_manager find;
allow platform_app adsprpcd_file:dir { open read search };
allow platform_app vendor_xdsp_device:chr_file { ioctl open read write };
allow platform_app vendor_qdsp_device:chr_file { ioctl open read write };
allow platform_app vendor_camera_data_file:dir { append map r_dir_perms write };
allow platform_app vendor_camera_data_file:file { getattr open read };
# Properties
allow platform_app vendor_display_prop:file read;
get_prop(platform_app, vendor_camera_sensor_prop)
get_prop(platform_app, vendor_displayfeature_prop)
get_prop(platform_app, vendor_panel_info_prop)

36
setup-makefiles.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
DEVICE=miuicamera-zeus
VENDOR=xiaomi
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.."
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"
# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}"
# Warning headers and guards
write_headers
write_makefiles "${MY_DIR}/proprietary-files.txt" true
# Finish
write_footers

10
shims/Android.bp Normal file
View File

@ -0,0 +1,10 @@
//
// Copyright (C) 2022 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library {
name: "libgui_shim_miuicamera",
srcs: ["libgui_shim_miuicamera.c"],
}

View File

@ -0,0 +1,9 @@
/*
* Copyright (C) 2023 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
void _ZN7android18BnProducerListener16onBufferDetachedEi() {
return;
}

9
system.prop Normal file
View File

@ -0,0 +1,9 @@
# Google Lens
ro.com.google.lens.oem_camera_package=com.android.camera
# Framework allowlists
persist.vendor.camera.privapp.list=com.android.camera
#vendor.camera.aux.packagelist=com.android.camera
# MiuiCamera
ro.miui.notch=1