├── setup-makefiles.py
├── sepolicy
├── vendor
│ ├── hal_mlipay.te
│ ├── hal_mfidoca.te
│ ├── vndservicemanager.te
│ ├── hal_tidaservice.te
│ ├── device.te
│ ├── hal_power.te
│ ├── platform_app.te
│ ├── hal_graphics_composer.te
│ ├── hal_aospa_powershare.te
│ ├── hal_camera_aon.te
│ ├── hal_fingerprint_hwservice_xiaomi.te
│ ├── vendor_init.te
│ ├── property.te
│ ├── attributes
│ ├── service_contexts
│ ├── hal_camera_default.te
│ ├── hal_sensors.te
│ ├── hal_usb.te
│ ├── hal_bluetooth.te
│ ├── hal_lineage_health.te
│ ├── hvdcp.te
│ ├── init.te
│ ├── file.te
│ ├── qti_init_shell.te
│ ├── system_server.te
│ ├── tee.te
│ ├── hal_eid.te
│ ├── hwservice_contexts
│ ├── property_contexts
│ ├── vendor_sensor_notifier.te
│ ├── hal_eid_rc.te
│ ├── hal_slaservice.te
│ ├── dtool.te
│ ├── modem_manager.te
│ ├── file_contexts
│ ├── wcnss_service.te
│ ├── genfs_contexts
│ └── hal_fingerprint.te
├── public
│ └── file.te
└── private
│ ├── seapp_contexts
│ └── parts_app.te
├── overlays
├── DeviceAsWebcamRes
│ ├── res
│ │ └── raw
│ │ │ └── ignored_v4l2_nodes.json
│ ├── Android.bp
│ └── AndroidManifest.xml
├── Frameworks
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── config.xml
├── Settings
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── config.xml
├── SystemUI
│ ├── Android.bp
│ ├── res
│ │ └── values
│ │ │ └── config.xml
│ └── AndroidManifest.xml
├── EuiccGoogle
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── config.xml
├── FrameworksEuicc
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── config.xml
├── SecureElement
│ ├── Android.bp
│ ├── res
│ │ └── values
│ │ │ └── config.xml
│ └── AndroidManifest.xml
├── SystemUIAOSPA
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── config.xml
├── FrameworksAOSPA
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── config.xml
├── CarrierConfigRes
│ ├── Android.bp
│ └── AndroidManifest.xml
├── Nfc
│ ├── AndroidManifest.xml
│ ├── res
│ │ └── values
│ │ │ └── config.xml
│ ├── Android.bp
│ └── AndroidManifestST.xml
└── WifiRes
│ ├── Android.bp
│ ├── AndroidManifest.xml
│ ├── AndroidGoogleManifest.xml
│ └── res
│ └── values
│ └── config.xml
├── configs
├── sensors
│ └── hals.conf
├── properties
│ ├── system.prop
│ ├── odm.prop
│ └── vendor.prop
├── permissions
│ ├── privapp-permissions-hotword.xml
│ └── privapp-permissions-euiccgoogle.xml
└── vintf
│ ├── manifest_xiaomi.xml
│ └── manifest_kalama.xml
├── init
├── init.mi_perf.rc
├── Android.bp
├── init.mi_service.rc
├── init.mi_udfps.rc
├── init_xiaomi8550.cpp
├── ueventd.xiaomi.rc
└── fstab.qcom
├── sensors
├── sensor-notifier.rc
├── SensorNotifierUtils.h
├── AodNotifier.h
├── NonUiNotifier.h
├── Android.bp
├── main.cpp
├── SensorNotifier.h
├── SensorNotifierUtils.cpp
├── SensorNotifier.cpp
├── NonUiNotifier.cpp
└── AodNotifier.cpp
├── Android.mk
├── README.md
├── udfps
├── Android.bp
└── UdfpsHandler.cpp
├── parts
├── res
│ ├── xml
│ │ └── settings_esim.xml
│ ├── values
│ │ └── strings.xml
│ └── drawable
│ │ └── ic_sim_card_download.xml
├── src
│ └── com
│ │ └── xiaomi
│ │ └── settings
│ │ ├── telephony
│ │ ├── EsimSettingsActivity.kt
│ │ ├── EsimSettingsFragment.kt
│ │ └── EsimController.kt
│ │ ├── utils
│ │ └── FileUtils.kt
│ │ ├── display
│ │ ├── DisplayFeatureWrapper.kt
│ │ ├── DcDimmingService.kt
│ │ └── ColorService.kt
│ │ ├── touch
│ │ └── TouchOrientationService.kt
│ │ ├── BootCompletedReceiver.kt
│ │ └── SummaryProvider.kt
├── Android.bp
├── permissions
│ └── privapp_whitelist_com.xiaomi.settings.xml
└── AndroidManifest.xml
├── power
└── power-mode.cpp
├── blob-patches
└── mirilhook.patch
├── Android.bp
├── reorder-libs.py
├── update-sha1sums.py
├── BoardConfigCommon.mk
├── extract-files.py
└── common.mk
/setup-makefiles.py:
--------------------------------------------------------------------------------
1 | #!./extract-files.py --regenerate_makefiles
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_mlipay.te:
--------------------------------------------------------------------------------
1 | get_prop(hal_mlipay_default, vendor_fp_prop)
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_mfidoca.te:
--------------------------------------------------------------------------------
1 | get_prop(hal_mfidoca_default, vendor_fp_prop)
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/vndservicemanager.te:
--------------------------------------------------------------------------------
1 | binder_call(vndservicemanager, vendor_cnd)
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_tidaservice.te:
--------------------------------------------------------------------------------
1 | get_prop(hal_tidaservice_default, vendor_fp_prop)
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/device.te:
--------------------------------------------------------------------------------
1 | # Fingerprint
2 | type vendor_fingerprint_device, dev_type;
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_power.te:
--------------------------------------------------------------------------------
1 | allow hal_power_default sysfs_thermal:file rw_file_perms;
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/platform_app.te:
--------------------------------------------------------------------------------
1 | # Soter
2 | hal_client_domain(platform_app, vendor_hal_soter);
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_graphics_composer.te:
--------------------------------------------------------------------------------
1 | hal_client_domain(hal_graphics_composer_default, vendor_hal_eid)
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_aospa_powershare.te:
--------------------------------------------------------------------------------
1 | allow hal_aospa_powershare_default vendor_sysfs_qcom_battery:dir r_dir_perms;
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_camera_aon.te:
--------------------------------------------------------------------------------
1 | type hal_camera_aon_service, hal_service_type, protected_service, service_manager_type;
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_fingerprint_hwservice_xiaomi.te:
--------------------------------------------------------------------------------
1 | type vendor_hal_fingerprint_hwservice_xiaomi, hwservice_manager_type;
2 |
--------------------------------------------------------------------------------
/sepolicy/vendor/vendor_init.te:
--------------------------------------------------------------------------------
1 | # Allow vendor init to set fingerprint property
2 | set_prop(vendor_init, vendor_fp_prop)
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/property.te:
--------------------------------------------------------------------------------
1 | # Fingerprint
2 | vendor_public_prop(vendor_fp_prop)
3 | vendor_restricted_prop(vendor_fp_info_prop)
4 |
--------------------------------------------------------------------------------
/sepolicy/vendor/attributes:
--------------------------------------------------------------------------------
1 | # SLA
2 | attribute hal_slaservice;
3 | attribute hal_slaservice_client;
4 | attribute hal_slaservice_server;
5 |
--------------------------------------------------------------------------------
/sepolicy/vendor/service_contexts:
--------------------------------------------------------------------------------
1 | # Camera
2 | vendor.xiaomi.hardware.aon.IAlwaysOn/miaonservicehal u:object_r:hal_camera_aon_service:s0
3 |
--------------------------------------------------------------------------------
/overlays/DeviceAsWebcamRes/res/raw/ignored_v4l2_nodes.json:
--------------------------------------------------------------------------------
1 | [
2 | "/dev/video0",
3 | "/dev/video1",
4 | "/dev/video32",
5 | "/dev/video33"
6 | ]
7 |
--------------------------------------------------------------------------------
/sepolicy/public/file.te:
--------------------------------------------------------------------------------
1 | # Fingerprint
2 | type sysfs_tp_fodstatus, fs_type, sysfs_type;
3 |
4 | # Touch
5 | type sysfs_tp_touchfeature, fs_type, sysfs_type;
6 |
--------------------------------------------------------------------------------
/configs/sensors/hals.conf:
--------------------------------------------------------------------------------
1 | sensors.dynamic_sensor_hal.so
2 | sensors.ssc.so
3 | sensors.touch.detect.so
4 | vl53l5.hal@2.0.so
5 | subwaystate.hal.so
6 | sensors.xiaomi.so
--------------------------------------------------------------------------------
/sepolicy/private/seapp_contexts:
--------------------------------------------------------------------------------
1 | # Parts
2 | user=system seinfo=platform isPrivApp=true name=com.xiaomi.settings domain=parts_app type=system_app_data_file levelFrom=all
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_camera_default.te:
--------------------------------------------------------------------------------
1 | allow hal_camera_client hal_camera_aon_service:service_manager find;
2 | add_service(hal_camera_server, hal_camera_aon_service)
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_sensors.te:
--------------------------------------------------------------------------------
1 | allow hal_sensors_default sysfs_tp_fodstatus:file r_file_perms;
2 | allow hal_sensors_default sysfs_tp_touchfeature:file rw_file_perms;
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_usb.te:
--------------------------------------------------------------------------------
1 | allow vendor_hal_usb_qti vendor_sysfs_qcom_battery:dir r_dir_perms;
2 | allow vendor_hal_usb_qti vendor_sysfs_qcom_battery:file r_file_perms;
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_bluetooth.te:
--------------------------------------------------------------------------------
1 | allow hal_bluetooth_default vendor_mac_vendor_data_file:dir r_dir_perms;
2 | allow hal_bluetooth_default vendor_mac_vendor_data_file:file r_file_perms;
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_lineage_health.te:
--------------------------------------------------------------------------------
1 | allow hal_lineage_health_default vendor_sysfs_qcom_battery:dir r_dir_perms;
2 | allow hal_lineage_health_default vendor_sysfs_qcom_battery:file rw_file_perms;
3 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hvdcp.te:
--------------------------------------------------------------------------------
1 | r_dir_file(vendor_hvdcp, vendor_sysfs_battery_supply)
2 | r_dir_file(vendor_hvdcp, vendor_sysfs_iio)
3 | r_dir_file(vendor_hvdcp, sysfs)
4 | set_prop(vendor_hvdcp, ctl_stop_prop)
5 |
--------------------------------------------------------------------------------
/sepolicy/vendor/init.te:
--------------------------------------------------------------------------------
1 | # OverlayFS
2 | allow init system_file:file mounton;
3 | allow init vendor_configs_file:dir mounton;
4 | allow init vendor_file:dir mounton;
5 | allow init vendor_firmware_file:dir mounton;
6 |
--------------------------------------------------------------------------------
/overlays/Frameworks/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550Frameworks",
9 | device_specific: true,
10 | }
--------------------------------------------------------------------------------
/overlays/Settings/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550Settings",
9 | device_specific: true,
10 | }
11 |
--------------------------------------------------------------------------------
/overlays/SystemUI/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550SystemUI",
9 | device_specific: true,
10 | }
--------------------------------------------------------------------------------
/init/init.mi_perf.rc:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2023-2024 Paranoid Android
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | on property:vendor.post_boot.parsed=1
6 | # Set default thermal profile
7 | write /sys/class/thermal/thermal_message/sconfig 0
8 |
--------------------------------------------------------------------------------
/overlays/EuiccGoogle/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550EuiccGoogle",
9 | device_specific: true,
10 | }
11 |
--------------------------------------------------------------------------------
/overlays/FrameworksEuicc/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2025 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550FrameworksEuicc",
9 | device_specific: true,
10 | }
--------------------------------------------------------------------------------
/overlays/SecureElement/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550SecureElement",
9 | device_specific: true,
10 | }
11 |
--------------------------------------------------------------------------------
/overlays/SystemUIAOSPA/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550SystemUIAOSPA",
9 | device_specific: true,
10 | }
--------------------------------------------------------------------------------
/overlays/DeviceAsWebcamRes/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2024 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550DeviceAsWebcamRes",
9 | vendor: true,
10 | }
11 |
--------------------------------------------------------------------------------
/sensors/sensor-notifier.rc:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2024 The LineageOS Project
3 | #
4 | # SPDX-License-Identifier: Apache-2.0
5 | #
6 |
7 | service vendor.sensor-notifier /vendor/bin/sensor-notifier
8 | class main
9 | user system
10 | group system
11 |
--------------------------------------------------------------------------------
/overlays/FrameworksAOSPA/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550FrameworksAOSPA",
9 | device_specific: true,
10 | }
11 |
--------------------------------------------------------------------------------
/sepolicy/vendor/file.te:
--------------------------------------------------------------------------------
1 | # Fingerprint
2 | type vendor_fingerprint_data_file, data_file_type, file_type;
3 | type vendor_fingerprint_data_file_fpdump, data_file_type, file_type;
4 |
5 | # Wifi
6 | type vendor_mac_vendor_data_file, data_file_type, file_type, mlstrustedobject;
7 |
--------------------------------------------------------------------------------
/Android.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2023-2024 Paranoid Android
3 | #
4 | # SPDX-License-Identifier: Apache-2.0
5 | #
6 |
7 | LOCAL_PATH := $(call my-dir)
8 |
9 | ifneq ($(filter fuxi nuwa ishtar vermeer,$(TARGET_DEVICE)),)
10 |
11 | include $(call all-makefiles-under,$(LOCAL_PATH))
12 |
13 | endif
14 |
--------------------------------------------------------------------------------
/overlays/CarrierConfigRes/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550CarrierConfigRes",
9 | device_specific: true,
10 | aaptflags: ["--keep-raw-values"],
11 | }
--------------------------------------------------------------------------------
/sepolicy/vendor/qti_init_shell.te:
--------------------------------------------------------------------------------
1 | allow vendor_qti_init_shell sysfs_fastcharge:file { setattr };
2 | allow vendor_qti_init_shell sysfs_powershare:file { setattr };
3 | allow vendor_qti_init_shell touchfeature_device:chr_file { setattr };
4 | allow vendor_qti_init_shell vendor_sysfs_qcom_battery:file { setattr };
5 |
--------------------------------------------------------------------------------
/overlays/SecureElement/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 | false
6 |
7 |
--------------------------------------------------------------------------------
/overlays/SystemUI/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 | true
6 |
--------------------------------------------------------------------------------
/sensors/SensorNotifierUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | #include
12 |
13 | bool readBool(int fd);
14 | std::shared_ptr parseDispEvent(int fd);
15 |
--------------------------------------------------------------------------------
/configs/properties/system.prop:
--------------------------------------------------------------------------------
1 | # Media
2 | media.aac_51_output_enabled=true
3 | media.settings.xml=/vendor/etc/media_profiles_kalama.xml
4 | ro.media.recorder-max-base-layer-fps=60
5 |
6 | # NFC
7 | ro.nfc.port=I2C
8 |
9 | # RKPD
10 | remote_provisioning.enable_rkpd=true
11 | remote_provisioning.hostname=remoteprovisioning.googleapis.com
12 |
--------------------------------------------------------------------------------
/overlays/Frameworks/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/overlays/FrameworksAOSPA/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/overlays/Nfc/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/overlays/Nfc/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 |
5 | - fuxi
6 | - nuwa
7 | - ishtar
8 | - vermeer
9 |
10 |
--------------------------------------------------------------------------------
/overlays/SecureElement/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/overlays/SystemUI/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/overlays/SystemUIAOSPA/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/overlays/Nfc/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550Nfc",
9 | device_specific: true,
10 | }
11 |
12 | runtime_resource_overlay {
13 | name: "Xiaomi8550NfcST",
14 | manifest: "AndroidManifestST.xml",
15 | device_specific: true,
16 | }
17 |
--------------------------------------------------------------------------------
/overlays/Settings/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/overlays/EuiccGoogle/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/sensors/AodNotifier.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include "SensorNotifier.h"
10 |
11 | class AodNotifier : public SensorNotifier {
12 | public:
13 | AodNotifier(sp manager);
14 | ~AodNotifier();
15 |
16 | protected:
17 | void pollingFunction();
18 | };
19 |
--------------------------------------------------------------------------------
/overlays/DeviceAsWebcamRes/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/overlays/WifiRes/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | runtime_resource_overlay {
8 | name: "Xiaomi8550WifiRes",
9 | device_specific: true,
10 | }
11 |
12 | runtime_resource_overlay {
13 | name: "Xiaomi8550WifiResMainline",
14 | manifest: "AndroidGoogleManifest.xml",
15 | device_specific: true,
16 | }
--------------------------------------------------------------------------------
/sensors/NonUiNotifier.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include "SensorNotifier.h"
10 |
11 | class NonUiNotifier : public SensorNotifier {
12 | public:
13 | NonUiNotifier(sp manager);
14 | ~NonUiNotifier();
15 |
16 | protected:
17 | void pollingFunction();
18 | };
19 |
--------------------------------------------------------------------------------
/overlays/CarrierConfigRes/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Common device configuration for Xiaomi 8550 family
2 |
3 | ## Currently supported devices:
4 |
5 | - Xiaomi 13 (fuxi)
6 | - Xiaomi 13 Pro (nuwa)
7 | - Xiaomi 13 Ultra (ishtar)
8 | - POCO F6 Pro / Redmi K70 (vermeer)
9 |
10 | ## Currently supported SoCs
11 |
12 | - SM8550 (kalama)
13 |
14 | ## Copyright
15 |
16 | ```
17 | Copyright (C) 2024 Paranoid Android
18 |
19 | SPDX-License-Identifier: Apache-2.0
20 | ```
--------------------------------------------------------------------------------
/sepolicy/vendor/system_server.te:
--------------------------------------------------------------------------------
1 | allow system_server hal_slaservice_hwservice:hwservice_manager find;
2 | allow system_server hal_slaservice_qti:binder call;
3 | allow system_server vendor_hal_fingerprint_hwservice_xiaomi:hwservice_manager { add find };
4 | allow system_server vendor_dtool:binder { call transfer };
5 | allow system_server vendor_dtool:binder transfer;
6 | allow system_server vendor_dtool:fd *;
7 | get_prop(system_server, vendor_fp_prop)
8 |
--------------------------------------------------------------------------------
/sepolicy/vendor/tee.te:
--------------------------------------------------------------------------------
1 | allow tee vendor_fingerprint_data_file:dir rw_dir_perms;
2 | allow tee vendor_fingerprint_data_file:file rw_file_perms;
3 | allow tee vendor_fingerprint_data_file:file create_file_perms;
4 | allow tee vendor_fingerprint_data_file_fpdump:dir rw_dir_perms;
5 | allow tee vendor_fingerprint_data_file_fpdump:file rw_file_perms;
6 | allow tee vendor_fingerprint_data_file_fpdump:file create_file_perms;
7 | hal_client_domain(tee, vendor_hal_eid)
8 |
--------------------------------------------------------------------------------
/overlays/WifiRes/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
--------------------------------------------------------------------------------
/overlays/EuiccGoogle/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {\"sim_illustration_lottie_mappings\":[{\"devices\":[\"fuxi\",\"nuwa\"],\"illustration_lottie\":\"sim_illustration_lottie_bottom\"}]}
4 | {\"sim-slot-mappings\":[{\"devices\":[\"fuxi\",\"nuwa\"],\"esim-slot-ids\":[1],\"psim-slot-ids\":[0]}]}
5 |
--------------------------------------------------------------------------------
/overlays/WifiRes/AndroidGoogleManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
--------------------------------------------------------------------------------
/overlays/Nfc/AndroidManifestST.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_eid.te:
--------------------------------------------------------------------------------
1 | allow vendor_hal_eid_client vendor_hal_eid_server:binder { call transfer };
2 | allow vendor_hal_eid_client vendor_hal_eid_server:binder transfer;
3 | allow vendor_hal_eid_client vendor_hal_eid_server:fd *;
4 | allow vendor_hal_eid_server vendor_hal_eid_client:binder transfer;
5 | allow vendor_hal_eid_server vendor_hal_eid_client:binder { call transfer };
6 | allow vendor_hal_eid_server vendor_hal_eid_client:fd *;
7 | hal_attribute_hwservice(vendor_hal_eid, vendor_hal_eid_hwservice)
8 |
--------------------------------------------------------------------------------
/overlays/FrameworksEuicc/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/udfps/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2022 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | cc_library {
8 | name: "libudfpshandler",
9 | vendor: true,
10 | srcs: ["UdfpsHandler.cpp"],
11 | shared_libs: [
12 | "libbase",
13 | ],
14 | static_libs: [
15 | "android.hardware.biometrics.fingerprint-V4-ndk",
16 | ],
17 | header_libs: [
18 | "qti_kernel_headers",
19 | "qti_display_kernel_headers",
20 | "//hardware/xiaomi:xiaomifingerprint_headers",
21 | ],
22 | }
--------------------------------------------------------------------------------
/sepolicy/vendor/hwservice_contexts:
--------------------------------------------------------------------------------
1 | # EID
2 | vendor.rongcard.hardware.eid::IEidDevice u:object_r:vendor_hal_eid_hwservice:s0
3 |
4 | # Fingerprint
5 | vendor.xiaomi.hardware.dtool::IDtool u:object_r:vendor_hal_fingerprint_hwservice_xiaomi:s0
6 | vendor.xiaomi.hardware.fx.tunnel::IMiFxTunnel u:object_r:vendor_hal_fingerprint_hwservice_xiaomi:s0
7 |
8 | # SLA
9 | vendor.qti.sla.service::ISlaService u:object_r:hal_slaservice_hwservice:s0
10 |
--------------------------------------------------------------------------------
/configs/properties/odm.prop:
--------------------------------------------------------------------------------
1 | # Audio
2 | vendor.audio.hdr.record.enable=false
3 |
4 | # Display
5 | persist.sys.sf.color_mode=0
6 | ro.surface_flinger.use_content_detection_for_refresh_rate=true
7 | ro.surface_flinger.set_display_power_timer_ms=1000
8 | ro.surface_flinger.set_touch_timer_ms=200
9 | ro.surface_flinger.set_idle_timer_ms=80
10 |
11 | # Sensors
12 | persist.vendor.sensors.enable.mag_filter=true
13 |
14 | # SKUs
15 | import /odm/etc/build_${ro.boot.hardware.sku}.prop
16 |
17 | # SPU
18 | vendor.gatekeeper.disable_spu=true
19 |
20 | # Telephony
21 | persist.vendor.radio.dynamic_sar=1
22 |
--------------------------------------------------------------------------------
/overlays/SystemUIAOSPA/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #00FFFFFF
5 |
6 |
7 | true
8 |
9 |
10 | true
11 |
12 |
13 | true
14 |
--------------------------------------------------------------------------------
/overlays/FrameworksAOSPA/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | xiaomi.sensor.nonui
5 | - 2.0
6 |
7 |
9 | /dev/null
10 |
11 |
12 | Xiaomi/fuxi_global/missi:13/TKQ1.220905.001/V14.0.9.0.TMCMIXM:user/release-keys
13 |
14 |
--------------------------------------------------------------------------------
/sensors/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2024 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | cc_binary {
8 | name: "sensor-notifier",
9 | vendor: true,
10 |
11 | init_rc: ["sensor-notifier.rc"],
12 |
13 | srcs: [
14 | "AodNotifier.cpp",
15 | "NonUiNotifier.cpp",
16 | "SensorNotifier.cpp",
17 | "SensorNotifierUtils.cpp",
18 | "main.cpp",
19 | ],
20 |
21 | shared_libs: [
22 | "libbase",
23 | "libhidlbase",
24 | "libutils",
25 | "android.frameworks.sensorservice@1.0",
26 | ],
27 |
28 | header_libs: [
29 | "qti_kernel_headers",
30 | "qti_display_kernel_headers",
31 | ],
32 | }
33 |
--------------------------------------------------------------------------------
/parts/res/xml/settings_esim.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
15 |
16 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/configs/permissions/privapp-permissions-hotword.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sepolicy/vendor/property_contexts:
--------------------------------------------------------------------------------
1 | # Fingerprint
2 | persist.vendor.fingerprint. u:object_r:vendor_fp_prop:s0
3 | persist.vendor.fpc. u:object_r:vendor_fp_prop:s0
4 | persist.vendor.goodix. u:object_r:vendor_fp_prop:s0
5 | persist.vendor.sys.fp. u:object_r:vendor_fp_prop:s0
6 | persist.vendor.sys.fp.info u:object_r:vendor_fp_info_prop:s0
7 | persist.vendor.sys.fp.uid u:object_r:vendor_fp_info_prop:s0
8 | ro.hardware.fp. u:object_r:vendor_fp_prop:s0
9 | vendor.dtool. u:object_r:vendor_fp_prop:s0
10 | vendor.fps_hal. u:object_r:vendor_fp_prop:s0
11 | vendor.panel.display. u:object_r:vendor_fp_prop:s0
12 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/telephony/EsimSettingsActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.telephony
7 |
8 | import android.os.Bundle;
9 | import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
10 | import com.android.settingslib.collapsingtoolbar.R;
11 |
12 | class EsimSettingsActivity : CollapsingToolbarBaseActivity() {
13 |
14 | companion object {
15 | private const val TAG = "EsimSettingsActivity"
16 | }
17 |
18 | override fun onCreate(savedInstanceState: Bundle?) {
19 | super.onCreate(savedInstanceState)
20 | supportFragmentManager.beginTransaction()
21 | .replace(R.id.content_frame, EsimSettingsFragment(), TAG)
22 | .commit()
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/parts/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2025 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | android_app {
8 | name: "XiaomiParts",
9 | certificate: "platform",
10 | srcs: ["src/**/*.kt"],
11 | platform_apis: true,
12 | privileged: true,
13 | system_ext_specific: true,
14 | static_libs: [
15 | "androidx.core_core",
16 | "androidx.preference_preference",
17 | "SettingsLib",
18 | "qcrilhook",
19 | "vendor.xiaomi.hardware.displayfeature-V1.0-java",
20 | ],
21 | required: [
22 | "privapp_whitelist_com.xiaomi.settings.xml",
23 | ],
24 | }
25 |
26 | prebuilt_etc {
27 | name: "privapp_whitelist_com.xiaomi.settings.xml",
28 | src: "permissions/privapp_whitelist_com.xiaomi.settings.xml",
29 | sub_dir: "permissions",
30 | system_ext_specific: true,
31 | }
--------------------------------------------------------------------------------
/sepolicy/vendor/vendor_sensor_notifier.te:
--------------------------------------------------------------------------------
1 | type vendor_sensor_notifier, domain;
2 | type vendor_sensor_notifier_exec, exec_type, file_type, vendor_file_type;
3 |
4 | init_daemon_domain(vendor_sensor_notifier)
5 |
6 | hwbinder_use(vendor_sensor_notifier)
7 |
8 | # for sensor callbacks
9 | binder_use(vendor_sensor_notifier)
10 | binder_call(vendor_sensor_notifier, system_server)
11 | binder_call(system_server, vendor_sensor_notifier)
12 |
13 | allow vendor_sensor_notifier fwk_sensor_hwservice:hwservice_manager find;
14 | allow vendor_sensor_notifier touchfeature_device:chr_file rw_file_perms;
15 | allow vendor_sensor_notifier sysfs_tp_touchfeature:file rw_file_perms;
16 | allow vendor_sensor_notifier vendor_displayfeature_device:chr_file rw_file_perms;
17 | allow vendor_sensor_notifier vendor_sysfs_sensors:file r_file_perms;
18 |
19 | get_prop(vendor_sensor_notifier, hwservicemanager_prop)
20 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_eid_rc.te:
--------------------------------------------------------------------------------
1 | type vendor_hal_eid_rc, domain;
2 | type vendor_hal_eid_rc_exec, exec_type, file_type, vendor_file_type;
3 |
4 | allow vendor_hal_eid_rc tee_device:chr_file rw_file_perms;
5 | allow vendor_hal_eid_rc ion_device:chr_file r_file_perms;
6 | allow vendor_hal_eid_rc vendor_hal_esepowermanager_hwservice:hwservice_manager find;
7 | allow vendor_hal_eid_rc vendor_hal_esepowermanager_qti:binder call;
8 | allow vendor_hal_eid_rc vendor_hal_esepowermanager_qti:binder transfer;
9 | init_daemon_domain(vendor_hal_eid_rc)
10 | r_dir_file(vendor_hal_eid_rc, firmware_file)
11 | get_prop(vendor_hal_eid_rc, vendor_tee_listener_prop)
12 | hal_server_domain(vendor_hal_eid_rc, vendor_hal_eid)
13 | hal_client_domain(vendor_hal_eid_rc, hal_graphics_composer)
14 | hal_client_domain(vendor_hal_eid_rc, vendor_hal_trustedui)
15 | hal_client_domain(vendor_hal_eid_rc, vendor_hal_qteeconnector)
16 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/utils/FileUtils.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022-2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.utils
7 |
8 | import android.util.Log
9 | import java.io.File
10 |
11 | private const val TAG = "FileUtils"
12 |
13 | /*
14 | * Writes the given String value into the given file
15 | *
16 | * @return true on success, false on failure
17 | */
18 | fun writeLine(fileName: String, value: String): Boolean =
19 | runCatching { File(fileName).writeText(value) }
20 | .onFailure { e -> Log.e(TAG, "Could not write to file $fileName", e) }
21 | .isSuccess
22 |
23 | /*
24 | * Writes the given Int value into the given file
25 | *
26 | * @return true on success, false on failure
27 | */
28 | fun writeLine(fileName: String, value: Int): Boolean =
29 | writeLine(fileName, value.toString())
30 |
--------------------------------------------------------------------------------
/parts/permissions/privapp_whitelist_com.xiaomi.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sensors/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "SensorNotifier"
8 |
9 | #include
10 |
11 | #include "AodNotifier.h"
12 | #include "NonUiNotifier.h"
13 |
14 | int main() {
15 | sp manager = ISensorManager::getService();
16 | if (manager == nullptr) {
17 | LOG(ERROR) << "failed to get ISensorManager";
18 | return EXIT_FAILURE;
19 | }
20 |
21 | std::unique_ptr aodNotifier = std::make_unique(manager);
22 | aodNotifier->activate();
23 |
24 | std::unique_ptr nonUiNotifier = std::make_unique(manager);
25 | nonUiNotifier->activate();
26 |
27 | while (true) {
28 | // Sleep to keep the notifiers alive
29 | std::this_thread::sleep_for(std::chrono::seconds(10));
30 | }
31 |
32 | // Should never reach this
33 | return EXIT_SUCCESS;
34 | }
35 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_slaservice.te:
--------------------------------------------------------------------------------
1 | type hal_slaservice_qti, domain;
2 | type hal_slaservice_qti_exec, exec_type, file_type, vendor_file_type;
3 | type hal_slaservice_hwservice, hwservice_manager_type;
4 |
5 | #allow hal_slaservice_qti vendor_slad_prop:file read;
6 | allow hal_slaservice_qti socket_device:sock_file write;
7 | allow hal_slaservice_client hal_slaservice_server:binder { call transfer };
8 | allow hal_slaservice_client hal_slaservice_server:fd *;
9 | allow hal_slaservice_client hal_slaservice_hwservice:hwservice_manager find;
10 | allow hal_slaservice_server hal_slaservice_client:binder transfer;
11 | init_daemon_domain(hal_slaservice_qti)
12 | #unix_socket_connect(hal_slaservice_qti, property, slad)
13 | #unix_socket_connect(hal_slaservice_qti, slad, init)
14 | #unix_socket_connect(hal_slaservice_qti, slad, slad)
15 | #set_prop(hal_slaservice_qti, vendor_slad_prop)
16 | hal_server_domain(hal_slaservice_qti, hal_slaservice)
17 | add_hwservice(hal_slaservice_server, hal_slaservice_hwservice)
18 |
--------------------------------------------------------------------------------
/sepolicy/vendor/dtool.te:
--------------------------------------------------------------------------------
1 | type vendor_dtool, domain;
2 | type vendor_dtool_exec, exec_type, file_type, vendor_file_type;
3 |
4 | allow vendor_dtool system_server:binder transfer;
5 | allow vendor_dtool system_server:binder { call transfer };
6 | allow vendor_dtool system_server:fd *;
7 | #allow vendor_dtool vendor_mfp-daemon:binder { call transfer };
8 | #allow vendor_dtool vendor_mfp-daemon:binder transfer;
9 | #allow vendor_dtool vendor_mfp-daemon:fd *;
10 | allow vendor_dtool vendor_hal_fingerprint_hwservice_xiaomi:hwservice_manager { add find };
11 | allow vendor_dtool hidl_base_hwservice:hwservice_manager add;
12 | allow vendor_dtool vendor_fingerprint_data_file_fpdump:dir { open read remove_name search write };
13 | allow vendor_dtool vendor_fingerprint_data_file_fpdump:file { getattr open read unlink };
14 | allow vendor_dtool hwservicemanager:binder { call transfer };
15 | init_daemon_domain(vendor_dtool)
16 | get_prop(vendor_dtool, hwservicemanager_prop)
17 | set_prop(vendor_dtool, vendor_fp_prop)
18 |
--------------------------------------------------------------------------------
/parts/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | Xiaomi Parts
10 |
11 |
12 | eSIM
13 | Enable eSIM
14 | Enabled
15 | Disabled
16 | eSIM is not supported on this device
17 | eSIM in use
18 | Please disable or remove your current eSIM profile before proceeding
19 | Enabling eSIM will disable the second physical SIM slot
20 | This device does not support eSIM functionality
21 |
22 |
--------------------------------------------------------------------------------
/configs/permissions/privapp-permissions-euiccgoogle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sepolicy/vendor/modem_manager.te:
--------------------------------------------------------------------------------
1 | allow vendor_modem_manager vendor_hal_qesdhal_default:file read;
2 | allow vendor_modem_manager vendor_hal_qesdhal_default:lnk_file read;
3 | allow vendor_modem_manager vendor_hal_qesdhal_default:dir search;
4 | allow vendor_modem_manager self:netlink_generic_socket create_socket_perms_no_ioctl;
5 | allow vendor_modem_manager anr_data_file:file append;
6 | allow vendor_modem_manager dumpstate:fd *;
7 | allow vendor_modem_manager dumpstate:fifo_file { append write };
8 | allow vendor_modem_manager incidentd:fd *;
9 | allow vendor_modem_manager incidentd:fifo_file { append write };
10 | allow vendor_modem_manager system_server:fifo_file { append write };
11 | allow vendor_modem_manager tombstoned:fd *;
12 | allow vendor_modem_manager tombstone_data_file:file append;
13 | unix_socket_connect(vendor_modem_manager, vendor_qesd, vendor_hal_qesdhal)
14 | unix_socket_connect(vendor_modem_manager, vendor_qesd, tombstoned)
15 | unix_socket_connect(vendor_modem_manager, tombstoned_crash, vendor_hal_qesdhal)
16 | unix_socket_connect(vendor_modem_manager, tombstoned_crash, tombstoned)
17 |
--------------------------------------------------------------------------------
/sensors/SensorNotifier.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 | #include
11 |
12 | using android::sp;
13 | using android::frameworks::sensorservice::V1_0::IEventQueue;
14 | using android::frameworks::sensorservice::V1_0::IEventQueueCallback;
15 | using android::frameworks::sensorservice::V1_0::ISensorManager;
16 | using android::frameworks::sensorservice::V1_0::Result;
17 |
18 | class SensorNotifier {
19 | public:
20 | SensorNotifier(sp manager);
21 | virtual ~SensorNotifier();
22 |
23 | void activate();
24 | void deactivate();
25 |
26 | protected:
27 | Result initializeSensorQueue(std::string typeAsString, bool wakeup, sp);
28 | virtual void pollingFunction() = 0;
29 |
30 | sp mQueue;
31 | int32_t mSensorHandle = -1;
32 | bool mActive = false;
33 |
34 | private:
35 | sp mManager;
36 | std::thread mPollingThread;
37 | };
38 |
--------------------------------------------------------------------------------
/power/power-mode.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Paranoid Android
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #include
8 | #include
9 |
10 | namespace aidl {
11 | namespace android {
12 | namespace hardware {
13 | namespace power {
14 | namespace impl {
15 |
16 | using ::aidl::android::hardware::power::Mode;
17 |
18 | constexpr const char* THERMAL_CONFIG_PATH =
19 | "/sys/class/thermal/thermal_message/sconfig";
20 |
21 | bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) {
22 | switch (type) {
23 | case Mode::GAME:
24 | *_aidl_return = true;
25 | return true;
26 | default:
27 | return false;
28 | }
29 | }
30 |
31 | bool setDeviceSpecificMode(Mode type, bool enabled) {
32 | switch (type) {
33 | case Mode::GAME:
34 | ::android::base::WriteStringToFile(enabled ? "19" : "0",
35 | THERMAL_CONFIG_PATH);
36 | return true;
37 | default:
38 | return false;
39 | }
40 | }
41 |
42 | } // namespace impl
43 | } // namespace power
44 | } // namespace hardware
45 | } // namespace android
46 | } // namespace aidl
47 |
--------------------------------------------------------------------------------
/configs/vintf/manifest_xiaomi.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | vendor.qti.sla.service
8 | hwbinder
9 | 1.0
10 |
11 | ISlaService
12 | default
13 |
14 | @1.0::ISlaService/default
15 |
16 |
17 | vendor.rongcard.hardware.eid
18 | hwbinder
19 | 1.0
20 |
21 | IEidDevice
22 | default
23 |
24 | @1.0::IEidDevice/default
25 |
26 |
27 | vendor.xiaomi.hardware.bgservice
28 | hwbinder
29 | 1.0
30 |
31 | IBGService
32 | default
33 |
34 |
35 |
--------------------------------------------------------------------------------
/blob-patches/mirilhook.patch:
--------------------------------------------------------------------------------
1 | From 27fb0061802c7ce5cc210ceed4076ff8d3edbdc2 Mon Sep 17 00:00:00 2001
2 | From: Fabian Leutenegger
3 | Date: Thu, 24 Apr 2025 08:01:26 +0200
4 | Subject: [PATCH] Patch MiRilHook to allow its use from com.xiaomi.settings
5 |
6 | ---
7 | smali/com/xiaomi/mirilhook/MiRilHook.smali | 4 ++--
8 | 1 file changed, 2 insertions(+), 2 deletions(-)
9 |
10 | diff --git a/smali/com/xiaomi/mirilhook/MiRilHook.smali b/smali/com/xiaomi/mirilhook/MiRilHook.smali
11 | index a818168..5d00063 100644
12 | --- a/smali/com/xiaomi/mirilhook/MiRilHook.smali
13 | +++ b/smali/com/xiaomi/mirilhook/MiRilHook.smali
14 | @@ -1383,7 +1383,7 @@
15 |
16 | .line 8099
17 | :cond_0
18 | - const-string v4, "com.xiaomi.mtb"
19 | + const-string v4, "com.xiaomi.settings"
20 |
21 | invoke-virtual {v4, v3}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
22 |
23 | @@ -5895,7 +5895,7 @@
24 | .line 618
25 | sget-object v0, Lcom/xiaomi/mirilhook/MiRilHook;->mHookUserWhiteList:Ljava/util/ArrayList;
26 |
27 | - const-string v2, "com.xiaomi.mtb"
28 | + const-string v2, "com.xiaomi.settings"
29 |
30 | invoke-virtual {v0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
31 |
32 | --
33 | 2.48.1
34 |
--------------------------------------------------------------------------------
/init/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023-2024 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | prebuilt_etc {
8 | name: "fstab.qcom",
9 | src: "fstab.qcom",
10 | vendor: true,
11 | }
12 |
13 | prebuilt_etc {
14 | name: "init.target.rc",
15 | src: "init.target.rc",
16 | sub_dir: "init/hw",
17 | vendor: true,
18 | }
19 |
20 | prebuilt_etc {
21 | name: "init.mi_perf.rc",
22 | src: "init.mi_perf.rc",
23 | sub_dir: "init/hw",
24 | vendor: true,
25 | }
26 |
27 | prebuilt_etc {
28 | name: "init.mi_service.rc",
29 | src: "init.mi_service.rc",
30 | sub_dir: "init/hw",
31 | vendor: true,
32 | }
33 |
34 | prebuilt_etc {
35 | name: "init.mi_udfps.rc",
36 | src: "init.mi_udfps.rc",
37 | sub_dir: "init/hw",
38 | vendor: true,
39 | }
40 |
41 | prebuilt_etc {
42 | name: "ueventd.xiaomi.rc",
43 | filename: "ueventd.rc",
44 | src: "ueventd.xiaomi.rc",
45 | device_specific: true,
46 | }
47 |
48 | cc_library_static {
49 | name: "libinit_xiaomi_sm8550",
50 | srcs: ["init_xiaomi8550.cpp"],
51 | recovery_available: true,
52 | whole_static_libs: ["libbase"],
53 | include_dirs: [
54 | "system/libbase/include",
55 | "system/core/init"
56 | ]
57 | }
58 |
--------------------------------------------------------------------------------
/sepolicy/private/parts_app.te:
--------------------------------------------------------------------------------
1 | type parts_app, domain;
2 | typeattribute parts_app mlstrustedsubject;
3 |
4 | app_domain(parts_app)
5 |
6 | binder_use(parts_app)
7 |
8 | hal_client_domain(parts_app, vendor_hal_displayfeature_xiaomi)
9 |
10 | binder_call(parts_app, vendor_hal_displayfeature_xiaomi)
11 |
12 | allow parts_app {
13 | activity_service
14 | activity_task_service
15 | audio_service
16 | audioserver_service
17 | autofill_service
18 | batteryproperties_service
19 | batterystats_service
20 | content_capture_service
21 | game_service
22 | gpu_service
23 | hint_service
24 | media_session_service
25 | netstats_service
26 | radio_service
27 | trust_service
28 | sensorservice_service
29 | surfaceflinger_service
30 | vendor_perf_service
31 | vibrator_manager_service
32 | voiceinteraction_service
33 | }:service_manager find;
34 |
35 | allow parts_app {
36 | vendor_hal_displayfeature_xiaomi_hwservice
37 | }:hwservice_manager find;
38 |
39 | allow parts_app system_app_data_file:dir create_dir_perms;
40 | allow parts_app system_app_data_file:{
41 | file
42 | lnk_file
43 | } create_file_perms;
44 |
45 | allow parts_app sysfs_tp_fodstatus:dir r_dir_perms;
46 | allow parts_app sysfs_tp_fodstatus:file r_file_perms;
47 | allow parts_app sysfs_tp_touchfeature:file rw_file_perms;
48 |
--------------------------------------------------------------------------------
/parts/res/drawable/ic_sim_card_download.xml:
--------------------------------------------------------------------------------
1 |
16 |
23 |
25 |
27 |
--------------------------------------------------------------------------------
/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2023 Paranoid Android
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | soong_namespace {
8 | imports: [
9 | "hardware/xiaomi",
10 | "vendor/qcom/common/system/telephony",
11 | ],
12 | }
13 |
14 | install_symlink {
15 | name: "firmware_wlanmdsp.otaupdate_symlink",
16 | vendor: true,
17 | installed_location: "firmware/wlanmdsp.otaupdate",
18 | symlink_target: "/data/vendor/firmware/wlanmdsp.mbn",
19 | }
20 | install_symlink {
21 | name: "firmware_wlan_mac.bin_symlink",
22 | vendor: true,
23 | installed_location: "firmware/wlan/qca_cld/kiwi_v2/wlan_mac.bin",
24 | symlink_target: "/mnt/vendor/persist/kiwi_v2/wlan_mac.bin",
25 | }
26 | install_symlink {
27 | name: "firmware_WCNSS_qcom_cfg.ini_symlink",
28 | vendor: true,
29 | installed_location: "firmware/wlan/qca_cld/kiwi_v2/WCNSS_qcom_cfg.ini",
30 | symlink_target: "/vendor/etc/wifi/kiwi_v2/WCNSS_qcom_cfg.ini",
31 | }
32 |
33 | install_symlink {
34 | name: "libqesdk_manager_32bit_stub",
35 | vendor: true,
36 | installed_location: "lib/libqesdk_manager.so",
37 | symlink_target: "/dev/null",
38 | }
39 | install_symlink {
40 | name: "libqesdk2_0_32bit_stub",
41 | vendor: true,
42 | installed_location: "lib/libqesdk2_0.so",
43 | symlink_target: "/dev/null",
44 | }
45 |
--------------------------------------------------------------------------------
/sepolicy/vendor/file_contexts:
--------------------------------------------------------------------------------
1 | # Camera
2 | /odm/bin/hw/vendor\.qti\.camera\.provider-service_64 u:object_r:hal_camera_default_exec:s0
3 |
4 | # EID
5 | /(vendor|system/vendor)/bin/hw/vendor\.rongcard\.hardware\.eid@1\.0-service u:object_r:vendor_hal_eid_rc_exec:s0
6 |
7 | # Fingerprint
8 | /data/vendor/fpc(/.*)? u:object_r:vendor_fingerprint_data_file:s0
9 | /data/vendor/fpdump(/.*)? u:object_r:vendor_fingerprint_data_file_fpdump:s0
10 | /data/vendor/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0
11 | /dev/goodix_fp u:object_r:vendor_fingerprint_device:s0
12 | /mnt/vendor/persist/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0
13 | /(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
14 | /(vendor|system/vendor)/bin/hw/vendor\.xiaomi\.hardware\.dtool@1\.0-service u:object_r:vendor_dtool_exec:s0
15 |
16 | # NFC
17 | /(odm|vendor/odm)/bin/hw/android\.hardware\.nfc@1\.2-service-st u:object_r:hal_nfc_default_exec:s0
18 | /(odm|vendor/odm)/bin/hw/vendor\.nxp\.hardware\.nfc@2\.0-service u:object_r:hal_nfc_default_exec:s0
19 |
20 | # Sensors
21 | /(vendor|system/vendor)/bin/sensor-notifier u:object_r:vendor_sensor_notifier_exec:s0
22 |
23 | # SLA
24 | /(vendor|system/vendor)/bin/hw/vendor\.qti\.sla\.service\@1\.0-service u:object_r:hal_slaservice_qti_exec:s0
25 |
26 | # Wifi
27 | /data/vendor/mac_addr(/.*)? u:object_r:vendor_mac_vendor_data_file:s0
28 | /vendor/bin/nv_mac u:object_r:vendor_wcnss_service_exec:s0
29 |
--------------------------------------------------------------------------------
/overlays/WifiRes/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
8 | true
9 |
10 |
13 | false
14 |
15 |
16 | true
17 |
18 |
19 | true
20 |
21 |
23 | 524288,1048576,16777216,262144,524288,16777216
24 |
25 |
26 |
27 | - 20
28 |
29 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/display/DisplayFeatureWrapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.display
7 |
8 | import android.os.IHwBinder
9 | import android.util.Log
10 | import vendor.xiaomi.hardware.displayfeature.V1_0.IDisplayFeature
11 |
12 | object DisplayFeatureWrapper {
13 |
14 | private const val TAG = "DisplayFeatureWrapper"
15 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
16 |
17 | @Volatile private var displayFeature: IDisplayFeature? = null
18 |
19 | private val deathRecipient =
20 | IHwBinder.DeathRecipient { _ ->
21 | if (DEBUG) Log.d(TAG, "serviceDied")
22 | displayFeature = null
23 | }
24 |
25 | @Synchronized
26 | private fun getDisplayFeature(): IDisplayFeature? =
27 | displayFeature
28 | ?: runCatching { IDisplayFeature.getService() }
29 | .onSuccess {
30 | displayFeature = it.apply { asBinder().linkToDeath(deathRecipient, 0) }
31 | }
32 | .onFailure { e -> Log.e(TAG, "getDisplayFeature failed!", e) }
33 | .getOrNull()
34 |
35 | fun setFeature(mode: Int, value: Int, cookie: Int) {
36 | val displayFeature =
37 | getDisplayFeature()
38 | ?: run {
39 | Log.e(TAG, ": displayFeature is null!")
40 | return
41 | }
42 | if (DEBUG) Log.d(TAG, "setFeature: mode=$mode, value=$value, cookie=$cookie")
43 | runCatching { displayFeature.setFeature(/*displayId*/ 0, mode, value, cookie) }
44 | .onFailure { e -> Log.e(TAG, "setFeature failed!", e) }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/sensors/SensorNotifierUtils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "SensorNotifierUtils"
8 |
9 | #include
10 |
11 | #include "SensorNotifierUtils.h"
12 |
13 | bool readBool(int fd) {
14 | char c;
15 | int rc;
16 |
17 | rc = lseek(fd, 0, SEEK_SET);
18 | if (rc) {
19 | LOG(ERROR) << "failed to seek fd, err: " << rc;
20 | return false;
21 | }
22 |
23 | rc = read(fd, &c, sizeof(char));
24 | if (rc != 1) {
25 | LOG(ERROR) << "failed to read bool from fd, err: " << rc;
26 | return false;
27 | }
28 |
29 | return c != '0';
30 | }
31 |
32 | std::shared_ptr parseDispEvent(int fd) {
33 | disp_event header;
34 | ssize_t headerSize = read(fd, &header, sizeof(header));
35 | if (headerSize < sizeof(header)) {
36 | LOG(ERROR) << "unexpected display event header size: " << headerSize;
37 | return nullptr;
38 | }
39 |
40 | std::shared_ptr response(static_cast(malloc(header.length)),
41 | free);
42 | if (!response) {
43 | LOG(ERROR) << "failed to allocate memory for display event response";
44 | return nullptr;
45 | }
46 | response->base = header;
47 |
48 | int dataLength = response->base.length - sizeof(response->base);
49 | if (dataLength < 0) {
50 | LOG(ERROR) << "invalid data length: " << response->base.length;
51 | return nullptr;
52 | }
53 |
54 | ssize_t dataSize = read(fd, &response->data, dataLength);
55 | if (dataSize < dataLength) {
56 | LOG(ERROR) << "unexpected display event data size: " << dataSize;
57 | return nullptr;
58 | }
59 |
60 | return response;
61 | }
62 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/touch/TouchOrientationService.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.touch
7 |
8 | import android.app.Service
9 | import android.content.Intent
10 | import android.content.res.Configuration
11 | import android.os.IBinder
12 | import android.util.Log
13 | import com.xiaomi.settings.utils.writeLine
14 |
15 | class TouchOrientationService : Service() {
16 |
17 | companion object {
18 | private const val TAG = "TouchOrientationService"
19 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
20 |
21 | private const val TOUCH_PANEL_ORIENTATION_PATH = "/sys/class/touch/touch_dev/panel_orientation"
22 | }
23 |
24 | private var rotation: Int = 0
25 | set(value) {
26 | if (field == value) return
27 | field = value
28 | if (DEBUG) Log.d(TAG, "rotation=$value")
29 | runCatching {
30 | // Lucky for us, Surface.ROTATION_* directly translates into touchpanel values
31 | writeLine(TOUCH_PANEL_ORIENTATION_PATH, rotation)
32 | }
33 | .onFailure { e -> Log.e(TAG, "Failed to set touch panel orientation", e) }
34 | }
35 |
36 | override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
37 | if (DEBUG) Log.d(TAG, "onStartCommand")
38 | updateOrientation()
39 | return START_STICKY
40 | }
41 |
42 | override fun onConfigurationChanged(newConfig: Configuration) {
43 | super.onConfigurationChanged(newConfig)
44 | if (DEBUG) Log.d(TAG, "onConfigurationChanged")
45 | updateOrientation()
46 | }
47 |
48 | override fun onBind(intent: Intent?): IBinder? = null
49 |
50 | private fun updateOrientation() {
51 | rotation = display.rotation
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/sepolicy/vendor/wcnss_service.te:
--------------------------------------------------------------------------------
1 | #allow vendor_wcnss_service self:netlink_generic_socket ioctl;
2 | allow vendor_wcnss_service self:capability { net_raw setgid setuid };
3 | #allow vendor_wcnss_service self:packet_socket { bind create getopt ioctl map read setopt };
4 | allow vendor_wcnss_service self:packet_socket write;
5 | allow vendor_wcnss_service sysfs_net:file read;
6 | allow vendor_wcnss_service vendor_mac_vendor_data_file:dir { add_name open read search setattr write };
7 | allow vendor_wcnss_service vendor_mac_vendor_data_file:dir rw_dir_perms;
8 | allow vendor_wcnss_service vendor_mac_vendor_data_file:file { create getattr open read setattr write };
9 | allow vendor_wcnss_service mnt_vendor_file:dir { add_name create read search write };
10 | allow vendor_wcnss_service mnt_vendor_file:file { create open read setattr write };
11 | #allow vendor_wcnss_service vendor_diag_device:chr_file { create ioctl open read write };
12 | allow vendor_wcnss_service vendor_sysfs_diag:dir search;
13 | allow vendor_wcnss_service vendor_sysfs_diag:file { open read };
14 | allow vendor_wcnss_service vendor_wifi_vendor_log_data_file:dir { add_name getattr open read remove_name search setattr write };
15 | allow vendor_wcnss_service vendor_wifi_vendor_log_data_file:file { append create getattr open read rename setattr unlink write };
16 | allow vendor_wcnss_service vendor_proc_wifi_dbg:file { create getattr open read setattr write };
17 | allow vendor_wcnss_service vendor_data_file:dir { add_name getattr open read remove_name search setattr write };
18 | allow vendor_wcnss_service vendor_data_file:file { append create getattr open read rename setattr unlink write };
19 | allow vendor_wcnss_service vendor_modem_data_file:dir { add_name getattr open read remove_name search setattr write };
20 | allow vendor_wcnss_service vendor_modem_data_file:file { append create getattr open read rename setattr unlink write };
21 | allow vendor_wcnss_service fuse:dir { add_name getattr open read remove_name search setattr write };
22 | allow vendor_wcnss_service fuse:file { append create getattr open read rename setattr unlink write };
23 |
--------------------------------------------------------------------------------
/reorder-libs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (C) 2021 The LineageOS Project
4 | # Copyright (C) 2023 Paranoid Android
5 | #
6 | # SPDX-License-Identifier: Apache-2.0
7 | #
8 |
9 | from functools import cmp_to_key
10 | from locale import LC_ALL, setlocale, strcoll
11 | from pathlib import Path
12 |
13 | FILES = [Path(file) for file in [
14 | "proprietary-files.txt",
15 | ]]
16 |
17 | setlocale(LC_ALL, "C")
18 |
19 | def strcoll_extract_utils(string1: str, string2: str) -> int:
20 | # Skip logic if one of the string if empty
21 | if not string1 or not string2:
22 | return strcoll(string1, string2)
23 |
24 | # Remove '-' from strings if there,
25 | # it is used to indicate a build target
26 | string1 = string1.removeprefix('-')
27 | string2 = string2.removeprefix('-')
28 |
29 | # If no directories, compare normally
30 | if not "/" in string1 and not "/" in string2:
31 | return strcoll(string1, string2)
32 |
33 | string1_dir = string1.rsplit("/", 1)[0] + "/"
34 | string2_dir = string2.rsplit("/", 1)[0] + "/"
35 | if string1_dir == string2_dir:
36 | # Same directory, compare normally
37 | return strcoll(string1, string2)
38 |
39 | if string1_dir.startswith(string2_dir):
40 | # First string dir is a subdirectory of the second one,
41 | # return string1 > string2
42 | return -1
43 |
44 | if string2_dir.startswith(string1_dir):
45 | # Second string dir is a subdirectory of the first one,
46 | # return string2 > string1
47 | return 1
48 |
49 | # Compare normally
50 | return strcoll(string1, string2)
51 |
52 | for file in FILES:
53 | if not file.is_file():
54 | print(f"File {str(file)} not found")
55 | continue
56 |
57 | with open(file, 'r') as f:
58 | sections = f.read().split("\n\n")
59 |
60 | ordered_sections = []
61 | for section in sections:
62 | section_list = [line.strip() for line in section.splitlines()]
63 | section_list.sort(key=cmp_to_key(strcoll_extract_utils))
64 | ordered_sections.append("\n".join(section_list))
65 |
66 | with open(file, 'w') as f:
67 | f.write("\n\n".join(ordered_sections).strip() + "\n")
68 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/display/DcDimmingService.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.display
7 |
8 | import android.app.Service
9 | import android.content.Intent
10 | import android.database.ContentObserver
11 | import android.os.Handler
12 | import android.os.IBinder
13 | import android.os.UserHandle
14 | import android.provider.Settings
15 | import android.util.Log
16 |
17 | class DcDimmingService : Service() {
18 |
19 | companion object {
20 | private const val TAG = "DcDimmingService"
21 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
22 |
23 | private const val DC_DIMMING_MODE = 20
24 | }
25 |
26 | private val handler = Handler()
27 |
28 | private val settingObserver =
29 | object : ContentObserver(handler) {
30 | override fun onChange(selfChange: Boolean) {
31 | if (DEBUG) Log.d(TAG, "SettingObserver: onChange")
32 | updateDcDimming()
33 | }
34 | }
35 |
36 | override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
37 | if (DEBUG) Log.d(TAG, "Starting service")
38 | contentResolver.registerContentObserver(
39 | Settings.System.getUriFor(Settings.System.DC_DIMMING_STATE),
40 | false,
41 | settingObserver,
42 | UserHandle.USER_CURRENT,
43 | )
44 | updateDcDimming()
45 | return START_STICKY
46 | }
47 |
48 | override fun onDestroy() {
49 | if (DEBUG) Log.d(TAG, "Destroying service")
50 | contentResolver.unregisterContentObserver(settingObserver)
51 | super.onDestroy()
52 | }
53 |
54 | override fun onBind(intent: Intent?): IBinder? = null
55 |
56 | private fun updateDcDimming() {
57 | val enabled = Settings.System.getInt(contentResolver, Settings.System.DC_DIMMING_STATE, 0)
58 | if (DEBUG) Log.d(TAG, "updateDcDimming: enabled=$enabled")
59 | try {
60 | DisplayFeatureWrapper.setFeature(DC_DIMMING_MODE, enabled, 0)
61 | } catch (e: Exception) {
62 | Log.e(TAG, "updateDcDimming failed!", e)
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/init/init.mi_service.rc:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2023 Paranoid Android
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | # Audio
6 | service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service_64
7 | override
8 | class hal
9 | user audioserver
10 | # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
11 | group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct oem_2901 wakelock oem_2912 system
12 | capabilities BLOCK_SUSPEND SYS_NICE
13 | ioprio rt 4
14 | writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks
15 | onrestart restart audioserver
16 |
17 | # Connection Security
18 | service ssgqmigd /vendor/bin/ssgqmigd64
19 | override
20 | class late_start
21 | user radio
22 | group radio gps system
23 | socket ssgqmig seqpacket 0660 radio inet
24 |
25 | # Display
26 | service vendor.qti.hardware.display.composer /vendor/bin/hw/vendor.qti.hardware.display.composer-service
27 | override
28 | class hal animation
29 | user system
30 | group graphics drmrpc
31 | capabilities SYS_NICE
32 | onrestart restart surfaceflinger
33 | socket pps stream 0660 system system
34 | task_profiles ProcessCapacityHigh HighPerformance
35 |
36 | # Sensors
37 | service citsensor-hal-2-0 /odm/bin/hw/vendor.xiaomi.sensor.citsensorservice@2.0-service
38 | class late_start
39 | user system
40 | group system input
41 | override
42 | task_profiles ServiceCapacityLow
43 |
44 | # Touchscreen
45 | on boot
46 | chown system system /sys/class/touch/touch_dev/fod_finger_state
47 | chown system system /sys/class/touch/touch_dev/fod_longpress_gesture_enabled
48 | chown system system /sys/class/touch/touch_dev/gesture_double_tap_enabled
49 | chown system system /sys/class/touch/touch_dev/gesture_single_tap_enabled
50 | chown system system /sys/class/touch/touch_dev/panel_orientation
51 | chmod 0660 /sys/class/touch/touch_dev/fod_finger_state
52 | chmod 0660 /sys/class/touch/touch_dev/fod_longpress_gesture_enabled
53 | chmod 0664 /sys/class/touch/touch_dev/gesture_double_tap_enabled
54 | chmod 0664 /sys/class/touch/touch_dev/gesture_single_tap_enabled
55 | chmod 0664 /sys/class/touch/touch_dev/panel_orientation
56 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/BootCompletedReceiver.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings
7 |
8 | import android.content.BroadcastReceiver
9 | import android.content.Context
10 | import android.content.Intent
11 | import android.hardware.display.DisplayManager
12 | import android.os.UserHandle
13 | import android.util.Log
14 | import android.view.Display
15 | import android.view.Display.HdrCapabilities
16 | import com.xiaomi.settings.display.ColorService
17 | import com.xiaomi.settings.display.DcDimmingService
18 | import com.xiaomi.settings.telephony.EsimController
19 | import com.xiaomi.settings.touch.TouchOrientationService
20 |
21 | class BootCompletedReceiver : BroadcastReceiver() {
22 |
23 | companion object {
24 | private const val TAG = "BootReceiver"
25 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
26 | }
27 |
28 | override fun onReceive(context: Context, intent: Intent) {
29 | if (DEBUG) Log.d(TAG, "Received boot completed intent: ${intent.action}")
30 | when (intent.action) {
31 | Intent.ACTION_BOOT_COMPLETED -> onBootCompleted(context)
32 | Intent.ACTION_LOCKED_BOOT_COMPLETED -> onLockedBootCompleted(context)
33 | }
34 | }
35 |
36 | private fun onBootCompleted(context: Context) {
37 | // Telephony
38 | EsimController.getInstance(context).onBootCompleted()
39 | }
40 |
41 | private fun onLockedBootCompleted(context: Context) {
42 | // Display
43 | context.startServiceAsUser(Intent(context, ColorService::class.java), UserHandle.CURRENT)
44 | context.startServiceAsUser(Intent(context, DcDimmingService::class.java), UserHandle.CURRENT)
45 |
46 | // Touchscreen
47 | context.startServiceAsUser(Intent(context, TouchOrientationService::class.java), UserHandle.CURRENT)
48 |
49 | // Override HDR types to enable Dolby Vision
50 | val displayManager = context.getSystemService(DisplayManager::class.java)
51 | displayManager?.overrideHdrTypes(Display.DEFAULT_DISPLAY, intArrayOf(
52 | HdrCapabilities.HDR_TYPE_DOLBY_VISION,
53 | HdrCapabilities.HDR_TYPE_HDR10,
54 | HdrCapabilities.HDR_TYPE_HLG,
55 | HdrCapabilities.HDR_TYPE_HDR10_PLUS
56 | ))
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/configs/properties/vendor.prop:
--------------------------------------------------------------------------------
1 | # Audio
2 | persist.vendor.audio.misoundasc=true
3 | persist.vendor.audio.misound.disable=true
4 | ro.audio.monitorRotation=true
5 | ro.audio.spatializer_enabled=true
6 | ro.vendor.audio.feature.spatial=7
7 | ro.vendor.audio.misound.bluetooth.enable=false
8 |
9 | # Bluetooth
10 | persist.sys.fflag.override.settings_bluetooth_hearing_aid=true
11 | persist.vendor.qcom.bluetooth.a2dp_offload_cap=sbc-aptx-aptxtws-aptxhd-aac-ldac-aptxadaptiver2
12 | persist.vendor.qcom.bluetooth.aac_frm_ctl.enabled=true
13 | persist.vendor.qcom.bluetooth.aac_vbr_ctl.enabled=true
14 | persist.vendor.qcom.bluetooth.aptxadaptiver2_1_support=true
15 |
16 | # Camera
17 | camera.disable_zsl_mode=true
18 | ro.camera.enableCamera1MaxZsl=1
19 |
20 | # Display
21 | persist.sys.sf.native_mode=258
22 | ro.vendor.display.ai_disp.enable=true
23 | ro.vendor.display.mi_calib.enable=true
24 | ro.vendor.display.nature_mode.enable=true
25 | ro.vendor.display.type=oled
26 | ro.vendor.displayfeature.dump=true
27 | ro.vendor.fps.switch.default=true
28 | ro.vendor.fps.switch.thermal=trues
29 | ro.vendor.hbm_backlight.enable=true
30 | ro.vendor.histogram.enable=true
31 | ro.vendor.localhbm.enable=true
32 | ro.vendor.thermal.dimming.enable=true
33 | ro.vendor.xiaomi.bl.poll=true
34 |
35 | # DPM
36 | persist.vendor.dpm.vndr.feature=11
37 | persist.vendor.dpm.vndr.halservice.enable=1
38 | persist.vendor.dpm.vndr.idletimer.mode=default
39 |
40 | # DRM
41 | drm.service.enabled=true
42 |
43 | # FM
44 | vendor.hw.fm.init=0
45 |
46 | # FUSE passthrough
47 | persist.sys.fuse.passthrough.enable=true
48 |
49 | # Incremental FS
50 | ro.incremental.enable=yes
51 |
52 | # Keystore
53 | ro.hardware.keystore_desede=true
54 |
55 | # Media
56 | debug.stagefright.c2inputsurface=-1
57 | media.stagefright.enable-aac=true
58 | media.stagefright.enable-fma2dp=true
59 | media.stagefright.enable-http=true
60 | media.stagefright.enable-player=true
61 | media.stagefright.enable-qcp=true
62 | media.stagefright.enable-scan=true
63 | media.stagefright.thumbnail.prefer_hw_codecs=true
64 | ro.mediaserver.64b.enable=true
65 | vendor.media.omx=0
66 |
67 | # NFC
68 | ro.vendor.nfc.disable.i2c=false
69 | ro.vendor.nfc.dispatch_optim=1
70 | ro.vendor.nfc.repair=1
71 | ro.vendor.se.type=HCE,UICC
72 |
73 | # Telephony
74 | persist.vendor.radio.redir_party_num=0
75 | ro.vendor.radio.build_profile=u-stable
76 | ro.vendor.radio.build_region=global
77 |
78 | # USB
79 | ro.usb.uvc.enabled=true
80 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/telephony/EsimSettingsFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.telephony
7 |
8 | import android.content.Context
9 | import android.os.Bundle
10 | import android.util.Log
11 | import android.widget.CompoundButton
12 | import androidx.appcompat.app.AlertDialog
13 | import androidx.preference.PreferenceFragmentCompat
14 | import com.android.settingslib.widget.FooterPreference
15 | import com.android.settingslib.widget.MainSwitchPreference
16 | import com.xiaomi.settings.R
17 |
18 | class EsimSettingsFragment : PreferenceFragmentCompat(),
19 | CompoundButton.OnCheckedChangeListener {
20 |
21 | companion object {
22 | private const val TAG = "EsimSettingsFragment"
23 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
24 | }
25 |
26 | private val esimController by lazy {
27 | EsimController.getInstance(requireContext())
28 | }
29 |
30 | private val switchBar by lazy {
31 | findPreference("esim_enable")!!
32 | }
33 | private val footerPref by lazy {
34 | findPreference("esim_footer")!!
35 | }
36 |
37 | override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
38 | if (DEBUG) Log.d(TAG, "onCreatePreferences")
39 | setPreferencesFromResource(R.xml.settings_esim, rootKey)
40 |
41 | if (esimController.getEsimSupported()) {
42 | switchBar.addOnSwitchChangeListener(this)
43 | switchBar.isChecked = esimController.getEsimEnabled()
44 | switchBar.isEnabled = true
45 | footerPref.title = getString(R.string.esim_footer_note)
46 | }
47 | }
48 |
49 | override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
50 | if (DEBUG) Log.d(TAG, "onCheckedChanged: $isChecked")
51 | if (esimController.getEsimActive()) {
52 | if (isChecked) return
53 | switchBar.isChecked = true
54 | AlertDialog.Builder(requireContext())
55 | .setTitle(R.string.esim_warning_title)
56 | .setMessage(R.string.esim_warning_message)
57 | .setPositiveButton(android.R.string.ok, null)
58 | .setCancelable(false)
59 | .show()
60 | } else {
61 | esimController.setEsimEnabled(isChecked)
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/init/init.mi_udfps.rc:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2023 Paranoid Android
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | on early-boot
6 | chown system graphics /sys/bus/platform/devices/soc:xiaomi_fingerprint/fingerdown
7 | chmod 0664 /sys/bus/platform/devices/soc:xiaomi_fingerprint/fingerdown
8 |
9 | on boot
10 | chmod 0666 /dev/goodix_fp
11 | chown system system /dev/goodix_fp
12 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq
13 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable
14 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
15 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
16 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
17 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait
18 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
19 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
20 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
21 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
22 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
23 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/irq
24 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
25 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
26 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
27 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
28 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
29 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
30 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
31 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
32 | chmod 0666 /dev/input/event2
33 |
34 | on post-fs-data
35 | mkdir /data/vendor/misc 01771 system system
36 | mkdir /data/vendor/misc/mi_fp 0770 system system
37 | mkdir /persist/mi_fp 0770 system system
38 | mkdir /mnt/vendor/persist/mi_fp 0770 system system
39 | mkdir /data/vendor/fpc 0770 system system
40 | mkdir /data/vendor/fpdump 0770 system system
41 | mkdir /data/vendor/goodix 0770 system system
42 | mkdir /data/vendor/fingerprint 0770 system system
43 | mkdir /mnt/vendor/persist/goodix 0770 system system
44 |
--------------------------------------------------------------------------------
/sepolicy/vendor/genfs_contexts:
--------------------------------------------------------------------------------
1 | # Audio
2 | genfscon sysfs "/devices/platform/soc/soc:spf_core_platform/soc:spf_core_platform:lpass-cdc/wcd938x-codec/extcon" u:object_r:sysfs_extcon:s0
3 |
4 | # Battery
5 | genfscon sysfs "/class/qcom-battery" u:object_r:vendor_sysfs_qcom_battery:s0
6 |
7 | # Fastcharge
8 | genfscon sysfs "/class/qcom-battery/fastchg_mode" u:object_r:sysfs_fastcharge:s0
9 |
10 | # Fingerprint
11 | genfscon sysfs "/devices/platform/soc/soc:xiaomi_fingerprint/fingerdown" u:object_r:vendor_sysfs_displayfeature:s0
12 | genfscon sysfs "/devices/platform/soc/soc:fingerprint_goodix/wakeup" u:object_r:sysfs_wakeup:s0
13 | genfscon sysfs /devices/virtual/touch/touch_dev/fod_finger_state u:object_r:sysfs_tp_fodstatus:s0
14 | genfscon sysfs "/devices/virtual/touch/touch_dev/fod_longpress_gesture_enabled" u:object_r:sysfs_tp_touchfeature:s0
15 | genfscon sysfs "/devices/virtual/touch/touch_dev/fod_press_status" u:object_r:sysfs_tp_fodstatus:s0
16 | genfscon sysfs "/devices/virtual/touch/tp_dev/fod_status" u:object_r:sysfs_tp_fodstatus:s0
17 |
18 | # Powershare
19 | genfscon sysfs "/class/qcom-battery/reverse_chg_mode" u:object_r:sysfs_powershare:s0
20 |
21 | # Touchscreen
22 | genfscon sysfs "/devices/virtual/touch/touch_dev/gesture_double_tap_enabled" u:object_r:sysfs_tp_touchfeature:s0
23 | genfscon sysfs "/devices/virtual/touch/touch_dev/gesture_double_tap_state" u:object_r:sysfs_tp_touchfeature:s0
24 | genfscon sysfs "/devices/virtual/touch/touch_dev/gesture_single_tap_enabled" u:object_r:sysfs_tp_touchfeature:s0
25 | genfscon sysfs "/devices/virtual/touch/touch_dev/gesture_single_tap_state" u:object_r:sysfs_tp_touchfeature:s0
26 | genfscon sysfs "/devices/virtual/touch/touch_dev/panel_orientation" u:object_r:sysfs_tp_touchfeature:s0
27 |
28 | # Wakeup
29 | genfscon sysfs "/devices/platform/soc/1c00000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/mhi_1107_00.01.00/wakeup" u:object_r:sysfs_wakeup:s0
30 | genfscon sysfs "/devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a90000.spi/spi_master/spi0/spi0.0/wakeup" u:object_r:sysfs_wakeup:s0
31 | genfscon sysfs "/devices/platform/soc/ac0000.qcom,qupv3_1_geni_se/a90000.spi/spi_master/spi1/spi1.0/wakeup" u:object_r:sysfs_wakeup:s0
32 | genfscon sysfs "/devices/platform/soc/c42d000.qcom,spmi/spmi-0/0-00/c42d000.qcom,spmi:qcom,pmk8550@0:pon_hlos@1300/c42d000.qcom,spmi:qcom,pmk8550@0:pon_hlos@1300:pwrkey-bark/wakeup" u:object_r:sysfs_wakeup:s0
33 | genfscon sysfs "/devices/platform/soc/c42d000.qcom,spmi/spmi-0/0-00/c42d000.qcom,spmi:qcom,pmk8550@0:pon_hlos@1300/c42d000.qcom,spmi:qcom,pmk8550@0:pon_hlos@1300:pwrkey-resin-bark/wakeup" u:object_r:sysfs_wakeup:s0
34 |
--------------------------------------------------------------------------------
/overlays/FrameworksEuicc/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
20 | - gsm,8
21 | - utran,9
22 | - eutran,15
23 |
24 |
25 |
39 |
40 | - 1
41 |
42 |
43 |
48 | 2
49 |
50 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/SummaryProvider.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2019 The Android Open Source Project
3 | * SPDX-FileCopyrightText: 2025 Paranoid Android
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.xiaomi.settings
8 |
9 | import android.content.ContentProvider
10 | import android.content.ContentValues
11 | import android.database.Cursor
12 | import android.net.Uri
13 | import android.os.Bundle
14 | import com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY
15 | import com.xiaomi.settings.telephony.EsimController
16 | import com.xiaomi.settings.R
17 |
18 | class SummaryProvider : ContentProvider() {
19 |
20 | private val esimController by lazy {
21 | EsimController.getInstance(requireContext())
22 | }
23 |
24 | override fun call(method: String, uri: String?, extras: Bundle?): Bundle {
25 | val bundle = Bundle()
26 | val summary =
27 | when (method) {
28 | KEY_ESIM -> getESimSummary()
29 | else -> throw IllegalArgumentException("Unknown method: $method")
30 | }
31 | bundle.putString(META_DATA_PREFERENCE_SUMMARY, summary)
32 | return bundle
33 | }
34 |
35 | override fun onCreate(): Boolean = true
36 |
37 | override fun query(
38 | uri: Uri,
39 | projection: Array?,
40 | selection: String?,
41 | selectionArgs: Array?,
42 | sortOrder: String?,
43 | ): Cursor? = throw UnsupportedOperationException()
44 |
45 | override fun getType(uri: Uri): String? = throw UnsupportedOperationException()
46 |
47 | override fun insert(uri: Uri, values: ContentValues?): Uri? =
48 | throw UnsupportedOperationException()
49 |
50 | override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int =
51 | throw UnsupportedOperationException()
52 |
53 | override fun update(
54 | uri: Uri,
55 | values: ContentValues?,
56 | selection: String?,
57 | selectionArgs: Array?,
58 | ): Int = throw UnsupportedOperationException()
59 |
60 | private fun getESimSummary(): String {
61 | val context = context ?: return ""
62 | return when {
63 | esimController.getEsimEnabled() -> context.getString(R.string.esim_summary_enabled)
64 | esimController.getEsimSupported() -> context.getString(R.string.esim_summary_disabled)
65 | else -> context.getString(R.string.esim_summary_unsupported)
66 | }
67 | }
68 |
69 | companion object {
70 | private const val KEY_ESIM = "esim"
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/sepolicy/vendor/hal_fingerprint.te:
--------------------------------------------------------------------------------
1 | allow hal_fingerprint_default vendor_fingerprint_data_file:dir create_dir_perms;
2 | allow hal_fingerprint_default vendor_fingerprint_data_file:file create_file_perms;
3 | allow hal_fingerprint_default vendor_fingerprint_data_file_fpdump:dir create_dir_perms;
4 | allow hal_fingerprint_default vendor_fingerprint_data_file_fpdump:file create_file_perms;
5 | allow hal_fingerprint_default vendor_hal_fingerprint_hwservice_xiaomi:hwservice_manager { add find };
6 | allow hal_fingerprint_default vendor_hal_perf_hwservice:hwservice_manager find;
7 | allow hal_fingerprint_default vendor_hal_perf_default:binder call;
8 | allow hal_fingerprint_default platform_app:binder { call transfer };
9 | allow hal_fingerprint_default platform_app:binder transfer;
10 | allow hal_fingerprint_default platform_app:fd *;
11 | allow hal_fingerprint_default system_app:binder { call transfer };
12 | allow hal_fingerprint_default system_app:binder transfer;
13 | allow hal_fingerprint_default system_app:fd *;
14 | allow hal_fingerprint_default sysfs:file write;
15 | allow hal_fingerprint_default vendor_sysfs_spss:dir search;
16 | allow hal_fingerprint_default vendor_sysfs_spss:file { open read };
17 | allow hal_fingerprint_default uhid_device:chr_file rw_file_perms;
18 | allow hal_fingerprint_default vendor_sysfs_graphics:dir r_dir_perms;
19 | allow hal_fingerprint_default vendor_sysfs_graphics:file rw_file_perms;
20 | allow hal_fingerprint_default input_device:dir r_dir_perms;
21 | allow hal_fingerprint_default input_device:chr_file rwx_file_perms;
22 | allow hal_fingerprint_default mnt_vendor_file:dir search;
23 | allow hal_fingerprint_default vendor_displayfeature_device:chr_file rwx_file_perms;
24 | allow hal_fingerprint_default vendor_fingerprint_device:chr_file rwx_file_perms;
25 | allow hal_fingerprint_default tee_device:chr_file rw_file_perms;
26 | allow hal_fingerprint_default vendor_dmabuf_qseecom_heap_device:chr_file r_file_perms;
27 | allow hal_fingerprint_default vendor_dmabuf_qseecom_ta_heap_device:chr_file r_file_perms;
28 | allow hal_fingerprint_default self:netlink_socket create_socket_perms_no_ioctl;
29 | allow hal_fingerprint_default vendor_sysfs_displayfeature:dir r_dir_perms;
30 | allow hal_fingerprint_default vendor_sysfs_displayfeature:file rw_file_perms;
31 | allow hal_fingerprint_default sysfs_tp_fodstatus:chr_file r_file_perms;
32 | allow hal_fingerprint_default sysfs_tp_fodstatus:file r_file_perms;
33 | allow hal_fingerprint_default touchfeature_device:chr_file rw_file_perms;
34 | allow hal_fingerprint_default surfaceflinger:binder transfer;
35 | get_prop(hal_fingerprint_default, vendor_panel_info_prop)
36 | set_prop(hal_fingerprint_default, vendor_fp_prop)
37 | set_prop(hal_fingerprint_default, vendor_fp_info_prop)
38 |
--------------------------------------------------------------------------------
/overlays/Settings/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 | 113
8 |
9 |
12 |
13 | - Vivid
14 | - Saturated
15 | - Standard
16 | - Original
17 | - P3
18 | - sRGB
19 |
20 |
21 |
24 |
25 | - 258
26 | - 256
27 | - 257
28 | - 269
29 | - 268
30 | - 267
31 |
32 |
33 |
47 | 3
48 |
49 |
--------------------------------------------------------------------------------
/sensors/SensorNotifier.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "SensorNotifier"
8 |
9 | #include
10 |
11 | #include "SensorNotifier.h"
12 |
13 | using android::hardware::sensors::V1_0::SensorFlagBits;
14 | using android::hardware::sensors::V1_0::SensorInfo;
15 |
16 | SensorNotifier::SensorNotifier(sp manager) : mManager(manager) {}
17 |
18 | SensorNotifier::~SensorNotifier() {
19 | if (mQueue != nullptr) {
20 | /*
21 | * Free the event queue.
22 | * kernel calls decStrong() on server side implementation of IEventQueue,
23 | * hence resources (including the callback) are freed as well.
24 | */
25 | mQueue = nullptr;
26 | }
27 | }
28 |
29 | Result SensorNotifier::initializeSensorQueue(std::string typeAsString, bool wakeup,
30 | sp callback) {
31 | Result res;
32 | std::vector sensorList;
33 |
34 | mManager->getSensorList([&sensorList, &res](const auto& l, auto r) {
35 | sensorList = l;
36 | res = r;
37 | });
38 | if (res != Result::OK) {
39 | LOG(ERROR) << "failed to get sensors list";
40 | return res;
41 | }
42 | auto it = std::find_if(sensorList.begin(), sensorList.end(),
43 | [this, &typeAsString, &wakeup](const SensorInfo& sensor) {
44 | return (sensor.typeAsString == typeAsString) &&
45 | ((sensor.flags & SensorFlagBits::WAKE_UP) == wakeup);
46 | });
47 |
48 | if (it != sensorList.end()) {
49 | mSensorHandle = it->sensorHandle;
50 | } else {
51 | LOG(ERROR) << "failed to get " << typeAsString << " sensor with wake-up: " << wakeup;
52 | return Result::NOT_EXIST;
53 | }
54 |
55 | mManager->createEventQueue(callback, [this, &res](const auto& q, auto r) {
56 | this->mQueue = q;
57 | res = r;
58 | });
59 | if (res != Result::OK) {
60 | LOG(ERROR) << "failed to create event queue";
61 | return res;
62 | }
63 |
64 | return Result::OK;
65 | }
66 |
67 | void SensorNotifier::activate() {
68 | if (mActive) {
69 | return;
70 | }
71 | mActive = true;
72 | mPollingThread = std::thread(&SensorNotifier::pollingFunction, this);
73 | }
74 |
75 | void SensorNotifier::deactivate() {
76 | if (!mActive) {
77 | return;
78 | }
79 | mActive = false;
80 | if (mPollingThread.joinable()) {
81 | mPollingThread.join();
82 | }
83 | if (mQueue != nullptr) {
84 | mQueue->disableSensor(mSensorHandle);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/sensors/NonUiNotifier.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "NonUiNotifier"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #include "NonUiNotifier.h"
16 | #include "SensorNotifierUtils.h"
17 |
18 | #define TOUCH_DEV_PATH "/dev/xiaomi-touch"
19 |
20 | using android::hardware::Return;
21 | using android::hardware::Void;
22 | using android::hardware::sensors::V1_0::Event;
23 |
24 | namespace {
25 |
26 | class NonUiSensorCallback : public IEventQueueCallback {
27 | public:
28 | NonUiSensorCallback() {
29 | touch_fd_ = android::base::unique_fd(open(TOUCH_DEV_PATH, O_RDWR));
30 | if (touch_fd_.get() == -1) {
31 | LOG(ERROR) << "failed to open " << TOUCH_DEV_PATH;
32 | }
33 | }
34 |
35 | Return onEvent(const Event& e) {
36 | struct touch_mode_request request = {
37 | .mode = TOUCH_MODE_NONUI_MODE,
38 | .value = static_cast(e.u.scalar),
39 | };
40 | ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &request);
41 |
42 | return Void();
43 | }
44 |
45 | private:
46 | android::base::unique_fd touch_fd_;
47 | };
48 |
49 | } // namespace
50 |
51 | NonUiNotifier::NonUiNotifier(sp manager) : SensorNotifier(manager) {
52 | initializeSensorQueue("xiaomi.sensor.nonui", true, new NonUiSensorCallback());
53 | }
54 |
55 | NonUiNotifier::~NonUiNotifier() {
56 | deactivate();
57 | }
58 |
59 | void NonUiNotifier::pollingFunction() {
60 | Result res;
61 |
62 | // Enable states of touchscreen sensors
63 | const std::vector paths = {
64 | "/sys/class/touch/touch_dev/fod_longpress_gesture_enabled",
65 | "/sys/class/touch/touch_dev/gesture_single_tap_enabled",
66 | "/sys/class/touch/touch_dev/gesture_double_tap_enabled"};
67 |
68 | pollfd* pollfds = new pollfd[paths.size()];
69 | for (size_t i = 0; i < paths.size(); ++i) {
70 | int fd = open(paths[i], O_RDONLY);
71 | if (fd < 0) {
72 | LOG(ERROR) << "failed to open " << paths[i] << " , err: " << fd;
73 | mActive = false;
74 | return;
75 | }
76 |
77 | pollfds[i].fd = fd;
78 | pollfds[i].events = POLLPRI;
79 | }
80 |
81 | while (mActive) {
82 | int rc = poll(pollfds, paths.size(), -1);
83 | if (rc < 0) {
84 | LOG(ERROR) << "failed to poll, err: " << rc;
85 | continue;
86 | }
87 |
88 | bool enabled = false;
89 | for (size_t i = 0; i < paths.size(); ++i) {
90 | enabled = enabled || readBool(pollfds[i].fd);
91 | }
92 | if (enabled) {
93 | res = mQueue->enableSensor(mSensorHandle, 20000 /* sample period */, 0 /* latency */);
94 | if (res != Result::OK) {
95 | LOG(ERROR) << "failed to enable sensor";
96 | }
97 | } else {
98 | res = mQueue->disableSensor(mSensorHandle);
99 | if (res != Result::OK) {
100 | LOG(ERROR) << "failed to disable sensor";
101 | }
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/parts/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
29 |
30 |
34 |
38 |
39 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
56 |
57 |
58 |
59 |
62 |
65 |
68 |
71 |
72 |
73 |
76 |
77 |
78 |
81 |
82 |
83 |
86 |
87 |
88 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/init/init_xiaomi8550.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015, The Linux Foundation. All rights reserved.
3 | 2016 The CyanogenMod Project.
4 | 2019-2020 The LineageOS Project.
5 | 2021 The Android Open Source Project.
6 | 2022-2024 Paranoid Android.
7 |
8 | SPDX-License-Identifier: Apache-2.0
9 |
10 | */
11 |
12 | #include
13 | #include
14 |
15 | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
16 | #include
17 | #include
18 |
19 | #include "property_service.h"
20 | #include "vendor_init.h"
21 |
22 | using android::base::GetProperty;
23 | using std::string;
24 |
25 | // List of partitions to override props
26 | static const string source_partitions[] = {
27 | "", "bootimage.", "odm.", "product.", "system.",
28 | "system_dlkm.", "system_ext.", "vendor.", "vendor_dlkm."
29 | };
30 |
31 | bool IsRecoveryMode() {
32 | return access("/system/bin/recovery", F_OK) == 0;
33 | }
34 |
35 | void property_override(char const prop[], char const value[]) {
36 | auto pi = (prop_info*) __system_property_find(prop);
37 |
38 | if (pi != nullptr)
39 | __system_property_update(pi, value, strlen(value));
40 | else
41 | __system_property_add(prop, strlen(prop), value, strlen(value));
42 | }
43 |
44 | void set_build_prop(const string &prop, const string &value) {
45 | property_override(prop.c_str(), value.c_str());
46 | }
47 |
48 | void set_ro_build_prop(const string &prop, const string &value) {
49 | string prop_name;
50 | for (const string &source : source_partitions) {
51 | prop_name = "ro.product." + source + prop;
52 | property_override(prop_name.c_str(), value.c_str());
53 | }
54 | }
55 |
56 | void vendor_load_properties() {
57 | // Detect variant and override properties
58 | string region = GetProperty("ro.boot.hwc", "");
59 | string sku = GetProperty("ro.boot.hardware.sku", "");
60 |
61 | // Override device specific props
62 | set_build_prop("ro.build.product", sku);
63 | set_ro_build_prop("device", sku);
64 |
65 | if (sku == "fuxi") { // Xiaomi 13
66 | if (region == "CN") { // China
67 | set_ro_build_prop("model", "2211133C");
68 | set_ro_build_prop("name", "fuxi");
69 | } else { // Global
70 | set_ro_build_prop("model", "2211133G");
71 | set_ro_build_prop("name", "fuxi_global");
72 | }
73 | } else if (sku == "nuwa") { // Xiaomi 13 Pro
74 | if (region == "CN") { // China
75 | set_ro_build_prop("model", "2210132C");
76 | set_ro_build_prop("name", "nuwa");
77 | } else { // Global
78 | set_ro_build_prop("model", "2210132G");
79 | set_ro_build_prop("name", "nuwa_global");
80 | }
81 | } else if (sku == "ishtar") { // Xiaomi 13 Ultra
82 | if (region == "CN") { // China
83 | set_ro_build_prop("model", "2304FPN6DC");
84 | set_ro_build_prop("name", "ishtar");
85 | } else { // Global
86 | set_ro_build_prop("model", "2304FPN6DG");
87 | set_ro_build_prop("name", "ishtar_global");
88 | }
89 | } else if (sku == "vermeer") { // POCO F6 Pro / Redmi K70
90 | if (region == "CN") { // China - Redmi K70
91 | set_ro_build_prop("model", "23113RKC6C");
92 | set_ro_build_prop("name", "vermeer");
93 | set_ro_build_prop("brand", "Redmi");
94 | } else { // Global - POCO F6 Pro
95 | set_ro_build_prop("model", "23113RKC6G");
96 | set_ro_build_prop("name", "vermeer_global");
97 | }
98 | }
99 |
100 | // Override hardware revision
101 | set_build_prop("ro.boot.hardware.revision", sku);
102 | }
--------------------------------------------------------------------------------
/update-sha1sums.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (C) 2016 The CyanogenMod Project
4 | # Copyright (C) 2017-2020 The LineageOS Project
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | import os
20 | import sys
21 | from hashlib import sha1
22 |
23 | device = 'sm8550-common'
24 | vendor = 'xiaomi'
25 |
26 | with open('proprietary-files.txt', 'r') as f:
27 | lines = f.read().splitlines()
28 | vendorPath = '../../../vendor/' + vendor + '/' + device + '/proprietary'
29 | needSHA1 = False
30 |
31 |
32 | class Section:
33 | def __init__(self, name, group):
34 | self.name = name
35 | self.group = group
36 |
37 | def __repr__(self):
38 | return repr(self.name)
39 |
40 | def apply(self):
41 | if self.group:
42 | lines.append(self.name)
43 | # Ignore leading '-' while sorting
44 | self.group = sorted(self.group, key=lambda line: line[1:] if line.startswith('-') else line)
45 | lines.extend(self.group)
46 | lines.append('')
47 |
48 |
49 | def sort_file(ignore_section=""):
50 | grp = []
51 | sections = []
52 | name = ""
53 |
54 | for line in lines:
55 | if len(line) != 0:
56 | if line[0] == '#':
57 | if name and grp:
58 | sections.append(Section(name, grp))
59 | grp = []
60 | if ignore_section and ignore_section in line:
61 | name = ""
62 | else:
63 | name = line
64 | elif name:
65 | grp.append(line)
66 |
67 | if name and grp:
68 | sections.append(Section(name, grp))
69 |
70 | lines.clear()
71 |
72 | sections = sorted(sections, key=lambda sec: str.lower(sec.name))
73 | for section in sections:
74 | section.apply()
75 |
76 |
77 | def cleanup():
78 | for index, line in enumerate(lines):
79 | # Skip empty or commented lines
80 | if len(line) == 0 or line[0] == '#' or '|' not in line:
81 | continue
82 |
83 | # Drop SHA1 hash, if existing
84 | lines[index] = line.split('|')[0]
85 | lines.append('')
86 |
87 |
88 | def update():
89 | for index, line in enumerate(lines):
90 | # Skip empty lines
91 | if len(line) == 0:
92 | continue
93 |
94 | # Check if we need to set SHA1 hash for the next files
95 | if line[0] == '#':
96 | needSHA1 = (' - from' in line)
97 | continue
98 |
99 | if needSHA1:
100 | # Remove existing SHA1 hash
101 | line = line.split('|')[0]
102 |
103 | filePath = line.split(';')[0].split(':')[-1]
104 | if filePath[0] == '-':
105 | filePath = filePath[1:]
106 |
107 | with open(os.path.join(vendorPath, filePath), 'rb') as f:
108 | hash = sha1(f.read()).hexdigest()
109 |
110 | lines[index] = '%s|%s' % (line, hash)
111 | lines.append('')
112 |
113 |
114 | if len(sys.argv) >= 2:
115 | if sys.argv[1] == '-c':
116 | cleanup()
117 | elif sys.argv[1] == '-s':
118 | if len(sys.argv) == 3:
119 | sort_file(sys.argv[2])
120 | else:
121 | sort_file()
122 | else:
123 | update()
124 | else:
125 | update()
126 |
127 | with open('proprietary-files.txt', 'w') as file:
128 | file.write('\n'.join(lines))
129 |
--------------------------------------------------------------------------------
/sensors/AodNotifier.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "AodNotifier"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #include "AodNotifier.h"
16 | #include "SensorNotifierUtils.h"
17 |
18 | #define DISP_FEATURE_PATH "/dev/mi_display/disp_feature"
19 |
20 | using android::hardware::Return;
21 | using android::hardware::Void;
22 | using android::hardware::sensors::V1_0::Event;
23 |
24 | namespace {
25 |
26 | void requestDozeBrightness(int fd, __u32 doze_brightness) {
27 | disp_doze_brightness_req req;
28 | req.base.flag = 0;
29 | req.base.disp_id = MI_DISP_PRIMARY;
30 | req.doze_brightness = doze_brightness;
31 | ioctl(fd, MI_DISP_IOCTL_SET_DOZE_BRIGHTNESS, &req);
32 | }
33 |
34 | class AodSensorCallback : public IEventQueueCallback {
35 | public:
36 | AodSensorCallback() {
37 | disp_fd_ = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
38 | if (disp_fd_.get() == -1) {
39 | LOG(ERROR) << "failed to open " << DISP_FEATURE_PATH;
40 | }
41 | }
42 |
43 | Return onEvent(const Event& e) {
44 | requestDozeBrightness(disp_fd_.get(), (e.u.scalar == 3 || e.u.scalar == 5)
45 | ? DOZE_BRIGHTNESS_LBM
46 | : DOZE_BRIGHTNESS_HBM);
47 | return Void();
48 | }
49 |
50 | private:
51 | android::base::unique_fd disp_fd_;
52 | };
53 |
54 | } // namespace
55 |
56 | AodNotifier::AodNotifier(sp manager) : SensorNotifier(manager) {
57 | initializeSensorQueue("xiaomi.sensor.aod", true, new AodSensorCallback());
58 | }
59 |
60 | AodNotifier::~AodNotifier() {
61 | deactivate();
62 | }
63 |
64 | void AodNotifier::pollingFunction() {
65 | Result res;
66 |
67 | android::base::unique_fd disp_fd_ = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
68 | if (disp_fd_.get() == -1) {
69 | LOG(ERROR) << "failed to open " << DISP_FEATURE_PATH;
70 | }
71 |
72 | // Register for power events
73 | disp_event_req req;
74 | req.base.flag = 0;
75 | req.base.disp_id = MI_DISP_PRIMARY;
76 | req.type = MI_DISP_EVENT_POWER;
77 | ioctl(disp_fd_.get(), MI_DISP_IOCTL_REGISTER_EVENT, &req);
78 |
79 | struct pollfd dispEventPoll = {
80 | .fd = disp_fd_.get(),
81 | .events = POLLIN,
82 | .revents = 0,
83 | };
84 |
85 | while (mActive) {
86 | int rc = poll(&dispEventPoll, 1, -1);
87 | if (rc < 0) {
88 | LOG(ERROR) << "failed to poll " << DISP_FEATURE_PATH << ", err: " << rc;
89 | continue;
90 | }
91 |
92 | std::shared_ptr response = parseDispEvent(disp_fd_.get());
93 | if (response == nullptr) {
94 | continue;
95 | }
96 |
97 | if (response->base.type != MI_DISP_EVENT_POWER) {
98 | LOG(ERROR) << "unexpected display event: " << response->base.type;
99 | continue;
100 | }
101 |
102 | int value = response->data[0];
103 | LOG(VERBOSE) << "received data: " << std::bitset<8>(value);
104 |
105 | switch (response->data[0]) {
106 | case MI_DISP_POWER_LP1:
107 | FALLTHROUGH_INTENDED;
108 | case MI_DISP_POWER_LP2:
109 | res = mQueue->enableSensor(mSensorHandle, 20000 /* sample period */,
110 | 0 /* latency */);
111 | if (res != Result::OK) {
112 | LOG(ERROR) << "failed to enable sensor";
113 | }
114 | break;
115 | case MI_DISP_POWER_ON:
116 | res = mQueue->disableSensor(mSensorHandle);
117 | if (res != Result::OK) {
118 | LOG(ERROR) << "failed to disable sensor";
119 | }
120 | requestDozeBrightness(disp_fd_.get(), DOZE_TO_NORMAL);
121 | break;
122 | default:
123 | res = mQueue->disableSensor(mSensorHandle);
124 | if (res != Result::OK) {
125 | LOG(ERROR) << "failed to disable sensor";
126 | }
127 | break;
128 | }
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/init/ueventd.xiaomi.rc:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
2 | #
3 | # Redistribution and use in source and binary forms, with or without
4 | # modification, are permitted (subject to the limitations in the
5 | # disclaimer below) provided that the following conditions are met:
6 | #
7 | # * Redistributions of source code must retain the above copyright
8 | # notice, this list of conditions and the following disclaimer.
9 | #
10 | # * Redistributions in binary form must reproduce the above
11 | # copyright notice, this list of conditions and the following
12 | # disclaimer in the documentation and/or other materials provided
13 | # with the distribution.
14 | #
15 | # * Neither the name of The Linux Foundation nor the names of its
16 | # contributors may be used to endorse or promote products derived
17 | # from this software without specific prior written permission.
18 | #
19 | # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
20 | # GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
21 | # HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
22 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | # Base path for all VM's
34 | firmware_directories /vendor/vm-system/
35 |
36 | # TrustedUI VM
37 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.mdt system "/vendor/bin/vmmgr -r"
38 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.b00 system "/vendor/bin/vmmgr -r"
39 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.b01 system "/vendor/bin/vmmgr -r"
40 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.b02 system "/vendor/bin/vmmgr -r"
41 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.b03 system "/vendor/bin/vmmgr -r"
42 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.b04 system "/vendor/bin/vmmgr -r"
43 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f3c00000/firmware/trustedvm.b05 system "/vendor/bin/vmmgr -r"
44 |
45 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.mdt system "/vendor/bin/vmmgr -r"
46 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.b00 system "/vendor/bin/vmmgr -r"
47 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.b01 system "/vendor/bin/vmmgr -r"
48 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.b02 system "/vendor/bin/vmmgr -r"
49 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.b03 system "/vendor/bin/vmmgr -r"
50 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.b04 system "/vendor/bin/vmmgr -r"
51 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@0/firmware/trustedvm.b05 system "/vendor/bin/vmmgr -r"
52 |
53 | # OEM VM
54 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f8000000/firmware/oemvm.mdt system "/vendor/bin/vmmgr -r"
55 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f8000000/firmware/oemvm.b01 system "/vendor/bin/vmmgr -r"
56 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f8000000/firmware/oemvm.b02 system "/vendor/bin/vmmgr -r"
57 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f8000000/firmware/oemvm.b03 system "/vendor/bin/vmmgr -r"
58 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f8000000/firmware/oemvm.b04 system "/vendor/bin/vmmgr -r"
59 | external_firmware_handler /devices/platform/soc/soc:qcom,guestvm_loader@f8000000/firmware/oemvm.b05 system "/vendor/bin/vmmgr -r"
60 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@1/firmware/oemvm.mdt system "/vendor/bin/vmmgr -r"
61 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@1/firmware/oemvm.b01 system "/vendor/bin/vmmgr -r"
62 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@1/firmware/oemvm.b02 system "/vendor/bin/vmmgr -r"
63 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@1/firmware/oemvm.b03 system "/vendor/bin/vmmgr -r"
64 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@1/firmware/oemvm.b04 system "/vendor/bin/vmmgr -r"
65 | external_firmware_handler /devices/platform/soc/soc:gh-secure-vm-loader@1/firmware/oemvm.b05 system "/vendor/bin/vmmgr -r"
66 |
67 | # Lineage Charger
68 | /sys/class/qcom-battery night_charging 0660 system system
69 |
70 | # Xiaomi Display Feature
71 | subsystem mi_display
72 | devname uevent_devpath
73 | dirname /dev/mi_display
74 | /dev/mi_display/* 0666 root graphics
75 |
76 | # Xiaomi NTAG
77 | /dev/ntag5-nci 0660 nfc nfc
78 |
--------------------------------------------------------------------------------
/overlays/Frameworks/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 | 0
7 |
8 |
12 | 120
13 |
14 |
15 |
16 | - 258
17 | - 256
18 | - 257
19 | - 269
20 | - 268
21 | - 267
22 |
23 |
24 |
29 | true
30 |
31 |
49 | true
50 |
51 |
68 | true
69 |
70 |
71 | true
72 |
73 |
75 | 70
76 |
77 |
78 | -15
79 |
80 |
81 | 15
82 |
83 |
84 | -40
85 |
86 |
87 | 40
88 |
89 |
90 | true
91 |
92 |
95 | true
96 |
97 |
98 | co.aospa.sensor.single_tap
99 |
100 |
101 | co.aospa.sensor.double_tap
102 |
103 |
104 | co.aospa.sensor.udfps
105 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/display/ColorService.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2023-2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.display
7 |
8 | import android.app.Service
9 | import android.content.BroadcastReceiver
10 | import android.content.Context
11 | import android.content.Intent
12 | import android.content.IntentFilter
13 | import android.database.ContentObserver
14 | import android.hardware.display.AmbientDisplayConfiguration
15 | import android.os.Handler
16 | import android.os.IBinder
17 | import android.os.SystemProperties
18 | import android.os.UserHandle
19 | import android.provider.Settings
20 | import android.util.Log
21 | import androidx.core.os.postDelayed
22 |
23 | class ColorService : Service() {
24 |
25 | companion object {
26 | private const val TAG = "ColorService"
27 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
28 |
29 | private val DEFAULT_COLOR_MODE = SystemProperties.getInt("persist.sys.sf.native_mode", 0)
30 | }
31 |
32 | private val handler = Handler()
33 | private lateinit var ambientConfig: AmbientDisplayConfiguration
34 | private var isDozing = false
35 |
36 | private val settingObserver =
37 | object : ContentObserver(handler) {
38 | override fun onChange(selfChange: Boolean) {
39 | if (DEBUG) Log.d(TAG, "SettingObserver: onChange")
40 | setCurrentColorMode()
41 | }
42 | }
43 |
44 | private val screenStateReceiver =
45 | object : BroadcastReceiver() {
46 | override fun onReceive(context: Context, intent: Intent) {
47 | if (DEBUG) Log.d(TAG, "onReceive: ${intent.action}")
48 | when (intent.action) {
49 | Intent.ACTION_SCREEN_ON -> {
50 | if (isDozing) {
51 | isDozing = false
52 | handler.removeCallbacksAndMessages(null)
53 | handler.postDelayed(100) {
54 | if (DEBUG) Log.d(TAG, "Was in AOD, restore color mode")
55 | setCurrentColorMode()
56 | }
57 | }
58 | }
59 | Intent.ACTION_SCREEN_OFF -> {
60 | if (!ambientConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)) {
61 | if (DEBUG) Log.d(TAG, "AOD is not enabled")
62 | isDozing = false
63 | return
64 | }
65 | /**
66 | * Use standard color mode in AOD to prevent black pixels from illuminating,
67 | * thus reducing power consumption.
68 | */
69 | isDozing = true
70 | handler.removeCallbacksAndMessages(null)
71 | if (DEBUG) Log.d(TAG, "Entered AOD, set color mode to standard")
72 | ColorMode.STANDARD.setCurrent()
73 | }
74 | }
75 | }
76 | }
77 |
78 | override fun onCreate() {
79 | super.onCreate()
80 | if (DEBUG) Log.d(TAG, "onCreate")
81 | ambientConfig = AmbientDisplayConfiguration(this)
82 | contentResolver.registerContentObserver(
83 | Settings.System.getUriFor(Settings.System.DISPLAY_COLOR_MODE),
84 | false,
85 | settingObserver,
86 | UserHandle.USER_CURRENT,
87 | )
88 | val screenStateFilter =
89 | IntentFilter().apply {
90 | addAction(Intent.ACTION_SCREEN_ON)
91 | addAction(Intent.ACTION_SCREEN_OFF)
92 | }
93 | registerReceiver(screenStateReceiver, screenStateFilter)
94 | setCurrentColorMode()
95 | }
96 |
97 | override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
98 | if (DEBUG) Log.d(TAG, "onStartCommand")
99 | return START_STICKY
100 | }
101 |
102 | override fun onDestroy() {
103 | if (DEBUG) Log.d(TAG, "onDestroy")
104 | contentResolver.unregisterContentObserver(settingObserver)
105 | unregisterReceiver(screenStateReceiver)
106 | super.onDestroy()
107 | }
108 |
109 | override fun onBind(intent: Intent?): IBinder? = null
110 |
111 | private fun setCurrentColorMode() {
112 | if (isDozing) {
113 | if (DEBUG) Log.d(TAG, "setCurrentColorMode: skip in AOD")
114 | return
115 | }
116 | val colorMode =
117 | Settings.System.getIntForUser(
118 | contentResolver,
119 | Settings.System.DISPLAY_COLOR_MODE,
120 | DEFAULT_COLOR_MODE,
121 | UserHandle.USER_CURRENT,
122 | )
123 | val mode =
124 | ColorMode.fromId(colorMode)
125 | ?: run {
126 | Log.e(TAG, "setCurrentColorMode: $colorMode is not in colorMap!")
127 | return
128 | }
129 | if (DEBUG) Log.d(TAG, "setCurrentColorMode: $mode")
130 | mode.setCurrent()
131 | }
132 |
133 | enum class ColorMode(
134 | val id: Int,
135 | val mode: Int,
136 | val value: Int,
137 | val cookie: Int,
138 | val isExpert: Boolean = false,
139 | ) {
140 | VIVID(258, 0, 2, 255),
141 | SATURATED(256, 1, 2, 255),
142 | STANDARD(257, 2, 2, 255),
143 | ORIGINAL(269, 26, 1, 0, true),
144 | P3(268, 26, 2, 0, true),
145 | SRGB(267, 26, 3, 0, true);
146 |
147 | fun setCurrent() {
148 | if (DEBUG) Log.d(TAG, "set current mode $this")
149 | DisplayFeatureWrapper.setFeature(mode, value, cookie)
150 | if (isExpert) {
151 | DisplayFeatureWrapper.setFeature(EXPERT_MODE, EXPERT_VALUE, EXPERT_COOKIE)
152 | }
153 | }
154 |
155 | companion object {
156 | private const val EXPERT_MODE = 26
157 | private const val EXPERT_VALUE = 0
158 | private const val EXPERT_COOKIE = 10
159 |
160 | fun fromId(id: Int): ColorMode? {
161 | return values().find { it.id == id }
162 | }
163 | }
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/BoardConfigCommon.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2023-2024 Paranoid Android
3 | #
4 | # SPDX-License-Identifier: Apache-2.0
5 | #
6 |
7 | COMMON_PATH := device/xiaomi/sm8550-common
8 |
9 | # A/B
10 | AB_OTA_UPDATER := true
11 |
12 | AB_OTA_PARTITIONS += \
13 | boot \
14 | dtbo \
15 | init_boot \
16 | odm \
17 | product \
18 | recovery \
19 | system \
20 | system_dlkm \
21 | system_ext \
22 | vbmeta \
23 | vbmeta_system \
24 | vendor \
25 | vendor_boot \
26 | vendor_dlkm
27 |
28 | # Architecture
29 | TARGET_ARCH := arm64
30 | TARGET_ARCH_VARIANT := armv8-2a-dotprod
31 | TARGET_CPU_ABI := arm64-v8a
32 | TARGET_CPU_VARIANT := kryo785
33 |
34 | # Boot
35 | BOARD_BOOT_HEADER_VERSION := 4
36 | BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
37 |
38 | BOARD_INIT_BOOT_HEADER_VERSION := 4
39 | BOARD_MKBOOTIMG_INIT_ARGS += --header_version $(BOARD_INIT_BOOT_HEADER_VERSION)
40 |
41 | BOARD_RAMDISK_USE_LZ4 := true
42 |
43 | # Boot control
44 | SOONG_CONFIG_NAMESPACES += ufsbsg
45 | SOONG_CONFIG_ufsbsg += ufsframework
46 | SOONG_CONFIG_ufsbsg_ufsframework := bsg
47 |
48 | # Bootloader
49 | TARGET_BOOTLOADER_BOARD_NAME ?= kalama
50 | TARGET_NO_BOOTLOADER := true
51 |
52 | # Build
53 | BUILD_BROKEN_DUP_RULES := true
54 | BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true
55 |
56 | # DTB
57 | BOARD_INCLUDE_DTB_IN_BOOTIMG := true
58 |
59 | # HIDL
60 | DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE += \
61 | $(COMMON_PATH)/configs/vintf/framework_matrix_xiaomi.xml
62 |
63 | DEVICE_MANIFEST_FILE += \
64 | $(COMMON_PATH)/configs/vintf/manifest_kalama.xml \
65 | $(COMMON_PATH)/configs/vintf/manifest_xiaomi.xml
66 |
67 | # Init
68 | TARGET_INIT_VENDOR_LIB := //$(COMMON_PATH):libinit_xiaomi_sm8550
69 | TARGET_RECOVERY_DEVICE_MODULES := libinit_xiaomi_sm8550
70 |
71 | # Kernel
72 | BOARD_BOOTCONFIG := \
73 | androidboot.hardware=qcom \
74 | androidboot.memcg=1 \
75 | androidboot.usbcontroller=a600000.dwc3
76 |
77 | BOARD_KERNEL_CMDLINE := \
78 | kasan=off \
79 | disable_dma32=on \
80 | rcu_nocbs=all \
81 | rcutree.enable_rcu_lazy=1 \
82 | mtdoops.fingerprint=$(AOSPA_VERSION)
83 |
84 | BOARD_KERNEL_PAGESIZE := 4096
85 | BOARD_USES_GENERIC_KERNEL_IMAGE := true
86 | TARGET_HAS_GENERIC_KERNEL_HEADERS := true
87 |
88 | # Lineage Health
89 | TARGET_HEALTH_CHARGING_CONTROL_CHARGING_ENABLED := 0
90 | TARGET_HEALTH_CHARGING_CONTROL_CHARGING_DISABLED := 1
91 | TARGET_HEALTH_CHARGING_CONTROL_CHARGING_PATH := /sys/class/qcom-battery/night_charging
92 |
93 | # Metadata
94 | BOARD_USES_METADATA_PARTITION := true
95 |
96 | # Partitions
97 | BOARD_BOOTIMAGE_PARTITION_SIZE := 201326592
98 | BOARD_DTBOIMG_PARTITION_SIZE := 25165824
99 | BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE := 8388608
100 | BOARD_RECOVERYIMAGE_PARTITION_SIZE := 104857600
101 | BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 100663296
102 |
103 | BOARD_SUPER_PARTITION_SIZE := 9663676416
104 | BOARD_SUPER_PARTITION_GROUPS := qti_dynamic_partitions
105 | BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST := odm product system system_dlkm system_ext vendor vendor_dlkm
106 | BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := 9659482112
107 |
108 | BOARD_FLASH_BLOCK_SIZE := 262144
109 |
110 | BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := erofs
111 | BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs
112 | BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs
113 | BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
114 | BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs
115 | BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs
116 | BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
117 |
118 | TARGET_COPY_OUT_ODM := odm
119 | TARGET_COPY_OUT_PRODUCT := product
120 | TARGET_COPY_OUT_SYSTEM_DLKM := system_dlkm
121 | TARGET_COPY_OUT_SYSTEM_EXT := system_ext
122 | TARGET_COPY_OUT_VENDOR := vendor
123 | TARGET_COPY_OUT_VENDOR_DLKM := vendor_dlkm
124 |
125 | # Power
126 | TARGET_POWERHAL_MODE_EXT := $(COMMON_PATH)/power/power-mode.cpp
127 |
128 | # PowerShare
129 | TARGET_POWERSHARE_NODE := /sys/class/qcom-battery/reverse_chg_mode
130 |
131 | # Properties
132 | TARGET_ODM_PROP += $(COMMON_PATH)/configs/properties/odm.prop
133 | TARGET_SYSTEM_PROP += $(COMMON_PATH)/configs/properties/system.prop
134 | TARGET_VENDOR_PROP += $(COMMON_PATH)/configs/properties/vendor.prop
135 |
136 | # Recovery
137 | BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE := true
138 | TARGET_RECOVERY_FSTAB := $(COMMON_PATH)/init/fstab.qcom
139 | TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
140 | TARGET_RECOVERY_UI_MARGIN_HEIGHT := 80
141 | TARGET_USERIMAGES_USE_F2FS := true
142 |
143 | # SELinux
144 | include device/xiaomi/sepolicy/SEPolicy.mk
145 | BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
146 | SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/private
147 | SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/public
148 |
149 | # Verified Boot
150 | BOARD_AVB_ENABLE := true
151 | BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3
152 | BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT := true
153 |
154 | BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA4096
155 | BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
156 | BOARD_AVB_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
157 | BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION := 4
158 |
159 | BOARD_AVB_DTBO_ALGORITHM := SHA256_RSA4096
160 | BOARD_AVB_DTBO_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
161 | BOARD_AVB_DTBO_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
162 | BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION := 3
163 |
164 | BOARD_AVB_RECOVERY_ALGORITHM := SHA256_RSA4096
165 | BOARD_AVB_RECOVERY_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
166 | BOARD_AVB_RECOVERY_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
167 | BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION := 1
168 |
169 | BOARD_AVB_VBMETA_SYSTEM := system system_dlkm system_ext product
170 | BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA4096
171 | BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
172 | BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
173 | BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 2
174 |
175 | BOARD_AVB_VENDOR_BOOT_ALGORITHM := SHA256_RSA4096
176 | BOARD_AVB_VENDOR_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
177 | BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
178 | BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX_LOCATION := 5
179 |
180 | BOARD_AVB_SYSTEM_DLKM_ADD_HASHTREE_FOOTER_ARGS += --hash_algorithm sha256
181 | BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += --hash_algorithm sha256
182 | BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += --hash_algorithm sha256
183 | BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += --hash_algorithm sha256
184 |
185 | # WiFi
186 | include device/qcom/wlan/kalama/BoardConfigWlan.mk
187 |
--------------------------------------------------------------------------------
/udfps/UdfpsHandler.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | * 2023 Paranoid Android
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #define LOG_TAG "UdfpsHandler.xiaomi_sm8550"
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | #include
20 | #include
21 |
22 | #include "UdfpsHandler.h"
23 |
24 | #define COMMAND_NIT 10
25 | #define TARGET_BRIGHTNESS_OFF 0
26 | #define TARGET_BRIGHTNESS_1000NIT 1
27 | #define TARGET_BRIGHTNESS_110NIT 6
28 |
29 | #define LOW_BRIGHTNESS_THRESHHOLD 100
30 |
31 | #define COMMAND_FOD_PRESS_STATUS 1
32 | #define COMMAND_FOD_PRESS_X 2
33 | #define COMMAND_FOD_PRESS_Y 3
34 | #define PARAM_FOD_PRESSED 1
35 | #define PARAM_FOD_RELEASED 0
36 |
37 | #define DISP_FEATURE_PATH "/dev/mi_display/disp_feature"
38 | #define TOUCH_DEV_PATH "/dev/xiaomi-touch"
39 |
40 | using ::aidl::android::hardware::biometrics::fingerprint::AcquiredInfo;
41 |
42 | namespace {
43 |
44 | static std::shared_ptr parseDispEvent(int fd) {
45 | disp_event header;
46 | ssize_t headerSize = read(fd, &header, sizeof(header));
47 | if (headerSize < sizeof(header)) {
48 | LOG(ERROR) << "unexpected display event header size: " << headerSize;
49 | return nullptr;
50 | }
51 |
52 | std::shared_ptr response(static_cast(malloc(header.length)),
53 | free);
54 | if (!response) {
55 | LOG(ERROR) << "failed to allocate memory for display event response";
56 | return nullptr;
57 | }
58 | response->base = header;
59 |
60 | int dataLength = response->base.length - sizeof(response->base);
61 | if (dataLength < 0) {
62 | LOG(ERROR) << "invalid data length: " << response->base.length;
63 | return nullptr;
64 | }
65 |
66 | ssize_t dataSize = read(fd, &response->data, dataLength);
67 | if (dataSize < dataLength) {
68 | LOG(ERROR) << "unexpected display event data size: " << dataSize;
69 | return nullptr;
70 | }
71 |
72 | return response;
73 | }
74 |
75 | struct disp_base displayBasePrimary = {
76 | .flag = 0,
77 | .disp_id = MI_DISP_PRIMARY,
78 | };
79 |
80 | } // anonymous namespace
81 |
82 | class XiaomiSm8550UdfpsHander : public UdfpsHandler {
83 | public:
84 | void init(fingerprint_device_t* device) {
85 | mDevice = device;
86 | disp_fd_ = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
87 | touch_fd_ = android::base::unique_fd(open(TOUCH_DEV_PATH, O_RDWR));
88 |
89 | // Thread to listen for fod ui changes
90 | std::thread([this]() {
91 | android::base::unique_fd fd(open(DISP_FEATURE_PATH, O_RDWR));
92 | if (fd < 0) {
93 | LOG(ERROR) << "failed to open " << DISP_FEATURE_PATH << " , err: " << fd;
94 | return;
95 | }
96 |
97 | // Register for FOD events
98 | struct disp_event_req displayEventRequest = {
99 | .base = displayBasePrimary,
100 | .type = MI_DISP_EVENT_FOD,
101 | };
102 | if (ioctl(fd.get(), MI_DISP_IOCTL_REGISTER_EVENT, &displayEventRequest) < 0) {
103 | LOG(ERROR) << "failed to register FOD event";
104 | return;
105 | }
106 |
107 | struct pollfd dispEventPoll = {
108 | .fd = fd.get(),
109 | .events = POLLIN,
110 | .revents = 0,
111 | };
112 |
113 | while (true) {
114 | int rc = poll(&dispEventPoll, 1, -1);
115 | if (rc < 0) {
116 | LOG(ERROR) << "failed to poll " << DISP_FEATURE_PATH << ", err: " << rc;
117 | continue;
118 | }
119 |
120 | std::shared_ptr response = parseDispEvent(fd.get());
121 | if (!response) {
122 | continue;
123 | }
124 |
125 | if (response->base.type != MI_DISP_EVENT_FOD) {
126 | LOG(ERROR) << "unexpected display event: " << response->base.type;
127 | continue;
128 | }
129 |
130 | int value = response->data[0];
131 | LOG(DEBUG) << "received data: " << std::bitset<8>(value);
132 |
133 | bool localHbmUiReady = value & LOCAL_HBM_UI_READY;
134 | bool requestLowBrightnessCapture = value & FOD_LOW_BRIGHTNESS_CAPTURE;
135 |
136 | mDevice->extCmd(mDevice, COMMAND_NIT,
137 | localHbmUiReady
138 | ? (requestLowBrightnessCapture ? TARGET_BRIGHTNESS_110NIT
139 | : TARGET_BRIGHTNESS_1000NIT)
140 | : TARGET_BRIGHTNESS_OFF);
141 | }
142 | }).detach();
143 | }
144 |
145 | void onFingerDown(uint32_t x, uint32_t y, float /*minor*/, float /*major*/) {
146 | LOG(DEBUG) << __func__ << "x: " << x << ", y: " << y;
147 |
148 | mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_X, x);
149 | mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, y);
150 | mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_PRESSED);
151 |
152 | // Update fod_finger_state node in case hwmodule polls it
153 | struct touch_mode_request touchRequest = {
154 | .mode = TOUCH_MODE_FOD_FINGER_STATE,
155 | .value = 1,
156 | };
157 | ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &touchRequest);
158 |
159 | // Request HBM
160 | struct disp_local_hbm_req displayLhbmRequest = {
161 | .base = displayBasePrimary,
162 | .local_hbm_value = LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT,
163 | };
164 | ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &displayLhbmRequest);
165 | }
166 |
167 | void onFingerUp() {
168 | LOG(DEBUG) << __func__;
169 |
170 | mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_X, 0);
171 | mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, 0);
172 | mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_RELEASED);
173 |
174 | // Disable HBM
175 | struct disp_local_hbm_req displayLhbmRequest = {
176 | .base = displayBasePrimary,
177 | .local_hbm_value = LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP,
178 | };
179 | ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &displayLhbmRequest);
180 |
181 | // Update fod_finger_state node in case hwmodule polls it
182 | struct touch_mode_request touchRequest = {
183 | .mode = TOUCH_MODE_FOD_FINGER_STATE,
184 | .value = 0,
185 | };
186 | ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &touchRequest);
187 | }
188 |
189 | void onAcquired(int32_t result, int32_t vendorCode) {
190 | LOG(DEBUG) << __func__ << " result: " << result << " vendorCode: " << vendorCode;
191 | if (static_cast(result) == AcquiredInfo::GOOD
192 | || (static_cast(result) != AcquiredInfo::GOOD && vendorCode == 44)) {
193 | onFingerUp();
194 | }
195 | }
196 |
197 | void cancel() { LOG(DEBUG) << __func__; }
198 |
199 | private:
200 | fingerprint_device_t* mDevice;
201 | android::base::unique_fd disp_fd_;
202 | android::base::unique_fd touch_fd_;
203 | };
204 |
205 | static UdfpsHandler* create() {
206 | return new XiaomiSm8550UdfpsHander();
207 | }
208 |
209 | static void destroy(UdfpsHandler* handler) {
210 | delete handler;
211 | }
212 |
213 | extern "C" UdfpsHandlerFactory UDFPS_HANDLER_FACTORY = {
214 | .create = create,
215 | .destroy = destroy,
216 | };
217 |
--------------------------------------------------------------------------------
/parts/src/com/xiaomi/settings/telephony/EsimController.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2025 Paranoid Android
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.xiaomi.settings.telephony
7 |
8 | import android.app.ActivityThread
9 | import android.content.Context
10 | import android.content.pm.PackageManager
11 | import android.os.SystemProperties
12 | import android.telephony.SubscriptionInfo
13 | import android.telephony.SubscriptionManager
14 | import android.text.TextUtils
15 | import android.util.Log
16 | import dalvik.system.DexClassLoader
17 | import java.lang.reflect.InvocationHandler
18 | import java.lang.reflect.Method
19 | import java.lang.reflect.Proxy
20 |
21 | class EsimController private constructor(private val context: Context) {
22 |
23 | companion object {
24 | private const val TAG = "EsimController"
25 | private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
26 |
27 | private const val DEVICE_ESIM_SUPPORT_LIST = "fuxi,nuwa"
28 | private const val PROPERTY_DEVICE_INFO_HW = "ro.boot.hwc"
29 | private const val PROPERTY_DEVICE_NAME = "ro.product.device"
30 |
31 | private const val MIRILHOOK_CLASS_NAME = "com.xiaomi.mirilhook.MiRilHook"
32 | private const val MIRILHOOK_JAR_PATH = "/system_ext/framework/mirilhook.jar"
33 | private const val QCRILHOOKCALLBACK_CLASS_NAME = "com.qualcomm.qcrilhook.QcRilHookCallback"
34 | private const val QCRILHOOK_JAR_PATH = "/system_ext/framework/qcrilhook.jar"
35 |
36 | @Volatile
37 | private var instance: EsimController? = null
38 |
39 | fun getInstance(context: Context): EsimController {
40 | return instance ?: synchronized(this) {
41 | instance ?: EsimController(context.applicationContext).also { instance = it }
42 | }
43 | }
44 | }
45 |
46 | private var miRilJarLoader: DexClassLoader? = null
47 | private var miRilHookClass: Class<*>? = null
48 | private var miRilHookObj: Any? = null
49 | private var qcRilJarLoader: DexClassLoader? = null
50 | private var qcRilHookCallbackClass: Class<*>? = null
51 | private var qcRilHookCallbackObj: Any? = null
52 |
53 | fun onBootCompleted() {
54 | if (DEBUG) Log.d(TAG, "onBootCompleted")
55 | setupHook()
56 | updateEuicc()
57 | }
58 |
59 | fun getEsimActive(): Boolean {
60 | val subscriptionManager = context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE) as? SubscriptionManager
61 | val subscriptionInfoList = subscriptionManager?.activeSubscriptionInfoList ?: return false
62 |
63 | for (subscriptionInfo in subscriptionInfoList) {
64 | if (subscriptionInfo.isEmbedded) {
65 | if (DEBUG) Log.d(TAG, "Found eSIM profile: ${subscriptionInfo.displayName}, ${subscriptionInfo.carrierName}")
66 | return true
67 | }
68 | }
69 | if (DEBUG) Log.d(TAG, "No eSIM profiles found.")
70 | return false
71 | }
72 |
73 | fun getEsimSupported(): Boolean {
74 | return DEVICE_ESIM_SUPPORT_LIST.contains(SystemProperties.get(PROPERTY_DEVICE_NAME)) &&
75 | TextUtils.equals(SystemProperties.get(PROPERTY_DEVICE_INFO_HW), "GL")
76 | }
77 |
78 | fun getEsimEnabled(): Boolean {
79 | return getEsimSupported() &&
80 | (callMiRilHookMethod("onGetEsimStatus", -1) as? Int ?: -1) == 0
81 | }
82 |
83 | fun setEsimEnabled(isEnabled: Boolean) {
84 | if (DEBUG) Log.d(TAG, "setEsimEnabled, isEnabled = $isEnabled")
85 | callMiRilHookMethod("onHookUimPowerReqEx", false, 0, 2, -1)
86 | callMiRilHookMethod("onSetEsimStatus", -1, if (isEnabled) 0 else 1, true)
87 | callMiRilHookMethod("onHookUimPowerReqEx", false, 1, 2, if (isEnabled) 1 else 0)
88 | updateEuicc()
89 | }
90 |
91 | private fun setupHook() {
92 | if (DEBUG) Log.d(TAG, "setupHook, context = $context")
93 | if (!getEsimSupported()) {
94 | if (DEBUG) Log.d(TAG, "getEsimSupported is false")
95 | return
96 | }
97 |
98 | miRilJarLoader = miRilJarLoader ?: runCatching {
99 | DexClassLoader(
100 | MIRILHOOK_JAR_PATH,
101 | context.getDir("jar", 0).absolutePath,
102 | null,
103 | context.classLoader
104 | )
105 | }.onFailure { e ->
106 | if (DEBUG) Log.d(TAG, "Failed to initialize miRilJarLoader: $e")
107 | }.getOrNull()
108 |
109 | miRilHookClass = miRilHookClass ?: runCatching {
110 | miRilJarLoader?.loadClass(MIRILHOOK_CLASS_NAME)
111 | }.onFailure { e ->
112 | if (DEBUG) Log.d(TAG, "Failed to load miRilHookClass: $e")
113 | }.getOrNull()
114 |
115 | qcRilJarLoader = qcRilJarLoader ?: runCatching {
116 | DexClassLoader(
117 | QCRILHOOK_JAR_PATH,
118 | context.getDir("jar", 0).absolutePath,
119 | null,
120 | context.classLoader
121 | )
122 | }.onFailure { e ->
123 | if (DEBUG) Log.d(TAG, "Failed to initialize qcRilJarLoader: $e")
124 | }.getOrNull()
125 |
126 | qcRilHookCallbackClass = qcRilHookCallbackClass ?: runCatching {
127 | qcRilJarLoader?.loadClass(QCRILHOOKCALLBACK_CLASS_NAME)
128 | }.onFailure { e ->
129 | if (DEBUG) Log.d(TAG, "Failed to load qcRilHookCallbackClass: $e")
130 | }.getOrNull()
131 |
132 | qcRilHookCallbackObj = qcRilHookCallbackObj ?: runCatching {
133 | Proxy.newProxyInstance(
134 | context.classLoader,
135 | arrayOf(qcRilHookCallbackClass),
136 | QcRilHookCbMethodProxy()
137 | )
138 | }.onFailure { e ->
139 | if (DEBUG) Log.d(TAG, "Failed to initialize qcRilHookCallbackObj: $e")
140 | }.getOrNull()
141 |
142 | miRilHookObj = miRilHookObj ?: miRilHookClass?.getConstructor(
143 | Context::class.java,
144 | qcRilHookCallbackClass,
145 | String::class.java
146 | )?.let { constructor ->
147 | runCatching {
148 | constructor.newInstance(
149 | context,
150 | qcRilHookCallbackObj,
151 | ActivityThread.currentPackageName()
152 | )
153 | }.onFailure { e ->
154 | if (DEBUG) Log.d(TAG, "Failed to initialize miRilHookObj: $e")
155 | }.getOrNull()
156 | }
157 | }
158 |
159 | private fun callMiRilHookMethod(methodName: String, defObj: Any?, vararg args: Any?): Any? {
160 | return try {
161 | val parameterTypes = args.map { it?.javaClass?.kotlin?.javaPrimitiveType ?: it?.javaClass }.toTypedArray()
162 | miRilHookClass?.getMethod(methodName, *parameterTypes)?.invoke(miRilHookObj, *args)
163 | } catch (e: Exception) {
164 | if (DEBUG) Log.d(TAG, "callMiRilHookMethod failed: $methodName, error: $e")
165 | defObj
166 | }
167 | }
168 |
169 | private fun updateEuicc() {
170 | context.packageManager?.setApplicationEnabledSetting(
171 | "com.google.android.euicc",
172 | if (getEsimEnabled()) PackageManager.COMPONENT_ENABLED_STATE_ENABLED
173 | else PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
174 | 0
175 | )
176 | }
177 |
178 | fun dispose() {
179 | if (DEBUG) Log.d(TAG, "dispose")
180 | try {
181 | miRilHookClass?.getMethod("dispose")?.invoke(miRilHookObj)
182 | } catch (e: Exception) {
183 | if (DEBUG) Log.d(TAG, "dispose method failed, error: $e")
184 | }
185 | }
186 |
187 | inner class QcRilHookCbMethodProxy : InvocationHandler {
188 | override fun invoke(proxy: Any, method: Method, args: Array?): Any? {
189 | val methodName = method.name
190 | if (DEBUG) Log.d(TAG, "QcRilHookCbMethodProxy callbackMethod name: $methodName")
191 | when (methodName) {
192 | "onQcRilHookReady" -> updateEuicc()
193 | }
194 | return null
195 | }
196 | }
197 | }
198 |
--------------------------------------------------------------------------------
/init/fstab.qcom:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
2 | #
3 | # Redistribution and use in source and binary forms, with or without
4 | # modification, are permitted (subject to the limitations in the
5 | # disclaimer below) provided that the following conditions are met:
6 | #
7 | # * Redistributions of source code must retain the above copyright
8 | # notice, this list of conditions and the following disclaimer.
9 | #
10 | # * Redistributions in binary form must reproduce the above
11 | # copyright notice, this list of conditions and the following
12 | # disclaimer in the documentation and/or other materials provided
13 | # with the distribution.
14 | #
15 | # * Neither the name of The Linux Foundation nor the names of its
16 | # contributors may be used to endorse or promote products derived
17 | # from this software without specific prior written permission.
18 | #
19 | # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
20 | # GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
21 | # HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
22 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 | # Android fstab file.
34 | # The filesystem that contains the filesystem checker binary (typically /system) cannot
35 | # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
36 |
37 | #
38 | system /system erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey:/avb/t-gsi.avbpubkey
39 | system /system ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey:/avb/t-gsi.avbpubkey
40 | system_ext /system_ext erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
41 | system_ext /system_ext ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
42 | product /product erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
43 | product /product ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
44 | vendor /vendor erofs ro wait,slotselect,avb=vbmeta,logical,first_stage_mount
45 | vendor /vendor ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta,logical,first_stage_mount
46 | vendor_dlkm /vendor_dlkm erofs ro wait,slotselect,avb=vbmeta,logical,first_stage_mount
47 | vendor_dlkm /vendor_dlkm ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta,logical,first_stage_mount
48 | system_dlkm /system_dlkm erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
49 | system_dlkm /system_dlkm ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount
50 | odm /odm erofs ro wait,slotselect,avb=vbmeta,logical,first_stage_mount
51 | odm /odm ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta,logical,first_stage_mount
52 | overlay /vendor/etc/camera overlay ro,lowerdir=/odm/etc/camera/:/vendor/etc/camera check,nofail
53 | #overlay /vendor/lib/rfsa/adsp overlay ro,lowerdir=/odm/mount/camera/lib/rfsa/adsp/:/vendor/lib/rfsa/adsp check,nofail
54 | /dev/block/by-name/boot /boot emmc defaults slotselect,avb=vbmeta,first_stage_mount
55 | /dev/block/by-name/init_boot /init_boot emmc defaults slotselect,avb=vbmeta,first_stage_mount
56 | /dev/block/by-name/vendor_boot /vendor_boot emmc defaults slotselect,avb=vbmeta,first_stage_mount
57 | /dev/block/by-name/dtbo /dtbo emmc defaults slotselect,avb=vbmeta,first_stage_mount
58 | /dev/block/by-name/recovery /recovery emmc defaults slotselect,avb=vbmeta,first_stage_mount
59 | /dev/block/by-name/metadata /metadata f2fs noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount
60 | /dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,barrier=1 wait
61 | /dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,metadata_encryption=aes-256-xts:wrappedkey_v0,quota,reservedsize=128M,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc,checkpoint=fs
62 | /dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
63 | /devices/platform/soc/8804000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
64 | /devices/platform/soc/*.ssusb/*.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto
65 | /dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect
66 | /dev/block/bootdevice/by-name/dsp /vendor/dsp ext4 ro,nosuid,nodev,barrier=1 wait,slotselect
67 | /dev/block/bootdevice/by-name/vm-persist /mnt/product/vm-persist ext4 noatime,nosuid,nodev,barrier=1 wait
68 | /dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect
69 | /dev/block/bootdevice/by-name/qmcs /mnt/vendor/qmcs vfat noatime,nosuid,nodev,context=u:object_r:vendor_qmcs_file:s0 wait,check,formattable
70 |
--------------------------------------------------------------------------------
/extract-files.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3
2 | #
3 | # SPDX-FileCopyrightText: 2024 The LineageOS Project
4 | # SPDX-License-Identifier: Apache-2.0
5 | #
6 |
7 | from extract_utils.fixups_blob import (
8 | blob_fixup,
9 | blob_fixups_user_type,
10 | )
11 | from extract_utils.fixups_lib import (
12 | lib_fixup_remove,
13 | lib_fixups,
14 | lib_fixups_user_type,
15 | )
16 | from extract_utils.main import (
17 | ExtractUtils,
18 | ExtractUtilsModule,
19 | )
20 |
21 | namespace_imports = [
22 | 'vendor/qcom/common/system/telephony',
23 | 'vendor/qcom/common/vendor/adreno-t',
24 | 'vendor/qcom/common/vendor/display/5.15',
25 | ]
26 |
27 | def lib_fixup_odm_suffix(lib: str, partition: str, *args, **kwargs):
28 | return f'{lib}_odm' if partition in ('odm', 'vendor') else None
29 |
30 | def lib_fixup_sm8550_suffix(lib: str, partition: str, *args, **kwargs):
31 | return f'{lib}_sm8550' if partition in ('odm', 'vendor') else None
32 |
33 | def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
34 | return f'{lib}_vendor' if partition in ('odm', 'vendor') else None
35 |
36 | lib_fixups: lib_fixups_user_type = {
37 | **lib_fixups,
38 | (
39 | 'vendor.xiaomi.hardware.fx.tunnel@1.0',
40 | 'vendor.xiaomi.hardware.mfidoca@1.0',
41 | 'vendor.xiaomi.hardware.mlipay@1.0',
42 | 'vendor.xiaomi.hardware.mlipay@1.1',
43 | 'vendor.xiaomi.hardware.mtdservice@1.0',
44 | 'vendor.xiaomi.hardware.mtdservice@1.1',
45 | 'vendor.xiaomi.hardware.mtdservice@1.2',
46 | 'vendor.xiaomi.hardware.mtdservice@1.3',
47 | 'vendor.xiaomi.hardware.tidaservice@1.0',
48 | 'vendor.xiaomi.hardware.tidaservice@1.1',
49 | 'vendor.xiaomi.hardware.tidaservice@1.2',
50 | ): lib_fixup_odm_suffix,
51 | (
52 | 'audio.primary.kalama',
53 | 'libsdm-color',
54 | 'libsdm-disp-vndapis',
55 | 'libsdmextension',
56 | ): lib_fixup_sm8550_suffix,
57 | (
58 | 'com.qualcomm.qti.dpm.api@1.0',
59 | 'com.qualcomm.qti.imscmservice@1.0',
60 | 'com.qualcomm.qti.imscmservice@2.0',
61 | 'com.qualcomm.qti.imscmservice@2.1',
62 | 'com.qualcomm.qti.imscmservice@2.2',
63 | 'com.qualcomm.qti.uceservice@2.0',
64 | 'com.qualcomm.qti.uceservice@2.1',
65 | 'com.qualcomm.qti.uceservice@2.2',
66 | 'com.qualcomm.qti.uceservice@2.3',
67 | 'vendor.qti.data.factory@2.0',
68 | 'vendor.qti.data.factory@2.1',
69 | 'vendor.qti.data.factory@2.2',
70 | 'vendor.qti.data.factory@2.3',
71 | 'vendor.qti.data.factory@2.4',
72 | 'vendor.qti.data.factory@2.5',
73 | 'vendor.qti.data.factory@2.6',
74 | 'vendor.qti.data.factory@2.7',
75 | 'vendor.qti.data.mwqem@1.0',
76 | 'vendor.qti.data.slm@1.0',
77 | 'vendor.qti.diaghal@1.0',
78 | 'vendor.qti.hardware.data.cne.internal.api@1.0',
79 | 'vendor.qti.hardware.data.cne.internal.constants@1.0',
80 | 'vendor.qti.hardware.data.cne.internal.server@1.0',
81 | 'vendor.qti.hardware.data.cne.internal.server@1.1',
82 | 'vendor.qti.hardware.data.cne.internal.server@1.2',
83 | 'vendor.qti.hardware.data.cne.internal.server@1.3',
84 | 'vendor.qti.hardware.data.connection@1.0',
85 | 'vendor.qti.hardware.data.connection@1.1',
86 | 'vendor.qti.hardware.data.connectionfactory-V1-ndk',
87 | 'vendor.qti.hardware.data.dataactivity-V1-ndk',
88 | 'vendor.qti.hardware.data.dynamicdds@1.0',
89 | 'vendor.qti.hardware.data.dynamicdds@1.1',
90 | 'vendor.qti.hardware.data.flow@1.0',
91 | 'vendor.qti.hardware.data.flow@1.1',
92 | 'vendor.qti.hardware.data.iwlan@1.0',
93 | 'vendor.qti.hardware.data.iwlan@1.1',
94 | 'vendor.qti.hardware.data.ka-V1-ndk',
95 | 'vendor.qti.hardware.data.latency@1.0',
96 | 'vendor.qti.hardware.data.lce@1.0',
97 | 'vendor.qti.hardware.data.qmi@1.0',
98 | 'vendor.qti.hardware.dpmservice@1.0',
99 | 'vendor.qti.hardware.dpmservice@1.1',
100 | 'vendor.qti.hardware.embmssl@1.0',
101 | 'vendor.qti.hardware.embmssl@1.1',
102 | 'vendor.qti.hardware.limits@1.0',
103 | 'vendor.qti.hardware.limits@1.1',
104 | 'vendor.qti.hardware.limits@1.2',
105 | 'vendor.qti.hardware.ListenSoundModel@1.0',
106 | 'vendor.qti.hardware.mwqemadapter@1.0',
107 | 'vendor.qti.hardware.qccsyshal@1.0',
108 | 'vendor.qti.hardware.qccsyshal@1.1',
109 | 'vendor.qti.hardware.qccsyshal@1.2',
110 | 'vendor.qti.hardware.qccvndhal@1.0',
111 | 'vendor.qti.hardware.qxr-V1-ndk',
112 | 'vendor.qti.hardware.radio.am-V1-ndk',
113 | 'vendor.qti.hardware.radio.am@1.0',
114 | 'vendor.qti.hardware.radio.atcmdfwd-V1-ndk',
115 | 'vendor.qti.hardware.radio.atcmdfwd@1.0',
116 | 'vendor.qti.hardware.radio.ims-V9-ndk',
117 | 'vendor.qti.hardware.radio.ims@1.0',
118 | 'vendor.qti.hardware.radio.ims@1.1',
119 | 'vendor.qti.hardware.radio.ims@1.2',
120 | 'vendor.qti.hardware.radio.ims@1.3',
121 | 'vendor.qti.hardware.radio.ims@1.4',
122 | 'vendor.qti.hardware.radio.ims@1.5',
123 | 'vendor.qti.hardware.radio.ims@1.6',
124 | 'vendor.qti.hardware.radio.ims@1.7',
125 | 'vendor.qti.hardware.radio.ims@1.8',
126 | 'vendor.qti.hardware.radio.internal.deviceinfo-V1-ndk',
127 | 'vendor.qti.hardware.radio.internal.deviceinfo@1.0',
128 | 'vendor.qti.hardware.radio.lpa@1.0',
129 | 'vendor.qti.hardware.radio.lpa@1.1',
130 | 'vendor.qti.hardware.radio.lpa@1.2',
131 | 'vendor.qti.hardware.radio.lpa@1.3',
132 | 'vendor.qti.hardware.radio.qcrilhook-V1-ndk',
133 | 'vendor.qti.hardware.radio.qcrilhook@1.0',
134 | 'vendor.qti.hardware.radio.qtiradio-V9-ndk',
135 | 'vendor.qti.hardware.radio.qtiradio@1.0',
136 | 'vendor.qti.hardware.radio.qtiradio@2.0',
137 | 'vendor.qti.hardware.radio.qtiradio@2.1',
138 | 'vendor.qti.hardware.radio.qtiradio@2.2',
139 | 'vendor.qti.hardware.radio.qtiradio@2.3',
140 | 'vendor.qti.hardware.radio.qtiradio@2.4',
141 | 'vendor.qti.hardware.radio.qtiradio@2.5',
142 | 'vendor.qti.hardware.radio.qtiradio@2.6',
143 | 'vendor.qti.hardware.radio.qtiradioconfig-V3-ndk',
144 | 'vendor.qti.hardware.radio.uim@1.0',
145 | 'vendor.qti.hardware.radio.uim@1.1',
146 | 'vendor.qti.hardware.radio.uim@1.2',
147 | 'vendor.qti.hardware.radio.uim_remote_client@1.0',
148 | 'vendor.qti.hardware.radio.uim_remote_client@1.1',
149 | 'vendor.qti.hardware.radio.uim_remote_client@1.2',
150 | 'vendor.qti.hardware.radio.uim_remote_server@1.0',
151 | 'vendor.qti.hardware.sigma_miracast@1.0',
152 | 'vendor.qti.hardware.slmadapter@1.0',
153 | 'vendor.qti.hardware.wifidisplaysession@1.0',
154 | 'vendor.qti.ims.callcapability@1.0',
155 | 'vendor.qti.ims.callinfo@1.0',
156 | 'vendor.qti.ims.configservice@1.0',
157 | 'vendor.qti.ims.configservice@1.1',
158 | 'vendor.qti.ims.connection@1.0',
159 | 'vendor.qti.ims.factory@1.0',
160 | 'vendor.qti.ims.factory@1.1',
161 | 'vendor.qti.ims.factory@2.0',
162 | 'vendor.qti.ims.factory@2.1',
163 | 'vendor.qti.ims.factory@2.2',
164 | 'vendor.qti.ims.rcsconfig@1.0',
165 | 'vendor.qti.ims.rcsconfig@1.1',
166 | 'vendor.qti.ims.rcsconfig@2.0',
167 | 'vendor.qti.ims.rcsconfig@2.1',
168 | 'vendor.qti.ims.rcssip@1.0',
169 | 'vendor.qti.ims.rcssip@1.1',
170 | 'vendor.qti.ims.rcssip@1.2',
171 | 'vendor.qti.ims.rcsuce@1.0',
172 | 'vendor.qti.ims.rcsuce@1.1',
173 | 'vendor.qti.ims.rcsuce@1.2',
174 | 'vendor.qti.imsrtpservice@3.0',
175 | 'vendor.qti.imsrtpservice@3.1',
176 | 'vendor.qti.latency@2.0',
177 | 'vendor.qti.latency@2.1',
178 | 'vendor.qti.latency@2.2',
179 | 'vendor.qti.latency@2.3',
180 | 'vendor.xiaomi.hardware.displayfeature@1.0',
181 | 'vendor.xiaomi.hardware.fingerprintextension@1.0',
182 | ): lib_fixup_vendor_suffix,
183 | (
184 | 'libcamxcommonutils',
185 | 'libwpa_client',
186 | ): lib_fixup_remove,
187 | }
188 |
189 | blob_fixups: blob_fixups_user_type = {
190 | (
191 | 'odm/lib64/hw/displayfeature.default.so',
192 | 'vendor/lib64/hw/audio.primary.kalama.so',
193 | ): blob_fixup()
194 | .replace_needed(
195 | 'libstagefright_foundation.so',
196 | 'libstagefright_foundation-v33.so',
197 | ),
198 | 'odm/lib64/libmt@1.3.so': blob_fixup()
199 | .replace_needed(
200 | 'libcrypto.so',
201 | 'libcrypto-v33.so',
202 | ),
203 | 'system_ext/framework/mirilhook.jar': blob_fixup()
204 | .apktool_patch('blob-patches/mirilhook.patch', '-r'),
205 | 'vendor/bin/modemManager' : blob_fixup()
206 | .binary_regex_replace(b'fbec992f7f41a65ac8000aeda1bc634e24a12c7513faae379ae889a53553325a', b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') # /vendor/lib/libqesdk2_0.so
207 | .binary_regex_replace(b'40821d2c697710a692462776324a4b913935878b3b5f2232a2cd297a6f3ff37f', b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'), # /vendor/lib/libqesdk_manager.so
208 | (
209 | 'vendor/bin/hw/android.hardware.security.keymint-service-qti',
210 | 'vendor/lib64/libqtikeymint.so',
211 | ): blob_fixup()
212 | .add_needed('android.hardware.security.rkp-V3-ndk.so'),
213 | 'vendor/etc/seccomp_policy/c2audio.vendor.ext-arm64.policy': blob_fixup()
214 | .add_line_if_missing('setsockopt: 1'),
215 | 'vendor/etc/seccomp_policy/qwesd@2.0.policy': blob_fixup()
216 | .add_line_if_missing('pipe2: 1'),
217 | 'vendor/lib64/c2.dolby.client.so': blob_fixup()
218 | .add_needed('libcodec2_hidl_shim.so'),
219 | 'vendor/lib64/libsnpe_config.so': blob_fixup()
220 | .add_needed('liblog.so'),
221 | 'vendor/lib64/vendor.libdpmframework.so': blob_fixup()
222 | .add_needed('libhidlbase_shim.so'),
223 | } # fmt: skip
224 |
225 | module = ExtractUtilsModule(
226 | 'sm8550-common',
227 | 'xiaomi',
228 | blob_fixups=blob_fixups,
229 | lib_fixups=lib_fixups,
230 | namespace_imports=namespace_imports,
231 | )
232 |
233 | if __name__ == '__main__':
234 | utils = ExtractUtils.device(module)
235 | utils.run()
236 |
--------------------------------------------------------------------------------
/common.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2023-2024 Paranoid Android
3 | #
4 | # SPDX-License-Identifier: Apache-2.0
5 | #
6 |
7 | # Configure updatable_apex.mk
8 | $(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
9 |
10 | # Enable project quotas and casefolding for emulated storage without sdcardfs
11 | $(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
12 |
13 | # Setup dalvik vm configs
14 | $(call inherit-product, frameworks/native/build/phone-xhdpi-6144-dalvik-heap.mk)
15 |
16 | # Get non-open-source specific aspects
17 | $(call inherit-product, vendor/xiaomi/sm8550-common/sm8550-common-vendor.mk)
18 |
19 | # Soong namespaces
20 | PRODUCT_SOONG_NAMESPACES += \
21 | $(LOCAL_PATH) \
22 | hardware/xiaomi
23 |
24 | # AAPT
25 | PRODUCT_AAPT_CONFIG := normal
26 | PRODUCT_AAPT_PREF_CONFIG := xxhdpi
27 |
28 | # A/B
29 | ENABLE_AB := true
30 | ENABLE_VIRTUAL_AB := true
31 |
32 | $(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk)
33 | $(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/android_t_baseline.mk)
34 |
35 | PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD := gz
36 |
37 | AB_OTA_POSTINSTALL_CONFIG += \
38 | RUN_POSTINSTALL_system=true \
39 | POSTINSTALL_PATH_system=system/bin/otapreopt_script \
40 | FILESYSTEM_TYPE_system=erofs \
41 | POSTINSTALL_OPTIONAL_system=true
42 |
43 | AB_OTA_POSTINSTALL_CONFIG += \
44 | RUN_POSTINSTALL_vendor=true \
45 | POSTINSTALL_PATH_vendor=bin/checkpoint_gc \
46 | FILESYSTEM_TYPE_vendor=erofs \
47 | POSTINSTALL_OPTIONAL_vendor=true
48 |
49 | PRODUCT_PACKAGES += \
50 | checkpoint_gc \
51 | otapreopt_script
52 |
53 | # Board
54 | TARGET_BOARD_PLATFORM := kalama
55 |
56 | # Partitions
57 | PRODUCT_USE_DYNAMIC_PARTITIONS := true
58 |
59 | # QTI components
60 | TARGET_COMMON_QTI_COMPONENTS := \
61 | adreno \
62 | alarm \
63 | audio \
64 | av \
65 | bt \
66 | display \
67 | gps \
68 | init \
69 | overlay \
70 | perf \
71 | telephony \
72 | usb \
73 | wfd \
74 | wlan
75 |
76 | TARGET_USE_AIDL_QTI_BT_AUDIO := true
77 | TARGET_USE_AIDL_QTI_HEALTH := true
78 |
79 | # Shipping API level
80 | BOARD_SHIPPING_API_LEVEL := 33
81 | PRODUCT_SHIPPING_API_LEVEL := 33
82 |
83 | # Atrace
84 | PRODUCT_PACKAGES += \
85 | android.hardware.atrace@1.0-service
86 |
87 | # Audio
88 | PRODUCT_COPY_FILES += \
89 | $(LOCAL_PATH)/configs/audio/audio_policy_configuration.xml:$(TARGET_COPY_OUT_ODM)/etc/audio_policy_configuration.xml
90 |
91 | # Boot Control
92 | PRODUCT_PACKAGES += \
93 | android.hardware.boot@1.2-impl-qti \
94 | android.hardware.boot@1.2-impl-qti.recovery \
95 | android.hardware.boot@1.2-service
96 |
97 | # Camera
98 | $(call inherit-product-if-exists, vendor/xiaomi/camera/miuicamera.mk)
99 |
100 | PRODUCT_COPY_FILES += \
101 | frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \
102 | frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
103 | frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
104 | frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
105 | frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml
106 |
107 | # Characteristics
108 | PRODUCT_CHARACTERISTICS := nosdcard
109 |
110 | # Consumer IR
111 | PRODUCT_PACKAGES += \
112 | android.hardware.ir-service.xiaomi
113 |
114 | PRODUCT_COPY_FILES += \
115 | frameworks/native/data/etc/android.hardware.consumerir.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.consumerir.xml
116 |
117 | # Display
118 | TARGET_PANEL_DIMENSION_HAS_EXTRA_PRECISION := true
119 | TARGET_USE_YCRCB_CAMERA_ENCODE := true
120 |
121 | # DLKM
122 | TARGET_KERNEL_DLKM_DISABLE := false
123 | TARGET_KERNEL_DLKM_AUDIO_OVERRIDE := true
124 | TARGET_KERNEL_DLKM_BT_OVERRIDE := true
125 | TARGET_KERNEL_DLKM_CAMERA_OVERRIDE := true
126 | TARGET_KERNEL_DLKM_NFC_OVERRIDE := true
127 | TARGET_KERNEL_DLKM_DATA_OVERRIDE := true
128 | TARGET_KERNEL_DLKM_DISPLAY_OVERRIDE := true
129 | TARGET_KERNEL_DLKM_MM_DRV_OVERRIDE := true
130 | TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE := true
131 | TARGET_KERNEL_DLKM_THERMAL_OVERRIDE := true
132 | TARGET_KERNEL_DLKM_TOUCH_OVERRIDE := true
133 | TARGET_KERNEL_DLKM_VIDEO_OVERRIDE := true
134 | TARGET_KERNEL_DLKM_WLAN_OVERRIDE := true
135 | TARGET_KERNEL_DLKM_MMRM_OVERRIDE := true
136 |
137 | # Dolby
138 | PRODUCT_PACKAGES += \
139 | XiaomiDolby
140 |
141 | # DRM
142 | PRODUCT_PACKAGES += \
143 | android.hardware.drm-service.clearkey
144 |
145 | # Fastbootd
146 | PRODUCT_PACKAGES += \
147 | fastbootd
148 |
149 | # Fingerprint
150 | PRODUCT_PACKAGES += \
151 | android.hardware.biometrics.fingerprint-service.xiaomi \
152 | libudfpshandler
153 |
154 | PRODUCT_COPY_FILES += \
155 | frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
156 |
157 | # Health
158 | PRODUCT_PACKAGES += \
159 | android.hardware.health-service.qti \
160 | android.hardware.health-service.qti_recovery
161 |
162 | # Hotword Enrollement
163 | PRODUCT_COPY_FILES += \
164 | $(LOCAL_PATH)/configs/permissions/privapp-permissions-hotword.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-hotword.xml
165 |
166 | # Init
167 | PRODUCT_PACKAGES += \
168 | fstab.qcom \
169 | init.target.rc \
170 | init.mi_perf.rc \
171 | init.mi_service.rc \
172 | init.mi_udfps.rc \
173 | ueventd.xiaomi.rc
174 |
175 | PRODUCT_COPY_FILES += \
176 | $(LOCAL_PATH)/init/fstab.qcom:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/first_stage_ramdisk/fstab.qcom
177 |
178 | # Keymint
179 | PRODUCT_PACKAGES += \
180 | android.hardware.hardware_keystore.xml
181 |
182 | PRODUCT_COPY_FILES += \
183 | frameworks/native/data/etc/android.hardware.keystore.app_attest_key.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.keystore.app_attest_key.xml \
184 | frameworks/native/data/etc/android.software.device_id_attestation.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.device_id_attestation.xml
185 |
186 | # Lineage Health
187 | PRODUCT_PACKAGES += \
188 | vendor.lineage.health-service.default
189 |
190 | # Logging
191 | SPAMMY_LOG_TAGS := \
192 | MiStcImpl \
193 | SDM \
194 | SDM-histogram \
195 | SRE \
196 | WifiHAL \
197 | cnss-daemon \
198 | libcitsensorservice@2.0-impl \
199 | libsensor-displayalgo \
200 | libsensor-parseRGB \
201 | libsensor-ssccalapi \
202 | sensors \
203 | vendor.qti.hardware.display.composer-service \
204 | vendor.xiaomi.sensor.citsensorservice@2.0-service
205 |
206 | ifneq ($(TARGET_BUILD_VARIANT),eng)
207 | PRODUCT_VENDOR_PROPERTIES += \
208 | $(foreach tag,$(SPAMMY_LOG_TAGS),log.tag.$(tag)=E)
209 | endif
210 |
211 | # Media
212 | PRODUCT_COPY_FILES += \
213 | frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
214 | frameworks/av/media/libstagefright/data/media_codecs_google_c2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2.xml \
215 | frameworks/av/media/libstagefright/data/media_codecs_google_c2_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_audio.xml \
216 | frameworks/av/media/libstagefright/data/media_codecs_google_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_video.xml \
217 | frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
218 | frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
219 | frameworks/av/media/libstagefright/data/media_codecs_google_video_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video_le.xml
220 |
221 | # Mlipay
222 | PRODUCT_PACKAGES += \
223 | IFAAService
224 |
225 | # NFC
226 | $(call inherit-product, vendor/nxp/opensource/commonsys/packages/apps/Nfc/nfc_system_product.mk)
227 | $(call inherit-product, vendor/st/opensource/commonsys/packages/apps/Nfc/nfc_system_product.mk)
228 |
229 | PRODUCT_COPY_FILES += \
230 | frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.ese.xml \
231 | frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.hcef.xml \
232 | frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.hce.xml \
233 | frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.uicc.xml \
234 | frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.xml \
235 | frameworks/native/data/etc/android.hardware.se.omapi.ese.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.ese.xml \
236 | frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.uicc.xml \
237 | frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/com.android.nfc_extras.xml \
238 | frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/com.nxp.mifare.xml
239 |
240 | # ModemManager
241 | PRODUCT_PACKAGES += \
242 | libqesdk_manager_32bit_stub \
243 | libqesdk2_0_32bit_stub
244 |
245 | # Overlays
246 | PRODUCT_PACKAGES += \
247 | Xiaomi8550CarrierConfigRes \
248 | Xiaomi8550DeviceAsWebcamRes \
249 | Xiaomi8550EuiccGoogle \
250 | Xiaomi8550Frameworks \
251 | Xiaomi8550FrameworksAOSPA \
252 | Xiaomi8550FrameworksEuicc \
253 | Xiaomi8550Nfc \
254 | Xiaomi8550NfcST \
255 | Xiaomi8550SecureElement \
256 | Xiaomi8550Settings \
257 | Xiaomi8550SystemUI \
258 | Xiaomi8550SystemUIAOSPA \
259 | Xiaomi8550WifiRes \
260 | Xiaomi8550WifiResMainline \
261 |
262 | # Parts
263 | PRODUCT_PACKAGES += \
264 | XiaomiParts
265 |
266 | PRODUCT_BROKEN_VERIFY_USES_LIBRARIES := true
267 |
268 | # RenderScript
269 | PRODUCT_PACKAGES += \
270 | android.hardware.renderscript@1.0-impl
271 |
272 | # Powershare
273 | PRODUCT_PACKAGES += \
274 | vendor.aospa.powershare-service
275 |
276 | # Sensors
277 | PRODUCT_PACKAGES += \
278 | android.hardware.sensors-service.xiaomi-multihal \
279 | libsensorndkbridge \
280 | sensor-notifier \
281 | sensors.xiaomi
282 |
283 | PRODUCT_COPY_FILES += \
284 | $(LOCAL_PATH)/configs/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf
285 |
286 | PRODUCT_COPY_FILES += \
287 | frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
288 | frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.ambient_temperature.xml \
289 | frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
290 | frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
291 | frameworks/native/data/etc/android.hardware.sensor.hifi_sensors.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.hifi_sensors.xml \
292 | frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
293 | frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
294 | frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.relative_humidity.xml \
295 | frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepcounter.xml \
296 | frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepdetector.xml
297 |
298 | $(call soong_config_set, SENSORS_XIAOMI, USES_DOUBLE_TAP_SENSOR, true)
299 | $(call soong_config_set, SENSORS_XIAOMI, USES_SINGLE_TAP_SENSOR, true)
300 | $(call soong_config_set, SENSORS_XIAOMI, USES_UDFPS_SENSOR, true)
301 |
302 | # Telephony
303 | PRODUCT_COPY_FILES += \
304 | $(LOCAL_PATH)/configs/permissions/privapp-permissions-euiccgoogle.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-euiccgoogle.xml
305 |
306 | # Thermal
307 | PRODUCT_PACKAGES += \
308 | android.hardware.thermal-service.qti
309 |
310 | # Touchscreen
311 | PRODUCT_COPY_FILES += \
312 | frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml
313 |
314 | # Update Engine
315 | PRODUCT_PACKAGES += \
316 | update_engine \
317 | update_engine_sideload \
318 | update_verifier
319 |
320 | # USB
321 | PRODUCT_HAS_GADGET_HAL := true
322 |
323 | # Verified Boot
324 | PRODUCT_COPY_FILES += \
325 | frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml
326 |
327 | # Vibrator
328 | PRODUCT_PACKAGES += \
329 | vendor.qti.hardware.vibrator.service.xiaomi
330 |
331 | PRODUCT_COPY_FILES += \
332 | hardware/xiaomi/aidl/vibrator/excluded-input-devices.xml:$(TARGET_COPY_OUT_VENDOR)/etc/excluded-input-devices.xml
333 |
334 | $(call soong_config_set, XIAOMI_VIBRATOR, USE_EFFECT_STREAM, true)
335 |
336 | # VNDK
337 | PRODUCT_COPY_FILES += \
338 | prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libcrypto.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libcrypto-v33.so \
339 | prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefright_foundation-v33.so
340 |
341 | # WiFi
342 | PRODUCT_PACKAGES += \
343 | firmware_WCNSS_qcom_cfg.ini_symlink \
344 | firmware_wlan_mac.bin_symlink \
345 | firmware_wlanmdsp.otaupdate_symlink
346 |
347 | PRODUCT_COPY_FILES += \
348 | frameworks/native/data/etc/android.hardware.wifi.aware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.aware.xml \
349 | frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \
350 | frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \
351 | frameworks/native/data/etc/android.hardware.wifi.rtt.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.rtt.xml \
352 | frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \
353 | frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml
354 |
--------------------------------------------------------------------------------
/configs/vintf/manifest_kalama.xml:
--------------------------------------------------------------------------------
1 |
64 |
65 |
66 |
67 | vendor.qti.hardware.capabilityconfigstore
68 | hwbinder
69 | 1.0
70 |
71 | ICapabilityConfigStore
72 | default
73 |
74 |
75 |
76 | android.hardware.audio
77 | hwbinder
78 | 7.1
79 |
80 | IDevicesFactory
81 | default
82 |
83 |
84 |
85 | android.hardware.audio.effect
86 | hwbinder
87 | 7.0
88 |
89 | IEffectsFactory
90 | default
91 |
92 |
93 |
109 |
110 |
111 | vendor.qti.hardware.dsp
112 | hwbinder
113 | 1.0
114 |
115 | IDspService
116 | dspservice
117 |
118 |
119 |
120 | android.hardware.gatekeeper
121 | hwbinder
122 |
123 | 1.0
124 |
125 | IGatekeeper
126 | default
127 |
128 |
129 |
130 |
141 |
152 |
153 |
166 |
167 |
178 |
179 |
180 | vendor.qti.hardware.qseecom
181 | hwbinder
182 | 1.0
183 |
184 | IQSEECom
185 | default
186 |
187 |
188 |
189 |
190 | vendor.qti.hardware.sensorscalibrate
191 | hwbinder
192 | 1.0
193 |
194 | ISensorsCalibrate
195 | default
196 |
197 |
198 |
199 |
207 |
208 |
209 | com.qualcomm.qti.dpm.api
210 | hwbinder
211 | 1.0
212 |
213 | IdpmQmi
214 | dpmQmiService
215 |
216 |
217 |
218 |
219 |
231 |
232 |
233 |
245 |
246 |
247 |
259 |
260 |
261 |
273 |
274 |
275 |
286 |
287 |
288 |
289 | vendor.qti.imsrtpservice
290 | hwbinder
291 | 3.1
292 |
293 | IRTPService
294 | imsrtpservice
295 |
296 |
297 |
298 |
299 | com.qualcomm.qti.uceservice
300 | hwbinder
301 | 2.3
302 |
303 | IUceService
304 | com.qualcomm.qti.uceservice
305 |
306 |
307 |
308 |
309 | vendor.qti.ims.callinfo
310 | hwbinder
311 | 1.0
312 |
313 | IService
314 | default
315 |
316 |
317 |
318 |
319 | com.qualcomm.qti.imscmservice
320 | hwbinder
321 | 2.2
322 |
323 | IImsCmService
324 | qti.ims.connectionmanagerservice
325 |
326 |
327 |
328 | vendor.qti.ims.factory
329 | hwbinder
330 | 1.1
331 | 2.2
332 |
333 | IImsFactory
334 | default
335 |
336 |
337 |
338 | vendor.qti.data.factory
339 | hwbinder
340 | 2.7
341 |
342 | IFactory
343 | default
344 |
345 |
346 |
347 |
358 |
359 |
370 |
382 |
383 |
384 | vendor.qti.hardware.data.latency
385 | hwbinder
386 | 1.0
387 |
388 | ILinkLatency
389 | default
390 |
391 |
392 |
404 |
405 | vendor.qti.hardware.cacert
406 | hwbinder
407 | 1.0
408 |
409 | IService
410 | default
411 |
412 |
413 |
414 |
415 | vendor.qti.hardware.factory
416 | hwbinder
417 | 1.1
418 |
419 | IFactory
420 | default
421 |
422 |
423 |
424 |
435 |
436 |
437 | vendor.qti.hardware.secureprocessor.device
438 | hwbinder
439 | 1.0
440 |
441 | ISecureProcessor
442 | qti-tee
443 |
444 |
445 |
446 |
447 | android.hardware.bluetooth
448 | hwbinder
449 | 1.1
450 |
451 | IBluetoothHci
452 | default
453 |
454 |
455 |
456 | vendor.qti.hardware.bluetooth_audio
457 | hwbinder
458 | 2.1
459 |
460 | IBluetoothAudioProvidersFactory
461 | default
462 |
463 |
464 |
465 | vendor.qti.hardware.btconfigstore
466 | hwbinder
467 | 2.0
468 |
469 | IBTConfigStore
470 | default
471 |
472 |
473 |
474 |
475 | vendor.qti.hardware.fm
476 | hwbinder
477 | 1.0
478 |
479 | IFmHci
480 | default
481 |
482 |
483 |
484 |
495 |
496 |
497 |
498 | vendor.qti.hardware.soter
499 | hwbinder
500 | 1.0
501 |
502 | ISoter
503 | default
504 |
505 |
506 |
507 |
518 |
519 |
520 |
531 |
532 |
533 | vendor.qti.hardware.trustedui
534 | hwbinder
535 | @1.2::ITrustedUI/default
536 | @1.2::ITrustedUI/qtee-vm
537 | @1.1::ITrustedInput/default
538 | @1.1::ITrustedInput/qtee-vm
539 |
540 |
541 |
542 | vendor.qti.hardware.bluetooth_sar
543 | hwbinder
544 | 1.1
545 |
546 | IBluetoothSar
547 | default
548 |
549 |
550 |
551 |
552 | vendor.qti.spu
553 | hwbinder
554 | 1.1
555 |
556 | ISPUManager
557 | default
558 |
559 |
560 |
561 | vendor.qti.spu
562 | hwbinder
563 | 2.0
564 |
565 | ISPUManager
566 | default
567 |
568 |
569 |
570 |
571 | vendor.qti.hardware.qccvndhal
572 | hwbinder
573 | 1.0
574 |
575 | IQccvndhal
576 | qccvndhal
577 |
578 |
579 |
580 |
581 | vendor.qti.hardware.embmssl
582 | hwbinder
583 | 1.1
584 |
585 | IEmbms
586 | embmsslServer0
587 |
588 |
589 |
590 |
591 | vendor.qti.hardware.dpmservice
592 | hwbinder
593 | 1.1
594 |
595 | IDpmService
596 | DpmService
597 |
598 |
599 |
600 |
601 | vendor.qti.qesdhal
602 | hwbinder
603 | 1.4
604 |
605 | IQesdhal
606 | default
607 |
608 |
609 |
610 |
611 | vendor.qti.hardware.mwqemadapter
612 | hwbinder
613 | 1.0
614 |
615 | IMwqemAdapter
616 | MwqemAdapter
617 |
618 |
619 |
620 |
--------------------------------------------------------------------------------