52 Commits
udc ... bka

Author SHA1 Message Date
flakeforever
fae0ca54a0 mondrian: Switch thermal HAL to AIDL 2025-07-14 01:15:16 -07:00
flakeforever
fc43d9bc69 mondrian: Remote Atrace HAL 2025-07-13 23:22:48 -07:00
Adithya R
96893a3c26 mondrian: Optimize native executables for Cortex-A510
Enable compiler optimizations for ARMv9 Cortex-A510 CPU.
Needs https://gerrit.aospa.co/q/topic:topaz-armv9

Change-Id: I98a9815c19c83b6897f21667b27af0723e8f74b0
2025-07-13 23:22:48 -07:00
Grace Chen
eb61b6a7ab mondrian: overlay: Config overlay to support 2 physical slots
Bug: 197989438
    Test: Confirm sim configuration.
    Change-Id: I3972e0456d8034517cc4224ef786a9292439a8b9
2025-07-13 23:22:48 -07:00
flakeforever
bb8a3c9aab mondrian: Switch camera config to select 2025-07-13 23:22:48 -07:00
Pzqqt
849f77538b mondrian: Update kernel build configuration 2025-07-13 23:22:48 -07:00
flakeforever
4ae2256a58 mondrian: Switch charging control supports bypass config to select 2025-07-13 23:22:48 -07:00
flakeforever
720790ba68 mondrian: Switch lineage touch HAL to AIDL 2025-07-13 23:22:48 -07:00
flakeforever
686c10d85e mondrian: Switch sensor HAL to AIDL 2025-07-13 23:22:48 -07:00
flakeforever
3bfc9d337a mondrian: Switch fingerprint HAL to AIDL 2025-07-13 23:22:48 -07:00
flakeforever
e25059c809 mondrian: Remove Protobuf 2025-07-13 23:22:48 -07:00
flakeforever
27b21a79d2 mondrian: Build boot HAL from config set 2025-07-13 23:22:48 -07:00
flakeforever
e44f572f39 mondrian: Build audio HAL from config set 2025-07-13 23:22:48 -07:00
flakeforever
18f89f274c mondrian: Update product shipping API level to 33 2025-07-13 23:22:48 -07:00
flakeforever
73c6ea1cdb mondrian: Update to OS2.0.9.0.VMNMIXM 2025-07-13 23:22:48 -07:00
flakeforever
374578804b mondrian: Switch powershare HAL to AIDL 2025-07-13 12:25:31 -07:00
flakeforever
2c70445347 mondrian: Update to OS2.0.8.0.VMNMIXM 2025-07-13 11:06:09 -07:00
flakeforever
2654aa9aa2 mondrian: Update to OS2.0.7.0.VMNMIXM 2025-04-14 20:17:52 -07:00
Cosmin Tanislav
8691679d0e mondrian: move vibrator effect stream config to select 2025-04-14 20:15:59 -07:00
flakeforever
032a6e1391 mondrian: Update to OS2.0.5.0.VMNMIXM 2025-04-12 01:00:49 -07:00
flakeforever
2a272f2341 mondrian: Update dependencies 2025-04-12 00:57:20 -07:00
flakeforever
7384e0043a mondrian: Remove NfcNci 2025-04-12 00:56:10 -07:00
flakeforever
d5e42e448a mondrian: bluetooth: Add LHDC support
Patch required:
https://github.com/flakeforever/device_xiaomi_mondrian-lhdc-patch.git

Include files required:
https://github.com/flakeforever/android_external_liblhdc.git

 * Import LHDC libraries from OS2.0.3.0.VMNMIXM
Please extract LHDC libraries from your device in stock ROM.
2025-03-09 14:15:34 +08:00
flakeforever
ced90487c7 mondrian: Build XiaomiDolby 2025-03-03 12:19:53 +08:00
flakeforever
26b4e4ccf3 mondrian: parts: Remove Dolby Atmos 2025-03-03 12:19:53 +08:00
flakeforever
3757e1eaa8 mondrian: Switch to python extract-utils 2025-03-03 12:19:53 +08:00
flakeforever
254329edc3 mondrian: sepolicy: Allow bluetooth to access data files 2025-03-03 12:19:53 +08:00
flakeforever
a912eb4cd4 mondrian: sepolicy: Label NFC HAL service 2025-02-16 12:13:01 +08:00
flakeforever
ebfa2aecaf mondrian: Update to OS2.0.3.0.VMNMIXM 2025-02-16 12:11:50 +08:00
flakeforever
11b8c2227c mondrian: overlay: Add FPS info support 2025-02-06 16:21:19 +08:00
flakeforever
bc91ffb7f9 mondrian: Update WiFi HAL configuration from HyperOS V816.0.14.0.UMNMIXM 2025-02-06 16:21:19 +08:00
codeworkx
77c0e85245 mondrian: wifi-display: Add WfdCommon to boot jars 2025-02-06 16:21:19 +08:00
Arian
571bb3c5ad mondrian: Update display, GPS and QCC blobs from ingot UKQ1.240227.165 2025-02-06 16:21:19 +08:00
Arian
6387640b4f mondrian: Update WiFi display configuration 2025-02-06 16:21:19 +08:00
flakeforever
cb0018be73 mondrian: Remove libqti_vndfwk_detect 2025-02-06 16:21:19 +08:00
flakeforever
223eebe95c mondrian: Include reserved size configuration 2025-01-28 23:07:41 +08:00
flakeforever
e82f3c95b8 mondrian: overlay: Enable PowerOffAlarmService 2025-01-17 12:58:43 +08:00
flakeforever
840fedd7d6 mondrian: overlay: Remove stable device display size 2025-01-17 12:57:32 +08:00
flakeforever
49b83792df mondrian: init: Add support for Indian device 2025-01-15 16:45:06 +08:00
flakeforever
129d20896e mondrian: sepolicy: Remove /sys/class/qcom-battery 2025-01-14 11:36:34 +08:00
flakeforever
54c24e2d93 mondrian: Remove unused bootinfo fingerprint 2025-01-13 08:53:37 +08:00
flakeforever
29d04bb52f mondrian: Update build fingerprint 2025-01-13 08:53:28 +08:00
flakeforever
6678a1528a mondrian: overlay: Change battery divider 2025-01-01 16:04:44 +08:00
flakeforever
97650b3e86 mondrian: Enable volume steps settings 2025-01-01 16:04:44 +08:00
flakeforever
8b1a81f6e0 mondrian: Update build fingerprint and vendor security patch 2025-01-01 16:04:44 +08:00
flakeforever
52f13577b7 mondrian: parts: Add FEAS 2.2 2024-12-08 21:25:39 +08:00
Beverly
b6f6c72e34 mondrian: overlay: Update pixel pitch
Bug: 319894241
Flag: ACONFIG com.android.systemui.device_entry_udfps_refactor DEVELOPMENT
Test: manual

Change-Id: Iaa9576cb95ebe73043b7030b2b176f67bc90e3a1
2024-12-08 21:25:39 +08:00
flakeforever
f34a05aeb5 mondrian: Update overlays for Android 15 2024-12-08 21:25:39 +08:00
flakeforever
846bde06df mondrian: Update media scripts from Android 15 2024-12-08 21:25:39 +08:00
HeCheng Yu
4713544557 mondrian: Update blob_fixup items for Android 15 2024-12-08 21:25:39 +08:00
flakeforever
a01025892e mondrian: Update USB HAL service for Android 15 2024-12-08 21:25:25 +08:00
flakeforever
46accba2d4 mondrian: Evolution-X 10.0 bringup 2024-11-24 01:37:28 +08:00
97 changed files with 1667 additions and 4256 deletions

View File

@@ -6,7 +6,6 @@
soong_namespace {
imports: [
"hardware/qcom-caf/bootctrl",
"hardware/xiaomi",
"vendor/qcom/opensource/commonsys-intf/display",
],

View File

@@ -33,18 +33,16 @@ AB_OTA_PARTITIONS += \
# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a-branchprot
TARGET_ARCH_VARIANT := armv9-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := generic
TARGET_CPU_VARIANT_RUNTIME := kryo300
TARGET_CPU_VARIANT := cortex-a510
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv8-2a
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic
TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a75
TARGET_2ND_CPU_VARIANT := cortex-a55
# Audio
AUDIO_FEATURE_ENABLED_DLKM := true
@@ -74,19 +72,22 @@ BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA2048
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 2
# Bluetooth
$(call soong_config_set, btservices, use_lhdc, true)
# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := taro
TARGET_NO_BOOTLOADER := true
# Camera
TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED := true
TARGET_CAMERA_PACKAGE_NAME := com.android.camera
$(call soong_config_set, camera, override_format_from_reserved, true)
$(call soong_config_set, camera,package_name, com.android.camera)
# DTB
TARGET_PREBUILT_DTB := $(KERNEL_PATH)/dtb
# TARGET_PREBUILT_DTB := $(KERNEL_PATH)/dtb
BOARD_PREBUILT_DTBIMAGE_DIR := $(KERNEL_PATH)/dtbs
PRODUCT_COPY_FILES += $(KERNEL_PATH)/dtb:dtb.img
PRODUCT_COPY_FILES += $(KERNEL_PATH)/dtb.img:dtb.img
TARGET_NEEDS_DTBOIMAGE := false
BOARD_PREBUILT_DTBOIMAGE := $(KERNEL_PATH)/dtbo.img
@@ -113,7 +114,7 @@ DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
DEVICE_FRAMEWORK_MANIFEST_FILE += $(DEVICE_PATH)/configs/vintf/framework_manifest.xml
# Init
TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):init_xiaomi_mondrian
$(call soong_config_set, libinit, vendor_init_lib, //$(DEVICE_PATH):init_xiaomi_mondrian)
TARGET_RECOVERY_DEVICE_MODULES ?= init_xiaomi_mondrian
# GPS
@@ -123,12 +124,15 @@ $(call soong_config_set, qtilocation, feature_nhz, false)
# Kernel
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
BOARD_RAMDISK_USE_LZ4 := true
BOARD_USES_GENERIC_KERNEL_IMAGE := true
BOARD_USES_QCOM_MERGE_DTBS_SCRIPT := true
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_IMAGE_NAME := Image
TARGET_KERNEL_CLANG_VERSION := r416183b
TARGET_KERNEL_CLANG_PATH := $(abspath .)/prebuilts/clang/kernel/$(HOST_PREBUILT_TAG)/clang-$(TARGET_KERNEL_CLANG_VERSION)
TARGET_KERNEL_ADDITIONAL_FLAGS := TARGET_PRODUCT=$(PRODUCT_DEVICE)
TARGET_KERNEL_SOURCE := kernel/xiaomi/sm8475
TARGET_KERNEL_CONFIG := vendor/mondrian_defconfig
@@ -142,7 +146,6 @@ BOARD_VENDOR_RAMDISK_FRAGMENT.dlkm.KERNEL_MODULE_DIRS := top
BOARD_KERNEL_CMDLINE := \
video=vfb:640x400,bpp=32,memsize=3072000 \
disable_dma32=on \
bootinfo.fingerprint=$(LINEAGE_VERSION) \
mtdoops.fingerprint=$(LINEAGE_VERSION)
BOARD_BOOTCONFIG := \
@@ -164,7 +167,7 @@ BOARD_VENDOR_KERNEL_MODULES_LOAD := $(strip $(shell cat $(KERNEL_PATH)/vendor_dl
BOARD_VENDOR_KERNEL_MODULES_BLOCKLIST_FILE := $(KERNEL_PATH)/vendor_dlkm/modules.blocklist
# Lineage Health
TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS := false
$(call soong_config_set, lineage_health, charging_control_supports_bypass, false)
# Metadata
BOARD_USES_METADATA_PARTITION := true
@@ -174,8 +177,7 @@ BOARD_FLASH_BLOCK_SIZE := 0x020000 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x0C000000
BOARD_DTBOIMG_PARTITION_SIZE := 0x01800000
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x06400000
BOARD_SUPER_PARTITION_SIZE := 0x220000000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 239033364480 # 0x37A77FB000
BOARD_SUPER_PARTITION_SIZE := 9126805504 # 0x220000000
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 0x06000000
BOARD_SUPER_PARTITION_GROUPS := qti_dynamic_partitions
@@ -195,6 +197,8 @@ TARGET_COPY_OUT_SYSTEM_EXT := system_ext
TARGET_COPY_OUT_VENDOR := vendor
TARGET_COPY_OUT_VENDOR_DLKM := vendor_dlkm
-include vendor/lineage/config/BoardConfigReservedSize.mk
# Platform
BOARD_USES_QCOM_HARDWARE := true
@@ -214,12 +218,6 @@ TARGET_SYSTEM_EXT_PROP += $(DEVICE_PATH)/configs/properties/system_ext.prop
TARGET_VENDOR_PROP += $(DEVICE_PATH)/configs/properties/vendor.prop
# Recovery
#namespace definition for librecovery_updater
#differentiate legacy 'sg' or 'bsg' framework
SOONG_CONFIG_NAMESPACES += ufsbsg
SOONG_CONFIG_ufsbsg += ufsframework
SOONG_CONFIG_ufsbsg_ufsframework := bsg
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/rootdir/etc/recovery.fstab
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_USERIMAGES_USE_EXT4 := true
@@ -230,7 +228,7 @@ BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE := true
ENABLE_VENDOR_RIL_SERVICE := true
# Security patch level
VENDOR_SECURITY_PATCH := 2024-10-01
VENDOR_SECURITY_PATCH := 2025-06-06
# Sensor
SOONG_CONFIG_NAMESPACES += SENSORS_XIAOMI
@@ -249,16 +247,16 @@ BOARD_VENDOR_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
TARGET_SCREEN_DENSITY := 560
# Vibrator
TARGET_QTI_VIBRATOR_EFFECT_LIB := libqtivibratoreffect.xiaomi
TARGET_QTI_VIBRATOR_USE_EFFECT_STREAM := true
$(call soong_config_set,qti_vibrator,effect_lib,libqtivibratoreffect.xiaomi)
$(call soong_config_set,qti_vibrator,use_effect_stream,true)
# WiFi
BOARD_HAS_QCOM_WLAN := true
BOARD_WLAN_DEVICE := qcwcn
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
CONFIG_IEEE80211AX := true
QC_WIFI_HIDL_FEATURE_DUAL_AP := true
QC_WIFI_HIDL_FEATURE_DUAL_STA := true
WIFI_DRIVER_BUILT := qca_cld3
@@ -270,8 +268,3 @@ WIFI_HIDL_FEATURE_AWARE := true
WIFI_HIDL_FEATURE_DUAL_INTERFACE := true
WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY := true
WPA_SUPPLICANT_VERSION := VER_0_8_X
PRODUCT_VENDOR_MOVE_ENABLED := true
BOARD_WPA_SUPPLICANT_PRIVATE_LIB_EVENT := "ON"
BOARD_HOSTAPD_PRIVATE_LIB_EVENT := "ON"

View File

@@ -1,18 +0,0 @@
//
// Copyright (C) 2022 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library {
name: "bootctrl.xiaomi_sm8450",
defaults: ["bootctrl_hal_defaults"],
static_libs: ["libgptutils.taro"],
}
cc_library_shared {
name: "android.hardware.boot@1.2-impl-qti",
stem: "android.hardware.boot@1.0-impl-1.2-qti",
defaults: ["android.hardware.boot@1.2-impl-qti_defaults"],
static_libs: ["libgptutils.taro"],
}

View File

@@ -7,6 +7,9 @@ ro.charger.enable_suspend=1
# CNE
persist.vendor.cne.feature=1
# FEAS
ro.feas.enable=true
# Graphics
debug.sf.disable_backpressure=1

View File

@@ -33,7 +33,7 @@ ro.audio.monitorRotation=true
#ro.config.media_vol_default=100
#ro.config.media_vol_steps=150
#ro.config.system_vol_steps=15
#ro.config.vc_call_vol_steps=11
ro.config.vc_call_vol_steps=11
ro.qc.sdk.audio.fluencetype=none
ro.qc.sdk.audio.ssr=false
ro.vendor.audio.aiasst.support=true
@@ -297,11 +297,8 @@ persist.vendor.dpm.vndr.idletimer.mode=default
drm.service.enabled=true
# Fingerprint
persist.vendor.sys.fp.expolevel=0x88
persist.vendor.sys.fp.fod.location.X_Y=433,2056
persist.vendor.sys.fp.fod.size.width_height=214,214
ro.hardware.fp.fod.location=low
ro.hardware.fp.fod=true
persist.vendor.fingerprint.type=udfps_optical
persist.vendor.fingerprint.sensor_location=720|2882|124
# FM
vendor.hw.fm.init=0
@@ -443,11 +440,13 @@ ro.vendor.radio.features_common=3
# RCS
persist.vendor.rcs.singlereg.feature=1
# Sensors
ro.vendor.sensors.xiaomi.udfps=true
# SSR
persist.vendor.ssr.restart_level=ALL_ENABLE
# USB
persist.sys.usb.config=none
sys.usb.mtp.batchcancel=1
vendor.usb.diag.func.name=ffs
vendor.usb.dpl.inst.name=dpl
@@ -456,7 +455,7 @@ vendor.usb.rmnet.func.name=gsi
vendor.usb.rmnet.inst.name=rmnet
vendor.usb.rndis.func.name=gsi
vendor.usb.use_ffs_mtp=1
vendor.usb.use_gadget_hal=0
vendor.usb.use_gadget_hal=1
# VCB
persist.vendor.vcb.ability=true

View File

@@ -1,3 +1,3 @@
sensors.ssc.so
sensors.touch.detect.so
sensors.xiaomi.so
sensors.xiaomi.v2.so

0
configs/wifi/WCNSS_qcom_cfg_qca6490.ini Normal file → Executable file
View File

View File

@@ -0,0 +1,114 @@
# This file allows user to override the factory
# defaults for the WLAN Driver
gDot11Mode=0
InfraUapsdVoSrvIntv=0
InfraUapsdViSrvIntv=0
InfraUapsdBeSrvIntv=0
InfraUapsdBkSrvIntv=0
gAddTSWhenACMIsOff=1
gEnableApOBSSProt=1
RTSThreshold=1048576
g11dSupportEnabled=0
gEnableDFSMasterCap=1
gNeighborScanTimerPeriod=200
gNeighborLookupThreshold=76
FastRoamEnabled=1
RoamRssiDiff=5
gChannelBondingMode5GHz=1
gAllowDFSChannelRoam=1
gSetTxChainmask1x1=1
gSetRxChainmask1x1=1
gWlanMccToSccSwitchMode = 3
gEnableTXSTBC=1
gEnableTxBFeeSAP=1
gEnableTxBFin20MHz=1
gEnableTxSUBeamformer=1
gRrmEnable=1
gVhtAmpduLenExponent=7
gVhtMpduLen=2
isP2pDeviceAddrAdministrated=0
gEnableVhtFor24GHzBand=1
gEnableLpassSupport=1
gCountryCodePriority=1
gEnableMuBformee=1
gTDLSExternalControl=1
gEnableTDLSOffChannel=1
gThermalMitigationEnable=0
################ Datapath feature set Begin ################
gVhtRxMCS=2
gVhtTxMCS=2
gEnable2x2=1
gVhtRxMCS2x2=2
gVhtTxMCS2x2=2
dp_tx_ring_size=3072
rx_mode=20
gEnableFastPath=1
TSOEnable=1
GROEnable=1
ght_mpdu_density=5
gEnableFlowSteering=1
maxMSDUsPerRxInd=8
dp_rx_fisa_enable=1
dp_rx_flow_search_table_size=128
rpsRxQueueCpuMapList=07
legacy_mode_csum_disable=0
################ Datapath feature set End ################
adaptive_dwell_mode_enabled=1
hostscan_adaptive_dwell_mode=1
enable_rtt_mac_randomization=1
gEnableSNRMonitoring=1
gWmiCreditCount=1
AutoChannelSelectWeight=0x00fafafa
bcast_twt=1
gRuntimePM=2
gRuntimePMDelay=500
oem_6g_support_disable=0
gEnableSWLM=1
g_enable_pci_gen=1
ssdp=0
gRArateLimitInterval=600
gEnableSifsBurst=1
gIbssTxSpEndInactivityTime=10
RX_THREAD_UL_CPU_AFFINITY_MASK=0xc0
dp_rx_buff_prealloc_pool=1
dp_rx_refill_buff_pool=1
dp_rx_fst_in_cmem=1
################ XIAOMI ADD ######################
gActiveMaxChannelTime=40
gIPAConfig=0
gIPADescSize=800
active_max_channel_time_2g=80
wlm_latency_flags_ultralow=0x180003
gActiveMcBcBpfMode=1
assoc_failure_timeout=5000
gEnableNUDTracking=3
etsi13_srd_chan_in_master_mode=7
gSelect5GHzMargin=5
candidate_min_rssi_for_beacon_miss=-83
gtraffic_threshold=50
enable_ftopen=0
twt_congestion_timeout=0
gEnableSARV1toSARV2=1
g_prefer_5g_scc_to_dbs=8
gEnableModulatedDTIM=3
gMaxLIModulatedDTIM=3
enable_mod_dtim_on_system_suspend=1
avoid_list_expiry_time=3
black_list_expiry_time=5
bad_bssid_counter_thresh=7
gindoor_channel_support=1
gReportMaxLinkSpeed=2
icmp_req_to_fw_mark_interval=200
twt_responder=0
END
# Note: Configuration parser would not read anything past the END marker

0
configs/wifi/p2p_supplicant_overlay.conf Normal file → Executable file
View File

0
configs/wifi/vendor_cmd.xml Normal file → Executable file
View File

0
configs/wifi/wpa_supplicant_overlay.conf Normal file → Executable file
View File

235
device.mk
View File

@@ -46,41 +46,11 @@ PRODUCT_PACKAGES += \
checkpoint_gc \
otapreopt_script
# AIDL NDK backend
PRODUCT_PACKAGES += \
android.hardware.common-V2-ndk_platform.vendor \
android.hardware.gnss-V1-ndk_platform.vendor \
android.hardware.graphics.common-V3-ndk \
android.hardware.identity-V3-ndk_platform.vendor \
android.hardware.keymaster-V3-ndk_platform.vendor \
android.hardware.light-V1-ndk_platform.vendor \
android.hardware.memtrack-V1-ndk_platform.vendor \
android.hardware.security.keymint-V1-ndk_platform.vendor \
android.hardware.security.secureclock-V1-ndk_platform.vendor \
android.hardware.security.sharedsecret-V1-ndk_platform.vendor \
android.hardware.security.keymint-V2-ndk.vendor \
android.hardware.security.rkp-V3-ndk.vendor \
android.frameworks.sensorservice-V1-ndk.vendor \
android.system.keystore2-V1-ndk_platform.vendor
# ANT+
PRODUCT_PACKAGES += \
com.dsi.ant@1.0.vendor
# API
PRODUCT_SHIPPING_API_LEVEL := 31
PRODUCT_SHIPPING_API_LEVEL := 33
BOARD_SHIPPING_API_LEVEL := 31
# Atrace
PRODUCT_PACKAGES += \
android.hardware.atrace@1.0-service
# Audio
SOONG_CONFIG_NAMESPACES += android_hardware_audio
SOONG_CONFIG_android_hardware_audio += \
run_64bit
SOONG_CONFIG_android_hardware_audio_run_64bit := true
PRODUCT_PACKAGES += \
android.hardware.audio@7.0-impl \
android.hardware.audio.effect@7.0-impl \
@@ -133,18 +103,15 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
frameworks/native/data/etc/android.software.midi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.midi.xml
$(call soong_config_set, android_hardware_audio, run_64bit, true)
# Automotive
PRODUCT_PACKAGES += \
android.hardware.automotive.vehicle@2.0-manager-lib
# Bluetooth
PRODUCT_PACKAGES += \
android.hardware.bluetooth@1.0.vendor \
android.hardware.bluetooth.audio-impl \
com.qualcomm.qti.bluetooth_audio@1.0.vendor \
vendor.qti.hardware.bluetooth_audio@2.1.vendor \
vendor.qti.hardware.btconfigstore@1.0.vendor \
vendor.qti.hardware.btconfigstore@2.0.vendor
android.hardware.bluetooth.audio-impl
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
@@ -152,31 +119,20 @@ PRODUCT_COPY_FILES += \
# Boot control
PRODUCT_PACKAGES += \
android.hardware.boot@1.2-impl-qti \
android.hardware.boot@1.2-impl-qti.recovery \
android.hardware.boot@1.2-service \
bootctrl.xiaomi_sm8450 \
bootctrl.xiaomi_sm8450.recovery
android.hardware.boot-service.qti \
android.hardware.boot-service.qti.recovery
PRODUCT_PACKAGES_DEBUG += \
bootctl
$(call soong_config_set, ufsbsg, ufsframework, bsg)
# Camera
$(call inherit-product-if-exists, vendor/xiaomi/miuicamera/config.mk)
PRODUCT_PACKAGES += \
android.frameworks.cameraservice.common@2.0.vendor \
android.frameworks.cameraservice.service@2.2.vendor \
android.hardware.camera.provider@2.7.vendor \
camera.device@1.0-impl \
libcamera2ndk_vendor \
vendor.qti.hardware.camera.aon@1.0.vendor \
vendor.qti.hardware.camera.postproc@1.0.vendor
camera.device@1.0-impl
PRODUCT_PACKAGES += \
libMegviiFacepp-0.5.2 \
libmegface \
libexif.vendor
libmegface
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
@@ -184,61 +140,32 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml
# Capabilityconfigstore
PRODUCT_PACKAGES += \
vendor.qti.hardware.capabilityconfigstore@1.0.vendor
# Display
PRODUCT_PACKAGES += \
vendor.display.config@1.11.vendor \
vendor.qti.hardware.display.config-V1-ndk_platform.vendor \
vendor.qti.hardware.display.config-V2-ndk_platform.vendor \
vendor.qti.hardware.display.config-V3-ndk_platform.vendor \
vendor.qti.hardware.display.config-V4-ndk_platform.vendor \
vendor.qti.hardware.display.config-V5-ndk_platform.vendor \
vendor.qti.hardware.display.config-V6-ndk_platform.vendor \
vendor.qti.hardware.display.allocator@1.0.vendor \
vendor.qti.hardware.display.composer@1.0.vendor \
vendor.qti.hardware.display.composer@2.0.vendor \
vendor.qti.hardware.display.mapper@1.0.vendor \
vendor.qti.hardware.display.mapper@1.1.vendor \
vendor.qti.hardware.display.mapper@2.0.vendor
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/display/snapdragon_color_libs_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/snapdragon_color_libs_config.xml
# DRM
PRODUCT_PACKAGES += \
android.hardware.drm@1.4.vendor \
android.hardware.drm@1.4-service.clearkey.vendor \
libdrm.vendor
# Dumpstate
PRODUCT_PACKAGES += \
android.hardware.dumpstate@1.1.vendor
# Fingerprint
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.3-service.xiaomi \
libudfpshandler
android.hardware.biometrics.fingerprint-service.xiaomi \
libudfpshandler:64
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
# Gatekeeper
PRODUCT_PACKAGES += \
android.hardware.gatekeeper@1.0.vendor
# GPS
PRODUCT_PACKAGES += \
android.hardware.gnss@2.1-impl-qti:64 \
android.hardware.gnss-aidl-impl-qti:64 \
android.hardware.gnss@2.1-impl-qti \
android.hardware.gnss-aidl-impl-qti \
android.hardware.gnss-aidl-service-qti
PRODUCT_PACKAGES += \
libbatching:64 \
libgeofencing:64 \
libgnss:64
libbatching \
libgeofencing \
libgnss
PRODUCT_PACKAGES += \
apdr.conf \
@@ -257,9 +184,6 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml
# Graphics
PRODUCT_PACKAGES += \
libgui_vendor
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml \
frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute-0.xml \
@@ -273,13 +197,6 @@ PRODUCT_PACKAGES += \
android.hardware.health-service.qti \
android.hardware.health-service.qti_recovery
# HIDL
PRODUCT_PACKAGES += \
android.hidl.allocator@1.0.vendor \
android.hidl.memory.block@1.0.vendor \
libhidltransport.vendor \
libhwbinder.vendor
# Hotword Enrollement
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/permissions/privapp-permissions-hotword.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-hotword.xml
@@ -300,14 +217,9 @@ PRODUCT_COPY_FILES += \
# JSON
PRODUCT_PACKAGES += \
libjson \
libjsoncpp.vendor
libjson
# Keymaster
PRODUCT_PACKAGES += \
android.hardware.keymaster@4.1.vendor \
libkeymaster_messages.vendor
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.keystore.app_attest_key.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.keystore.app_attest_key.xml
@@ -317,13 +229,9 @@ PRODUCT_PACKAGES += \
# Media
PRODUCT_PACKAGES += \
android.hardware.media.c2@1.2.vendor \
libcodec2_hidl@1.2.vendor \
libcodec2_hidl@1.0.vendor \
libcodec2_soft_common.vendor \
libsfplugin_ccodec_utils.vendor \
libcodec2_hidl_shim.vendor \
libavservices_minijail.vendor
libstagefrighthw.vendor \
libstagefright_softomx.vendor \
libstagefright_softomx_plugin.vendor
PRODUCT_PACKAGES += \
init.qti.media.rc \
@@ -340,25 +248,13 @@ PRODUCT_COPY_FILES += \
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/audio/media_codecs_dolby_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_dolby_audio.xml
# Misc
PRODUCT_PACKAGES += \
libcurl.vendor \
libsqlite.vendor \
liblz4.vendor
# Network
PRODUCT_PACKAGES += \
android.system.net.netd@1.1.vendor
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml
# NFC
PRODUCT_PACKAGES += \
android.hardware.nfc@1.2.vendor \
libchrome.vendor \
NfcNci \
Tag \
SecureElement \
com.android.nfc_extras
@@ -394,6 +290,7 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
FrameworksResMondrian \
SettingsProviderResMondrian \
SettingsProviderResMondrianCN \
SettingsResMondrian \
SystemUIResMondrian \
WifiResMondrian
@@ -405,10 +302,6 @@ DEVICE_PACKAGE_OVERLAYS += \
PRODUCT_BUILD_SUPER_PARTITION := false
PRODUCT_USE_DYNAMIC_PARTITIONS := true
# Perf
PRODUCT_PACKAGES += \
vendor.qti.hardware.perf@2.3.vendor
# Power
PRODUCT_PACKAGES += \
android.hardware.power-service-qti
@@ -416,23 +309,18 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
vendor/qcom/opensource/power/config/taro/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml
# PowerShare
# Powershare
PRODUCT_PACKAGES += \
vendor.lineage.powershare@1.0-service.xiaomi_mondrian
vendor.lineage.powershare-service.default
# Protobuf
PRODUCT_PACKAGES += \
libprotobuf-cpp-full-3.9.1-vendorcompat \
libprotobuf-cpp-lite-3.9.1-vendorcompat
$(call soong_config_set,lineage_powershare,powershare_path,/sys/class/qcom-battery/reverse_chg_mode)
# QTI
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/permissions/privapp-permissions-qti.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-qti.xml \
PRODUCT_PACKAGES += \
libqti_vndfwk_detect.vendor \
libvndfwk_detect_jni.qti_vendor \
vendor.qti.hardware.systemhelper@1.0.vendor
libvndfwk_detect_jni.qti_vendor
# Recovery
PRODUCT_PACKAGES += \
@@ -445,15 +333,7 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
android.hardware.renderscript@1.0-impl
# RIL
PRODUCT_PACKAGES += \
android.hardware.radio.config@1.3.vendor \
android.hardware.radio.deprecated@1.0.vendor \
# Secure element
PRODUCT_PACKAGES += \
android.hardware.secure_element@1.2.vendor
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.se.omapi.ese.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.ese.xml \
frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.uicc.xml
@@ -463,10 +343,9 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf
PRODUCT_PACKAGES += \
android.frameworks.sensorservice@1.0.vendor \
android.hardware.sensors@2.1-service.xiaomi-multihal \
android.hardware.sensors-service.xiaomi-multihal \
libsensorndkbridge \
sensors.xiaomi
sensors.xiaomi.v2
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_cape/android.hardware.sensor.accelerometer.xml \
@@ -488,10 +367,6 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_taro/android.hardware.sensor.stepcounter.xml \
frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/sku_taro/android.hardware.sensor.stepdetector.xml
# Servicetracker
PRODUCT_PACKAGES += \
vendor.qti.hardware.servicetracker@1.2.vendor
# Soong
PRODUCT_SOONG_NAMESPACES += \
$(LOCAL_PATH) \
@@ -526,13 +401,11 @@ PRODUCT_COPY_FILES += \
# Thermal
PRODUCT_PACKAGES += \
android.hardware.thermal@2.0 \
android.hardware.thermal@2.0-service.qti-v2 \
android.hardware.thermal@2.0.vendor
android.hardware.thermal-service.qti
# Touch
PRODUCT_PACKAGES += \
vendor.lineage.touch@1.0-service.xiaomi_sm8475
vendor.lineage.touch-service.xiaomi_sm8475
# Touchscreen
PRODUCT_COPY_FILES += \
@@ -549,8 +422,15 @@ PRODUCT_PACKAGES_DEBUG += \
# USB
PRODUCT_PACKAGES += \
android.hardware.usb@1.3-service-qti \
libusbhost.vendor
android.hardware.usb-service.qti \
android.hardware.usb.gadget-service.qti
PRODUCT_PACKAGES += \
init.qcom.usb.rc \
init.qcom.usb.sh \
usb_compositions.conf
PRODUCT_SOONG_NAMESPACES += vendor/qcom/opensource/usb/etc
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
@@ -570,6 +450,7 @@ PRODUCT_PACKAGES += \
init.target.rc \
init.qti.display_boot.mondrian.rc \
init.touch_report.rc \
init.sm8475.rc \
ueventd-odm.rc \
ueventd.qcom.rc
@@ -591,31 +472,22 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
vendor/qcom/opensource/vibrator/excluded-input-devices.xml:$(TARGET_COPY_OUT_VENDOR)/etc/excluded-input-devices.xml
# Vndk
PRODUCT_COPY_FILES += \
prebuilts/vndk/v33/arm/arch-arm-armv7-a-neon/shared/vndk-sp/libutils.so:$(TARGET_COPY_OUT_VENDOR)/lib/libutils-v33.so \
prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-sp/libutils.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libutils-v33.so \
prebuilts/vndk/v33/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib/libstagefright_foundation-v33.so \
prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefright_foundation-v33.so
# WiFi
PRODUCT_PACKAGES += \
android.hardware.wifi@1.6.vendor \
android.hardware.wifi@1.0-service \
android.hardware.wifi.hostapd@1.0.vendor \
android.hardware.wifi-service \
hostapd \
hostapd_cli \
libwifi-hal-qcom \
libwpa_client \
wpa_cli \
wpa_supplicant \
wpa_supplicant.conf \
libwifi-system-iface.vendor
wpa_supplicant.conf
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf \
$(LOCAL_PATH)/configs/wifi/vendor_cmd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/vendor_cmd.xml \
$(LOCAL_PATH)/configs/wifi/WCNSS_qcom_cfg_qca6490.ini:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/qca6490/WCNSS_qcom_cfg.ini \
$(LOCAL_PATH)/configs/wifi/WCNSS_qcom_cfg_qca6750.ini:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/qca6750/WCNSS_qcom_cfg.ini \
$(LOCAL_PATH)/configs/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
PRODUCT_COPY_FILES += \
@@ -625,28 +497,11 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.wifi.rtt.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.rtt.xml \
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml
TARGET_WLAN_CHIP := qca6490 qca6750
WLAN_CHIPSET := qca_cld3
# Force chip-specific DLKM name
TARGET_MULTI_WLAN := true
#WPA
WPA := wpa_cli
# Package chip specific ko files if TARGET_WLAN_CHIP is defined.
ifneq ($(TARGET_WLAN_CHIP),)
PRODUCT_PACKAGES += $(foreach chip, $(TARGET_WLAN_CHIP), $(WLAN_CHIPSET)_$(chip).ko)
else
PRODUCT_PACKAGES += $(WLAN_CHIPSET)_wlan.ko
endif
# WiFi Display
PRODUCT_PACKAGES += \
libnl \
libwfdaac_vendor
PRODUCT_BOOT_JARS += \
WfdCommon
# XiaomiParts
PRODUCT_PACKAGES += \
XiaomiDolby \
XiaomiParts

View File

@@ -3,13 +3,13 @@
"remote" : "github",
"repository" : "Evolution-X-Devices/device_xiaomi_mondrian",
"target_path" : "device/xiaomi/mondrian",
"branch" : "udc"
"branch" : "vic"
},
{
"remote" : "github",
"repository" : "Evolution-X-Devices/device_xiaomi_mondrian-kernel",
"target_path" : "device/xiaomi/mondrian-kernel",
"branch" : "udc"
"branch" : "vic"
},
{
"remote" : "github",
@@ -21,7 +21,7 @@
"remote" : "github",
"repository" : "Evolution-X-Devices/vendor_xiaomi_mondrian",
"target_path" : "vendor/xiaomi/mondrian",
"branch" : "udc"
"branch" : "vic"
},
{
"remote" : "github",
@@ -39,6 +39,6 @@
"remote" : "github",
"repository" : "flakeforever/hardware_xiaomi",
"target_path" : "hardware/xiaomi",
"branch" : "udc"
"branch" : "vic"
}
]

223
extract-files.py Executable file
View File

@@ -0,0 +1,223 @@
#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3
#
# SPDX-FileCopyrightText: 2024 The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
import extract_utils.tools
extract_utils.tools.DEFAULT_PATCHELF_VERSION = '0_18'
from extract_utils.fixups_blob import (
blob_fixup,
blob_fixups_user_type,
)
from extract_utils.fixups_lib import (
lib_fixup_remove,
lib_fixups,
lib_fixups_user_type,
)
from extract_utils.main import (
ExtractUtils,
ExtractUtilsModule,
)
namespace_imports = [
'device/xiaomi/mondrian',
'hardware/qcom-caf/sm8450',
'hardware/qcom-caf/wlan',
'hardware/xiaomi',
'vendor/qcom/opensource/commonsys/display',
'vendor/qcom/opensource/commonsys-intf/display',
'vendor/qcom/opensource/dataservices',
]
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
return f'{lib}_{partition}' if partition == 'vendor' else None
lib_fixups: lib_fixups_user_type = {
**lib_fixups,
(
# agm
'libagm',
'libagm_compress_plugin',
'libagm_mixer_plugin',
'libagm_pcm_plugin',
'libagmclient',
'libagmmixer',
'libmisight',
'libsndcardparser',
'vendor.qti.hardware.AGMIPC@1.0-impl',
'vendor.qti.hardware.AGMIPC@1.0',
# dpm
'com.qualcomm.qti.dpm.api@1.0',
# graphservices
'libar-acdb',
'libar-gpr',
'libar-gsl',
'libar-pal',
'libats',
'liblx-ar_util',
'liblx-osal',
# omx
'libplatformconfig',
# pal
'libpalclient',
'vendor.qti.hardware.pal@1.0-impl',
'vendor.qti.hardware.pal@1.0',
# psi
'libpsi',
# primary-hal
'audio.primary.taro',
'libfmpal',
'libmcs',
'libqtigefar',
# qcc
'vendor.qti.diaghal@1.0',
'vendor.qti.hardware.dpmservice@1.0',
'vendor.qti.hardware.dpmservice@1.1',
'vendor.qti.hardware.qccsyshal@1.0',
'vendor.qti.hardware.qccsyshal@1.1',
'vendor.qti.hardware.qccvndhal@1.0',
'vendor.qti.hardware.wifidisplaysession@1.0',
'vendor.qti.imsrtpservice@3.0',
# xiaomi
'vendor.xiaomi.hardware.displayfeature@1.0',
'vendor.xiaomi.hardware.fx.tunnel@1.0',
'vendor.xiaomi.hardware.mfidoca@1.0',
'vendor.xiaomi.hardware.mlipay@1.0',
'vendor.xiaomi.hardware.mlipay@1.1',
'vendor.xiaomi.hardware.mtdservice@1.0',
'vendor.xiaomi.hardware.mtdservice@1.1',
'vendor.xiaomi.hardware.mtdservice@1.2',
'vendor.xiaomi.hardware.mtdservice@1.3',
): lib_fixup_vendor_suffix,
(
'libvibrator',
'libwpa_client',
): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
(
'vendor/lib64/libTrueSight.so',
'vendor/lib64/libalAILDC.so',
'vendor/lib64/libalLDC.so',
'vendor/lib64/libalhLDC.so',
): blob_fixup()
.clear_symbol_version('AHardwareBuffer_allocate')
.clear_symbol_version('AHardwareBuffer_describe')
.clear_symbol_version('AHardwareBuffer_lock')
.clear_symbol_version('AHardwareBuffer_lockPlanes')
.clear_symbol_version('AHardwareBuffer_release')
.clear_symbol_version('AHardwareBuffer_unlock'),
(
'system_ext/lib/libwfdmmsrc_system.so',
'system_ext/lib64/libwfdmmsrc_system.so',
): blob_fixup()
.add_needed('libgui_shim.so'),
'system_ext/lib64/libwfdnative.so': blob_fixup()
.add_needed('libbinder_shim.so')
.add_needed('libinput_shim.so'),
(
'system_ext/lib/libwfdservice.so',
'system_ext/lib64/libwfdservice.so',
): blob_fixup()
.add_needed('libaudioclient_shim.so')
.replace_needed(
'android.media.audio.common.types-V2-cpp.so',
'android.media.audio.common.types-V4-cpp.so',
),
(
'vendor/lib/libcamxcommonutils.so',
'vendor/lib64/libcamxcommonutils.so',
'vendor/lib64/hw/com.qti.chi.override.so',
'vendor/lib64/libmialgoengine.so',
): blob_fixup()
.add_needed('libprocessgroup_shim.so'),
(
'vendor/lib/nfc_nci.nqx.default.hw.v1.so',
'vendor/lib64/nfc_nci.nqx.default.hw.v1.so',
): blob_fixup()
.add_needed('libbase_shim.so'),
(
'vendor/lib/libsdmcore.so',
'vendor/lib64/libsdmcore.so',
): blob_fixup()
.replace_needed(
'libutils.so',
'libutils-v33.so',
),
(
'vendor/lib/soundfx/libmisoundfx.so',
'vendor/lib64/soundfx/libmisoundfx.so',
'vendor/lib/hw/displayfeature.default.so',
'vendor/lib64/hw/displayfeature.default.so',
): blob_fixup()
.replace_needed(
'libstagefright_foundation.so',
'libstagefright_foundation-v33.so',
),
(
'vendor/bin/hw/dolbycodec2',
'vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service',
): blob_fixup()
.add_needed('libstagefright_foundation-v33.so'),
(
'vendor/lib/c2.dolby.client.so',
'vendor/lib64/c2.dolby.client.so',
): blob_fixup()
.add_needed('libcodec2_hidl_shim.so'),
'vendor/lib/libstagefright_softomx.so': blob_fixup()
.add_needed('libui_shim.so'),
(
'vendor/lib/vendor.libdpmframework.so',
'vendor/lib64/vendor.libdpmframework.so',
): blob_fixup()
.add_needed('libhidlbase_shim.so'),
(
'vendor/bin/hw/android.hardware.security.keymint-service-qti',
'vendor/lib64/libqtikeymint.so',
): blob_fixup()
.replace_needed(
'android.hardware.security.keymint-V1-ndk_platform.so',
'android.hardware.security.keymint-V1-ndk.so',
)
.replace_needed(
'android.hardware.security.secureclock-V1-ndk_platform.so',
'android.hardware.security.secureclock-V1-ndk.so',
)
.replace_needed(
'android.hardware.security.sharedsecret-V1-ndk_platform.so',
'android.hardware.security.sharedsecret-V1-ndk.so',
)
.add_needed('android.hardware.security.rkp-V1-ndk.so'),
'vendor/bin/qcc-trd': blob_fixup()
.replace_needed(
'libgrpc++_unsecure.so',
'libgrpc++_unsecure_prebuilt.so'
),
'vendor/etc/init/init.embmssl_server.rc': blob_fixup()
.regex_replace('.+interface.+\n', ''),
'vendor/etc/qcril_database/upgrade/config/6.0_config.sql': blob_fixup()
.regex_replace('"persist.vendor.radio.redir_party_num", "true"', '"persist.vendor.radio.redir_party_num", "false"'),
(
'vendor/etc/camera/mondrian_enhance_motiontuning.xml',
'vendor/etc/camera/mondrian_motiontuning.xml',
): blob_fixup().regex_replace('xml=version', 'xml version'),
'vendor/etc/camera/pureView_parameter.xml': blob_fixup()
.regex_replace(r'=([0-9]+)>', r'="\1">'),
} # fmt: skip
module = ExtractUtilsModule(
'mondrian',
'xiaomi',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
check_elf=True,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()

View File

@@ -1,108 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
DEVICE=mondrian
VENDOR=xiaomi
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.."
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"
# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true
KANG=
SECTION=
while [ "${#}" -gt 0 ]; do
case "${1}" in
-n | --no-cleanup)
CLEAN_VENDOR=false
;;
-k | --kang)
KANG="--kang"
;;
-s | --section)
SECTION="${2}"
shift
CLEAN_VENDOR=false
;;
*)
SRC="${1}"
;;
esac
shift
done
if [ -z "${SRC}" ]; then
SRC="adb"
fi
function blob_fixup() {
case "${1}" in
vendor/etc/init/init.embmssl_server.rc)
sed -i -n '/interface/!p' "${2}"
;;
vendor/lib64/libsdmcore.so)
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v33.so" "${2}"
;;
vendor/lib/libsdmcore.so)
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v33.so" "${2}"
;;
vendor/lib64/soundfx/libmisoundfx.so)
"${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}"
;;
vendor/lib/soundfx/libmisoundfx.so)
"${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}"
;;
vendor/lib64/hw/displayfeature.default.so)
"${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}"
;;
vendor/lib/hw/displayfeature.default.so)
"${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}"
;;
vendor/bin/hw/android.hardware.security.keymint-service-qti | vendor/lib64/libqtikeymint.so)
"${PATCHELF}" --add-needed "android.hardware.security.rkp-V1-ndk.so" "${2}"
;;
vendor/lib/c2.dolby.client.so)
"${PATCHELF}" --add-needed "libcodec2_hidl_shim.so" "${2}"
;;
vendor/bin/hw/dolbycodec2 | vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service | vendor/bin/hw/vendor.qti.media.c2@1.0-service)
"${PATCHELF}" --add-needed "libstagefright_foundation-v33.so" "${2}"
;;
vendor/etc/qcril_database/upgrade/config/6.0_config.sql)
[ "$2" = "" ] && return 0
sed -i '/persist.vendor.radio.redir_party_num/ s/true/false/g' "${2}"
;;
vendor/etc/camera/mondrian_enhance_motiontuning.xml|vendor/etc/camera/mondrian_motiontuning.xml)
sed -i 's/xml=version/xml version/g' "${2}"
;;
vendor/etc/camera/pureView_parameter.xml)
sed -i 's/=\([0-9]\+\)>/="\1">/g' "${2}"
;;
esac
}
# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" \
"${KANG}" --section "${SECTION}"
"${MY_DIR}/setup-makefiles.sh"

View File

@@ -1,41 +0,0 @@
//
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
cc_library {
name: "libgptutils.taro",
vendor: true,
recovery_available: true,
shared_libs: [
"libcutils",
"liblog",
"libz",
],
cflags: [
"-Wall",
"-Werror",
"-D_BSG_FRAMEWORK_KERNEL_HEADERS",
],
srcs: [
"gpt-utils.cpp",
"recovery-ufs-bsg.cpp",
],
owner: "qti",
header_libs: [
"generated_kernel_headers",
],
export_include_dirs: ["."],
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,195 +0,0 @@
/*
* Copyright (c) 2013,2016,2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __GPT_UTILS_H__
#define __GPT_UTILS_H__
#include <vector>
#include <string>
#include <map>
#ifdef __cplusplus
extern "C" {
#endif
#include <unistd.h>
#include <stdlib.h>
/******************************************************************************
* GPT HEADER DEFINES
******************************************************************************/
#define GPT_SIGNATURE "EFI PART"
#define HEADER_SIZE_OFFSET 12
#define HEADER_CRC_OFFSET 16
#define PRIMARY_HEADER_OFFSET 24
#define BACKUP_HEADER_OFFSET 32
#define FIRST_USABLE_LBA_OFFSET 40
#define LAST_USABLE_LBA_OFFSET 48
#define PENTRIES_OFFSET 72
#define PARTITION_COUNT_OFFSET 80
#define PENTRY_SIZE_OFFSET 84
#define PARTITION_CRC_OFFSET 88
#define TYPE_GUID_OFFSET 0
#define TYPE_GUID_SIZE 16
#define PTN_ENTRY_SIZE 128
#define UNIQUE_GUID_OFFSET 16
#define FIRST_LBA_OFFSET 32
#define LAST_LBA_OFFSET 40
#define ATTRIBUTE_FLAG_OFFSET 48
#define PARTITION_NAME_OFFSET 56
#define MAX_GPT_NAME_SIZE 72
/******************************************************************************
* AB RELATED DEFINES
******************************************************************************/
//Bit 48 onwords in the attribute field are the ones where we are allowed to
//store our AB attributes.
#define AB_FLAG_OFFSET (ATTRIBUTE_FLAG_OFFSET + 6)
#define GPT_DISK_INIT_MAGIC 0xABCD
#define AB_PARTITION_ATTR_SLOT_ACTIVE (0x1<<2)
#define AB_PARTITION_ATTR_BOOT_SUCCESSFUL (0x1<<6)
#define AB_PARTITION_ATTR_UNBOOTABLE (0x1<<7)
#define AB_SLOT_ACTIVE_VAL 0x3F
#define AB_SLOT_INACTIVE_VAL 0x0
#define AB_SLOT_ACTIVE 1
#define AB_SLOT_INACTIVE 0
#define AB_SLOT_A_SUFFIX "_a"
#define AB_SLOT_B_SUFFIX "_b"
#define PTN_XBL "xbl"
#define PTN_XBL_CFG "xbl_config"
#define PTN_MULTIIMGOEM "multiimgoem"
#define PTN_MULTIIMGQTI "multiimgqti"
#define PTN_SWAP_LIST PTN_XBL, PTN_XBL_CFG, PTN_MULTIIMGOEM, PTN_MULTIIMGQTI, "sbl1", "rpm", "tz", "aboot", "abl", "hyp", "lksecapp", "keymaster", "cmnlib", "cmnlib32", "cmnlib64", "pmic", "apdp", "devcfg", "hosd", "keystore", "msadp", "mdtp", "mdtpsecapp", "dsp", "aop", "qupfw", "vbmeta", "dtbo", "imagefv", "ImageFv", "uefisecapp", "vm-bootsys", "shrm", "cpucp", "featenabler", "vbmeta_system", "uefi", "aop_config", "uefisecapp", "recovery", "qweslicstore", "xbl_ramdump"
#define AB_PTN_LIST PTN_SWAP_LIST, "boot", "vendor_boot", "system", "system_ext", "product", "vendor", "vendor_dlkm", "odm", "modem", "bluetooth"
#define BOOT_DEV_DIR "/dev/block/bootdevice/by-name"
/******************************************************************************
* HELPER MACROS
******************************************************************************/
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/******************************************************************************
* TYPES
******************************************************************************/
enum boot_update_stage {
UPDATE_MAIN = 1,
UPDATE_BACKUP,
UPDATE_FINALIZE
};
enum gpt_instance {
PRIMARY_GPT = 0,
SECONDARY_GPT
};
enum boot_chain {
NORMAL_BOOT = 0,
BACKUP_BOOT
};
struct gpt_disk {
//GPT primary header
uint8_t *hdr;
//primary header crc
uint32_t hdr_crc;
//GPT backup header
uint8_t *hdr_bak;
//backup header crc
uint32_t hdr_bak_crc;
//Partition entries array
uint8_t *pentry_arr;
//Partition entries array for backup table
uint8_t *pentry_arr_bak;
//Size of the pentry array
uint32_t pentry_arr_size;
//Size of each element in the pentry array
uint32_t pentry_size;
//CRC of the partition entry array
uint32_t pentry_arr_crc;
//CRC of the backup partition entry array
uint32_t pentry_arr_bak_crc;
//Path to block dev representing the disk
char devpath[PATH_MAX];
//Block size of disk
uint32_t block_size;
uint32_t is_initialized;
};
/******************************************************************************
* FUNCTION PROTOTYPES
******************************************************************************/
int prepare_boot_update(enum boot_update_stage stage);
//GPT disk methods
struct gpt_disk* gpt_disk_alloc();
//Free previously allocated gpt_disk struct
void gpt_disk_free(struct gpt_disk *disk);
//Get the details of the disk holding the partition whose name
//is passed in via dev
int gpt_disk_get_disk_info(const char *dev, struct gpt_disk *disk);
//Get pointer to partition entry from a allocated gpt_disk structure
uint8_t* gpt_disk_get_pentry(struct gpt_disk *disk,
const char *partname,
enum gpt_instance instance);
//Update the crc fields of the modified disk structure
int gpt_disk_update_crc(struct gpt_disk *disk);
//Write the contents of struct gpt_disk back to the actual disk
int gpt_disk_commit(struct gpt_disk *disk);
//Return if the current device is UFS based or not
int gpt_utils_is_ufs_device();
//Swtich betwieen using either the primary or the backup
//boot LUN for boot. This is required since UFS boot partitions
//cannot have a backup GPT which is what we use for failsafe
//updates of the other 'critical' partitions. This function will
//not be invoked for emmc targets and on UFS targets is only required
//to be invoked for XBL.
//
//The algorithm to do this is as follows:
//- Find the real block device(eg: /dev/block/sdb) that corresponds
// to the /dev/block/bootdevice/by-name/xbl(bak) symlink
//
//- Once we have the block device 'node' name(sdb in the above example)
// use this node to to locate the scsi generic device that represents
// it by checking the file /sys/block/sdb/device/scsi_generic/sgY
//
//- Once we locate sgY we call the query ioctl on /dev/sgy to switch
//the boot lun to either LUNA or LUNB
int gpt_utils_set_xbl_boot_partition(enum boot_chain chain);
//Given a vector of partition names as a input and a reference to a map,
//populate the map to indicate which physical disk each of the partitions
//sits on. The key in the map is the path to the block device where the
//partiton lies and the value is a vector of strings indicating which of
//the passed in partiton names sits on that device.
int gpt_utils_get_partition_map(std::vector<std::string>& partition_list,
std::map<std::string,std::vector<std::string>>& partition_map);
#ifdef __cplusplus
}
#endif
#endif /* __GPT_UTILS_H__ */

View File

@@ -1,255 +0,0 @@
/*
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define LOG_TAG "recovery_ufs"
#include "recovery-ufs-bsg.h"
#ifndef _BSG_FRAMEWORK_KERNEL_HEADERS
#ifndef _GENERIC_KERNEL_HEADERS
#include <scsi/ufs/ioctl.h>
#include <scsi/ufs/ufs.h>
#endif
#endif
//Size of the buffer that needs to be passed to the UFS ioctl
#define UFS_ATTR_DATA_SIZE 32
#ifdef _BSG_FRAMEWORK_KERNEL_HEADERS
static int get_ufs_bsg_dev(void)
{
DIR *dir;
struct dirent *ent;
int ret = -ENODEV;
if ((dir = opendir ("/dev")) != NULL) {
/* read all the files and directories within directory */
while ((ent = readdir(dir)) != NULL) {
if (!strcmp(ent->d_name, "ufs-bsg") ||
!strcmp(ent->d_name, "ufs-bsg0")) {
snprintf(ufs_bsg_dev, FNAME_SZ, "/dev/%s", ent->d_name);
ret = 0;
break;
}
}
if (ret)
ALOGE("could not find the ufs-bsg dev\n");
closedir (dir);
} else {
/* could not open directory */
ALOGE("could not open /dev (error no: %d)\n", errno);
ret = -EINVAL;
}
return ret;
}
int ufs_bsg_dev_open(void)
{
int ret;
if (!fd_ufs_bsg) {
fd_ufs_bsg = open(ufs_bsg_dev, O_RDWR);
ret = errno;
if (fd_ufs_bsg < 0) {
ALOGE("Unable to open %s (error no: %d)",
ufs_bsg_dev, errno);
fd_ufs_bsg = 0;
return ret;
}
}
return 0;
}
void ufs_bsg_dev_close(void)
{
if (fd_ufs_bsg) {
close(fd_ufs_bsg);
fd_ufs_bsg = 0;
}
}
static int ufs_bsg_ioctl(int fd, struct ufs_bsg_request *req,
struct ufs_bsg_reply *rsp, __u8 *buf, __u32 buf_len,
enum bsg_ioctl_dir dir)
{
int ret;
struct sg_io_v4 sg_io{};
sg_io.guard = 'Q';
sg_io.protocol = BSG_PROTOCOL_SCSI;
sg_io.subprotocol = BSG_SUB_PROTOCOL_SCSI_TRANSPORT;
sg_io.request_len = sizeof(*req);
sg_io.request = (__u64)req;
sg_io.response = (__u64)rsp;
sg_io.max_response_len = sizeof(*rsp);
if (dir == BSG_IOCTL_DIR_FROM_DEV) {
sg_io.din_xfer_len = buf_len;
sg_io.din_xferp = (__u64)(buf);
} else {
sg_io.dout_xfer_len = buf_len;
sg_io.dout_xferp = (__u64)(buf);
}
ret = ioctl(fd, SG_IO, &sg_io);
if (ret)
ALOGE("%s: Error from sg_io ioctl (return value: %d, error no: %d, reply result from LLD: %d\n)",
__func__, ret, errno, rsp->result);
if (sg_io.info || rsp->result) {
ALOGE("%s: Error from sg_io info (check sg info: device_status: 0x%x, transport_status: 0x%x, driver_status: 0x%x, reply result from LLD: %d\n)",
__func__, sg_io.device_status, sg_io.transport_status,
sg_io.driver_status, rsp->result);
ret = -EAGAIN;
}
return ret;
}
static void compose_ufs_bsg_query_req(struct ufs_bsg_request *req, __u8 func,
__u8 opcode, __u8 idn, __u8 index, __u8 sel,
__u16 length)
{
struct utp_upiu_header *hdr = &req->upiu_req.header;
struct utp_upiu_query *qr = &req->upiu_req.qr;
req->msgcode = UTP_UPIU_QUERY_REQ;
hdr->dword_0 = DWORD(UTP_UPIU_QUERY_REQ, 0, 0, 0);
hdr->dword_1 = DWORD(0, func, 0, 0);
hdr->dword_2 = DWORD(0, 0, length >> 8, (__u8)length);
qr->opcode = opcode;
qr->idn = idn;
qr->index = index;
qr->selector = sel;
qr->length = htobe16(length);
}
static int ufs_query_attr(int fd, __u32 value,
__u8 func, __u8 opcode, __u8 idn,
__u8 index, __u8 sel)
{
struct ufs_bsg_request req{};
struct ufs_bsg_reply rsp{};
enum bsg_ioctl_dir dir = BSG_IOCTL_DIR_FROM_DEV;
int ret = 0;
if (opcode == QUERY_REQ_OP_WRITE_DESC || opcode == QUERY_REQ_OP_WRITE_ATTR)
dir = BSG_IOCTL_DIR_TO_DEV;
req.upiu_req.qr.value = htobe32(value);
compose_ufs_bsg_query_req(&req, func, opcode, idn, index, sel, 0);
ret = ufs_bsg_ioctl(fd, &req, &rsp, 0, 0, dir);
if (ret)
ALOGE("%s: Error from ufs_bsg_ioctl (return value: %d, error no: %d\n)",
__func__, ret, errno);
return ret;
}
int32_t set_boot_lun(char *sg_dev __unused,uint8_t lun_id)
{
int32_t ret;
__u32 boot_lun_id = lun_id;
ret = get_ufs_bsg_dev();
if (ret)
return ret;
ALOGV("Found the ufs bsg dev: %s\n", ufs_bsg_dev);
ret = ufs_bsg_dev_open();
if (ret)
return ret;
ALOGV("Opened ufs bsg dev: %s\n", ufs_bsg_dev);
ret = ufs_query_attr(fd_ufs_bsg, boot_lun_id, QUERY_REQ_FUNC_STD_WRITE,
QUERY_REQ_OP_WRITE_ATTR, QUERY_ATTR_IDN_BOOT_LU_EN, 0, 0);
if (ret) {
ALOGE("Error requesting ufs attr idn %d via query ioctl (return value: %d, error no: %d)",
QUERY_ATTR_IDN_BOOT_LU_EN, ret, errno);
goto out;
}
out:
ufs_bsg_dev_close();
return ret;
}
#endif
#ifndef _BSG_FRAMEWORK_KERNEL_HEADERS
int32_t set_boot_lun(char *sg_dev, uint8_t boot_lun_id)
{
#ifndef _GENERIC_KERNEL_HEADERS
int fd = -1;
int rc;
struct ufs_ioctl_query_data *data = NULL;
size_t ioctl_data_size = sizeof(struct ufs_ioctl_query_data) + UFS_ATTR_DATA_SIZE;
data = (struct ufs_ioctl_query_data*)malloc(ioctl_data_size);
if (!data) {
fprintf(stderr, "%s: Failed to alloc query data struct\n",
__func__);
goto error;
}
memset(data, 0, ioctl_data_size);
data->opcode = UPIU_QUERY_OPCODE_WRITE_ATTR;
data->idn = QUERY_ATTR_IDN_BOOT_LU_EN;
data->buf_size = UFS_ATTR_DATA_SIZE;
data->buffer[0] = boot_lun_id;
fd = open(sg_dev, O_RDWR);
if (fd < 0) {
fprintf(stderr, "%s: Failed to open %s(%s)\n",
__func__,
sg_dev,
strerror(errno));
goto error;
}
rc = ioctl(fd, UFS_IOCTL_QUERY, data);
if (rc) {
fprintf(stderr, "%s: UFS query ioctl failed(%s)\n",
__func__,
strerror(errno));
goto error;
}
close(fd);
free(data);
return 0;
error:
if (fd >= 0)
close(fd);
if (data)
free(data);
return -1;
#else
return 0;
#endif
}
#endif

View File

@@ -1,131 +0,0 @@
#ifndef __RECOVERY_UFS_BSG_H__
#define __RECOVERY_UFS_BSG_H__
/*
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <linux/bsg.h>
#include <scsi/scsi_bsg_ufs.h>
#include <endian.h>
#include <dirent.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#ifdef ANDROID
#include "cutils/log.h"
#endif
#ifdef OE
#include <syslog.h>
#define LOGI(...) syslog(LOG_NOTICE, "INFO:" __VA_ARGS__)
#define LOGV(...) syslog(LOG_NOTICE,"VERB:" __VA_ARGS__)
#define LOGD(...) syslog(LOG_DEBUG,"DBG:" __VA_ARGS__)
#define LOGE(...) syslog(LOG_ERR,"ERR:" __VA_ARGS__)
#define LOGW(...) syslog(LOG_WARNING,"WRN:" __VA_ARGS__)
#define strlcat(d,s,l) snprintf(d+strlen(d),l,"%s",s)
#endif
#define FNAME_SZ 64
#define SG_IO 0x2285
#define DWORD(b3, b2, b1, b0) htobe32((b3 << 24) | (b2 << 16) |\
(b1 << 8) | b0)
/* UFS BSG device nodes */
char ufs_bsg_dev[FNAME_SZ] = "/dev/ufs-bsg";
int fd_ufs_bsg;
int32_t set_ufs_lun(uint8_t lun_id);
#ifdef _BSG_FRAMEWORK_KERNEL_HEADERS
/* UPIU Transaction Codes */
enum {
UTP_UPIU_NOP_OUT = 0x00,
UTP_UPIU_COMMAND = 0x01,
UTP_UPIU_DATA_OUT = 0x02,
UTP_UPIU_TASK_REQ = 0x04,
UTP_UPIU_QUERY_REQ = 0x16,
};
/* UPIU Query Function field */
enum {
QUERY_REQ_FUNC_STD_READ = 0x01,
QUERY_REQ_FUNC_STD_WRITE = 0x81,
};
enum query_req_opcode {
QUERY_REQ_OP_READ_DESC = 0x1,
QUERY_REQ_OP_WRITE_DESC = 0x2,
QUERY_REQ_OP_READ_ATTR = 0x3,
QUERY_REQ_OP_WRITE_ATTR = 0x4,
QUERY_REQ_OP_READ_FLAG = 0x5,
QUERY_REQ_OP_SET_FLAG = 0x6,
QUERY_REQ_OP_CLEAR_FLAG = 0x7,
QUERY_REQ_OP_TOGGLE_FLAG = 0x8,
};
enum query_desc_idn {
QUERY_DESC_IDN_DEVICE = 0x0,
QUERY_DESC_IDN_UNIT = 0x2,
QUERY_DESC_IDN_GEOMETRY = 0x7,
};
enum query_desc_size {
QUERY_DESC_SIZE_DEVICE = 0x40,
QUERY_DESC_SIZE_GEOMETRY = 0x48,
QUERY_DESC_SIZE_UNIT = 0x23,
};
enum bsg_ioctl_dir {
BSG_IOCTL_DIR_TO_DEV,
BSG_IOCTL_DIR_FROM_DEV,
};
enum query_attr_idn {
QUERY_ATTR_IDN_BOOT_LU_EN = 0x00,
QUERY_ATTR_IDN_RESERVED = 0x01,
QUERY_ATTR_IDN_POWER_MODE = 0x02,
QUERY_ATTR_IDN_ACTIVE_ICC_LVL = 0x03,
};
#endif /* _BSG_FRAMEWORK_KERNEL_HEADERS */
#endif /* __RECOVERY_UFS_BSG_H__ */

View File

@@ -12,6 +12,7 @@
#define FINGERPRINT_GL "Redmi/mondrian/mondrian:13/SKQ1.220303.001/V14.0.26.0.TMNCNXM:user/release-keys"
#define FINGERPRINT_CN "Redmi/mondrian/mondrian:13/SKQ1.220303.001/V14.0.26.0.TMNCNXM:user/release-keys"
#define FINGERPRINT_IN "Redmi/mondrian/mondrian:13/SKQ1.220303.001/V14.0.26.0.TMNCNXM:user/release-keys"
static const variant_info_t mondrian_global_info = {
.hwc_value = "GL",
@@ -25,7 +26,7 @@ static const variant_info_t mondrian_global_info = {
.build_fingerprint = FINGERPRINT_GL,
};
static const variant_info_t mondrian_info = {
static const variant_info_t mondrian_cn_info = {
.hwc_value = "CN",
.sku_value = "",
@@ -37,9 +38,22 @@ static const variant_info_t mondrian_info = {
.build_fingerprint = FINGERPRINT_CN,
};
static const variant_info_t mondrian_in_info = {
.hwc_value = "IN",
.sku_value = "",
.brand = "Xiaomi",
.device = "mondrian",
.marketname = "Redmi K60",
.model = "23013RK75I",
.mod_device = "mondrian",
.build_fingerprint = FINGERPRINT_IN,
};
static const std::vector<variant_info_t> variants = {
mondrian_global_info,
mondrian_info,
mondrian_cn_info,
mondrian_in_info,
};
void vendor_load_properties() {

109
liblhdc/Android.bp Normal file
View File

@@ -0,0 +1,109 @@
cc_prebuilt_library_shared {
name: "liblhdc",
arch: {
arm: {
srcs: ["libs/armeabi-v7a/liblhdc.so",],
},
arm64: {
srcs: ["libs/arm64-v8a/liblhdc.so",],
},
},
apex_available: [
"//apex_available:platform",
"com.android.btservices",
],
strip: {
none:true,
},
shared_libs: [
"liblog",
"libstdc++",
],
}
cc_prebuilt_library_shared {
name: "liblhdcv5",
arch: {
arm: {
srcs: ["libs/armeabi-v7a/liblhdcv5.so",],
},
arm64: {
srcs: ["libs/arm64-v8a/liblhdcv5.so",],
},
},
apex_available: [
"//apex_available:platform",
"com.android.btservices",
],
strip: {
none:true,
},
shared_libs: [
"liblog",
"libstdc++",
],
}
cc_prebuilt_library_shared {
name: "liblhdcBT_enc",
// vendor_available: true,
// vndk: {
// enabled: true,
// },
arch: {
arm: {
srcs: ["libs/armeabi-v7a/liblhdcBT_enc.so",],
},
arm64: {
srcs: ["libs/arm64-v8a/liblhdcBT_enc.so",],
},
},
shared_libs: [
"libcutils",
"liblog",
"liblhdc",
],
apex_available: [
"//apex_available:platform",
"com.android.btservices",
],
}
cc_prebuilt_library_shared {
name: "liblhdcv5BT_enc",
// vendor_available: true,
// vndk: {
// enabled: true,
// },
arch: {
arm: {
srcs: ["libs/armeabi-v7a/liblhdcv5BT_enc.so",],
},
arm64: {
srcs: ["libs/arm64-v8a/liblhdcv5BT_enc.so",],
},
},
shared_libs: [
"libcutils",
"liblog",
"liblhdcv5",
],
apex_available: [
"//apex_available:platform",
"com.android.btservices",
],
}

BIN
liblhdc/libs/arm64-v8a/liblhdc.so Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2022-2023 The LineageOS Project
# Copyright (C) 2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -18,16 +18,14 @@ PRODUCT_MANUFACTURER := Xiaomi
PRODUCT_SYSTEM_NAME := mondrian_global
PRODUCT_SYSTEM_DEVICE := mondrian
PRODUCT_BUILD_PROP_OVERRIDES += \
PRIVATE_BUILD_DESC="mondrian_global-user 12 SKQ1.230401.001 V816.0.10.0.UMNMIXM release-keys" \
TARGET_DEVICE=$(PRODUCT_SYSTEM_DEVICE) \
TARGET_PRODUCT=$(PRODUCT_SYSTEM_NAME)
BUILD_FINGERPRINT := POCO/mondrian_global/mondrian:12/SKQ1.230401.001/V816.0.10.0.UMNMIXM:user/release-keys
PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
PRODUCT_BUILD_PROP_OVERRIDES += \
BuildDesc="mondrian_global-user 12 SKQ1.230401.001 OS2.0.9.0.VMNMIXM release-keys" \
BuildFingerprint=POCO/mondrian_global/mondrian:12/SKQ1.230401.001/OS2.0.9.0.VMNMIXM:user/release-keys \
DeviceProduct=$(PRODUCT_DEVICE)
TARGET_BOOT_ANIMATION_RES := 1440
# Evolution-XYZ
WITH_GMS := true
TARGET_HAS_UDFPS := true

View File

@@ -34,7 +34,7 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#===============================================================================
build_codename=`getprop vendor.media.system.build_codename`
build_codename=`getprop ro.vendor.build.version.release_or_codename`
if [ -f /sys/devices/soc0/soc_id ]; then
soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
@@ -93,25 +93,25 @@ case "$target" in
setprop vendor.media.target_variant "_diwali_v1"
fi
if [ $build_codename -le "14" ]; then
if [ $build_codename -le "15" ]; then
setprop vendor.netflix.bsp_rev "Q7450-35705-1"
fi
;;
591)
setprop vendor.media.target_variant "_ukee"
if [ $build_codename -le "14" ]; then
if [ $build_codename -le "15" ]; then
setprop vendor.netflix.bsp_rev "Q8450-34634-1"
fi
;;
530|531|540)
setprop vendor.media.target_variant "_cape"
if [ $build_codename -le "14" ]; then
if [ $build_codename -le "15" ]; then
setprop vendor.netflix.bsp_rev "Q8450-34634-1"
fi
;;
*)
setprop vendor.media.target_variant "_taro"
if [ $build_codename -le "14" ]; then
if [ $build_codename -le "15" ]; then
setprop vendor.netflix.bsp_rev "Q8450-34634-1"
fi
;;

View File

@@ -40,6 +40,13 @@ cc_library_shared {
vendor_available: true,
}
cc_library_shared {
name: "android.hardware.common-V2-ndk_platform",
shared_libs: ["android.hardware.common-V2-ndk"],
system_ext_specific: true,
vendor_available: true,
}
cc_library_shared {
name: "android.hardware.neuralnetworks-V1-ndk_platform",
shared_libs: ["android.hardware.neuralnetworks-V1-ndk"],

View File

@@ -372,6 +372,9 @@
<item>500</item>
</integer-array>
<!-- Whether to enable fingerprint unlock when screen turns off on udfps devices -->
<bool name="config_screen_off_udfps_enabled">true</bool>
<!-- Type of the udfps long press sensor. Empty if long press is not supported. -->
<string name="config_dozeUdfpsLongPressSensorType" translatable="false">org.lineageos.sensor.udfps</string>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-2024 The Evolution X Project
SPDX-License-Identifier: Apache-2.0
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- PowerOffAlarmService -->
<bool name="config_powerOffAlarmEnabled">true</bool>
</resources>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- The stable device width and height in pixels. If these aren't set to a positive number
then the device will use the width and height of the default display the first time it's
booted. -->
<integer name="config_stableDeviceDisplayWidth">1080</integer>
<integer name="config_stableDeviceDisplayHeight">2400</integer>
</resources>

View File

@@ -52,6 +52,13 @@
<!-- Whether the new Auto Selection Network UI should be shown -->
<bool name="config_enableNewAutoSelectNetworkUI">true</bool>
<!-- Number of physical SIM slots on the device. This includes both eSIM and pSIM slots, and
is not necessarily the same as the number of phones/logical modems supported by the device.
For example, a multi-sim device can have 2 phones/logical modems, but 3 physical slots,
or a single SIM device can have 1 phones/logical modems, but 2 physical slots (one eSIM
and one pSIM) -->
<integer name="config_num_physical_slots">2</integer>
<!-- If true, the display will be shifted around in ambient mode. -->
<bool name="config_enableBurnInProtection">true</bool>
@@ -61,9 +68,6 @@
<!-- Whether the device supports Smart Pixels -->
<bool name="config_supportSmartPixels">true</bool>
<!-- Whether devices suports in-display fingerprint when screen is off -->
<bool name="config_supportScreenOffUdfps">true</bool>
<!-- Whether to show peak refresh rate in display settings -->
<bool name="config_show_peak_refresh_rate_switch">true</bool>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 The LineageOS Project
Copyright (C) 2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Default for Settings.Global.DEVICE_NAME $1=MODEL-->
<string name="def_device_name_simple">POCO F5 Pro</string>
</resources>

View File

@@ -0,0 +1,10 @@
//
// Copyright (C) 2023 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "SettingsProviderResMondrianCN",
device_specific: true
}

View File

@@ -0,0 +1,12 @@
<!--
Copyright (C) 2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.providers.settings.overlay.mondriancn">
<overlay android:targetPackage="com.android.providers.settings"
android:isStatic="true"
android:priority="750"
android:requiredSystemPropertyName="ro.boot.hwc"
android:requiredSystemPropertyValue="CN"/>
</manifest>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Default for Settings.Global.DEVICE_NAME $1=MODEL-->
<string name="def_device_name_simple">Redmi K60</string>
</resources>

View File

@@ -18,4 +18,10 @@
<!-- Whether to show custom screen resolution settings -->
<bool name="config_show_custom_screen_resolution_switch">true</bool>
<!-- Whether to show volume steps settings -->
<bool name="config_supports_volume_steps" translatable="false">true</bool>
<!-- Battery Info: mAh -->
<integer name="config_battery_divider" translatable="false">1</integer>
</resources>

View File

@@ -6,4 +6,7 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Preferred max refresh rate at AOD & Ambient Display, if supported by the display. -->
<integer name="config_aodMaxRefreshRate">60</integer>
<!-- The CPU temperature divider, if needed -->
<integer name="config_cpuTempDivider">1000</integer>
</resources>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 The LineageOS Project
Copyright (C) 2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
@@ -16,4 +16,8 @@
For devices with sensors on the back of the device, this corresponds to the location on the
screen directly in front of the sensor. -->
<dimen name="physical_fingerprint_sensor_center_screen_location_y">2882px</dimen>
<!-- Microns/ums (1000 um = 1mm) per pixel for the given device. If unspecified, UI that
relies on this value will not be sized correctly. -->
<item format="float" name="pixel_pitch" type="dimen">48.28</item>
</resources>

View File

@@ -76,42 +76,29 @@
android:value="1" />
</activity>
<activity
android:name=".feas.FEASActivity"
android:label="@string/feas_title"
android:exported="true" >
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.battery" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/feas_summary" />
<meta-data
android:name="com.android.settings.order"
android:value="2" />
</activity>
<provider
android:name=".SummaryProvider"
android:authorities="org.lineageos.settings.device.summary">
</provider>
<activity
android:name=".dolby.DolbyActivity"
android:exported="true"
android:label="@string/dolby_title"
android:theme="@style/Theme.SubSettingsBase">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
</intent-filter>
<intent-filter>
<action android:name="android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.CATEGORY_CONTENT_MUSIC" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.sound" />
<meta-data android:name="com.android.settings.summary_uri"
android:value="content://org.lineageos.settings.device.summary/dolby" />
</activity>
<service
android:name=".dolby.DolbyTileService"
android:exported="true"
android:icon="@drawable/ic_dolby_qs"
android:label="@string/dolby_title"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<service
android:name=".doze.DozeService"
android:exported="true"

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000000" android:pathData="M1,4.0214C2.2767,4.0743 3.5798,3.9866 4.8252,4.2063C8.8352,4.9133 11.4129,8.3489 11.0507,12.3402C10.7124,16.0695 7.3661,18.9511 3.3484,18.9651C2.5657,18.9678 1.7827,18.9441 1,18.9324L1,4.0214Z" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
<group>
<clip-path android:pathData="M12.9332,4l10.0668,0l0,15l-10.0668,0z"/>
<path android:fillColor="#000000" android:pathData="M23,4.0924L23,18.8825C19.4973,19.298 16.399,18.6968 14.3366,15.6947C12.5148,13.043 12.4594,10.2265 14.2129,7.5241C16.244,4.394 19.3953,3.7204 23,4.0924" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
</group>
</vector>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#191c1e" android:pathData="M1,4.0214C2.2767,4.0743 3.5798,3.9866 4.8252,4.2063C8.8352,4.9133 11.4129,8.3489 11.0507,12.3402C10.7124,16.0695 7.3661,18.9511 3.3484,18.9651C2.5657,18.9678 1.7827,18.9441 1,18.9324L1,4.0214Z" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
<group>
<clip-path android:pathData="M12.9332,4l10.0668,0l0,15l-10.0668,0z"/>
<path android:fillColor="#191c1e" android:pathData="M23,4.0924L23,18.8825C19.4973,19.298 16.399,18.6968 14.3366,15.6947C12.5148,13.043 12.4594,10.2265 14.2129,7.5241C16.244,4.394 19.3953,3.7204 23,4.0924" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
</group>
</vector>

View File

@@ -101,14 +101,4 @@
<string name="refresh_title">刷新率设置</string>
<string name="refresh_summary">设置特定应用的最大刷新率</string>
<string name="refresh_default">默认</string>
<!-- Dolby Atmos -->
<string name="dolby_title">杜比全景声</string>
<string name="dolby_enable">启用杜比全景声</string>
<string name="dolby_summary">环绕音</string>
<string name="dolby_profile_title">选择配置</string>
<string name="dolby_profile_dynamic">动态</string>
<string name="dolby_off">关闭</string>
<string name="dolby_on">开启</string>
<string name="dolby_on_with_profile">使用 (%1$s)</string>
</resources>

View File

@@ -12,77 +12,6 @@
limitations under the License.
-->
<resources>
<!-- Dolby Atmos -->
<string-array name="dolby_profile_entries">
<item>@string/dolby_profile_dynamic</item>
<item>@string/dolby_profile_video</item>
<item>@string/dolby_profile_music</item>
<item>@string/dolby_profile_vocal</item>
</string-array>
<string-array name="dolby_profile_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>8</item>
</string-array>
<string-array name="dolby_preset_entries" translatable="false">
<item>@string/dolby_preset_default</item>
<item>@string/dolby_preset_rock</item>
<item>@string/dolby_preset_jazz</item>
<item>@string/dolby_preset_pop</item>
<item>@string/dolby_preset_classical</item>
<item>@string/dolby_preset_hiphop</item>
<item>@string/dolby_preset_blues</item>
<item>@string/dolby_preset_electronic</item>
<item>@string/dolby_preset_metal</item>
</string-array>
<string-array name="dolby_preset_values">
<item>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</item>
<item>60,36,12,-12,-36,-24,-12,-8,-4,-20,-36,-20,-4,-20,-36,-16,4,32,60,60</item>
<item>8,8,8,8,8,0,-8,-8,-8,-24,-40,-20,0,4,8,8,8,8,8,8</item>
<item>-13,-1,11,-25,-61,-29,3,11,19,19,19,15,11,-9,-29,-9,11,15,19,19</item>
<item>-32,-32,-32,-32,-32,-32,-32,-28,-24,-4,16,0,-16,24,64,32,0,32,64,64</item>
<item>52,28,4,-20,-44,-24,-4,-4,-4,-24,-44,-24,-4,0,4,4,4,20,36,36</item>
<item>28,28,28,-36,-100,-68,-36,4,44,28,12,4,-4,4,12,4,-4,12,28,28</item>
<item>50,34,18,2,-14,-6,2,-2,-6,-26,-46,-26,-6,-2,2,2,2,2,2,2</item>
<item>40,24,8,8,8,-4,-16,-12,-8,-32,-56,-24,8,8,8,8,8,8,8,8</item>
</string-array>
<string-array name="dolby_dialogue_entries">
<item>@string/dolby_off</item>
<item>@string/dolby_low</item>
<item>@string/dolby_standard</item>
<item>@string/dolby_medium</item>
<item>@string/dolby_high</item>
<item>@string/dolby_max</item>
</string-array>
<string-array name="dolby_dialogue_values">
<item>0</item>
<item>2</item>
<item>3</item>
<item>6</item>
<item>9</item>
<item>12</item>
</string-array>
<string-array name="dolby_stereo_entries">
<item>@string/dolby_low</item>
<item>@string/dolby_medium</item>
<item>@string/dolby_high</item>
<item>@string/dolby_max</item>
</string-array>
<string-array name="dolby_stereo_values">
<item>4</item>
<item>24</item>
<item>44</item>
<item>64</item>
</string-array>
<!-- Values for Dirac headset pref -->
<string-array name="dirac_headset_pref_entries" translatable="false">
<item>@string/dirac_headset_earbuds</item>
@@ -196,4 +125,89 @@
<item>2</item>
<item>3</item>
</string-array>
<string-array name="freq_limit_level_titles">
<item>CPU4:2573 - CPU7:2822</item>
<item>CPU4:2573 - CPU7:2822</item>
<item>CPU4:2573 - CPU7:2707</item>
<item>CPU4:2573 - CPU7:2707</item>
<item>CPU4:2458 - CPU7:2592</item>
<item>CPU4:2458 - CPU7:2592</item>
<item>CPU4:2342 - CPU7:2477</item>
<item>CPU4:2342 - CPU7:2477</item>
<item>CPU4:2342 - CPU7:2477</item>
<item>CPU4:2227 - CPU7:2362</item>
<item>CPU4:2227 - CPU7:2362</item>
<item>CPU4:2112 - CPU7:2246</item>
<item>CPU4:2112 - CPU7:2246</item>
<item>CPU4:2112 - CPU7:2246</item>
<item>CPU4:1997 - CPU7:2131</item>
<item>CPU4:1997 - CPU7:2131</item>
<item>CPU4:1882 - CPU7:1997</item>
<item>CPU4:1882 - CPU7:1997</item>
<item>CPU4:1766 - CPU7:1997</item>
<item>CPU4:1766 - CPU7:1882</item>
<item>CPU4:1651 - CPU7:1882</item>
<item>CPU4:1651 - CPU7:1766</item>
<item>CPU4:1555 - CPU7:1766</item>
<item>CPU4:1555 - CPU7:1651</item>
<item>CPU4:1440 - CPU7:1651</item>
<item>CPU4:1440 - CPU7:1536</item>
<item>CPU4:1325 - CPU7:1536</item>
<item>CPU4:1325 - CPU7:1402</item>
<item>CPU4:1210 - CPU7:1402</item>
<item>CPU4:1210 - CPU7:1286</item>
<item>CPU4:1114 - CPU7:1286</item>
<item>CPU4:1114 - CPU7:1171</item>
<item>CPU4:998 - CPU7:1171</item>
<item>CPU4:998 - CPU7:1037</item>
<item>CPU4:883 - CPU7:1037</item>
<item>CPU4:883 - CPU7:922</item>
<item>CPU4:768 - CPU7:922</item>
<item>CPU4:768 - CPU7:787</item>
<item>CPU4:634 - CPU7:787</item>
</string-array>
<string-array name="freq_limit_level_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
<item>33</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>39</item>
</string-array>
</resources>

View File

@@ -26,48 +26,12 @@
<string name="thermal_gaming">Gaming</string>
<string name="thermal_streaming">Streaming</string>
<!-- Dolby Atmos -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_enable">Use Dolby Atmos</string>
<string name="dolby_profile_title">Choose a profile</string>
<string name="dolby_off">Off</string>
<string name="dolby_on">On</string>
<string name="dolby_low">Low</string>
<string name="dolby_standard">Standard</string>
<string name="dolby_medium">Medium</string>
<string name="dolby_high">High</string>
<string name="dolby_max">Max</string>
<string name="dolby_unknown">Unknown</string>
<string name="dolby_on_with_profile">On (%1$s)</string>
<string name="dolby_summary">Surround sound</string>
<string name="dolby_preset_title">Choose a preset</string>
<string name="dolby_category_settings">Settings</string>
<string name="dolby_bass_enhancer">Bass enhancer</string>
<string name="dolby_dialogue_enhancer">Dialogue enhancer</string>
<string name="dolby_virtualizer">Surround virtualizer</string>
<string name="dolby_stereo_widening">Stereo widening</string>
<string name="dolby_volume_leveler">Volume leveler</string>
<string name="dolby_connect_headphones">Connect headphones</string>
<string name="dolby_reset_profile">Reset to defaults</string>
<string name="dolby_reset_profile_toast">Succesfully reset settings for %1$s profile</string>
<!-- Dolby Atmos: Sound Profiles -->
<string name="dolby_profile_dynamic">Dynamic</string>
<string name="dolby_preset">Equalizer preset</string>
<string name="dolby_profile_music">Music</string>
<string name="dolby_profile_video">Video</string>
<string name="dolby_profile_vocal">Voice</string>
<!-- Dolby Atmos: Equalizer presets -->
<string name="dolby_preset_default">Default</string>
<string name="dolby_preset_rock">Rock</string>
<string name="dolby_preset_jazz">Jazz</string>
<string name="dolby_preset_pop">Pop</string>
<string name="dolby_preset_classical">Classical</string>
<string name="dolby_preset_hiphop">Hip Hop</string>
<string name="dolby_preset_blues">Blues</string>
<string name="dolby_preset_electronic">Electronic</string>
<string name="dolby_preset_metal">Metal</string>
<!-- FEAS -->
<string name="feas_title">FEAS 2.2</string>
<string name="feas_enable_title">Enable FEAS</string>
<string name="feas_summary">Optimizes power consumption for each frame</string>
<string name="feas_min_freq_limit_level_title">Min freq limit level (MHz)</string>
<string name="feas_max_freq_limit_level_title">Max freq limit level (MHz)</string>
<!-- Per-app refresh rate -->
<string name="refresh_title">Per-app refresh rate</string>

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License"
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/dolby_title">
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="true"
android:key="dolby_enable"
android:title="@string/dolby_enable" />
<ListPreference
android:key="dolby_profile"
android:entries="@array/dolby_profile_entries"
android:entryValues="@array/dolby_profile_values"
android:defaultValue="0"
android:title="@string/dolby_profile_title"
android:summary="%s"
android:icon="@drawable/ic_dolby" />
<PreferenceCategory
android:title="@string/dolby_category_settings">
<ListPreference
android:key="dolby_preset"
android:entries="@array/dolby_preset_entries"
android:entryValues="@array/dolby_preset_values"
android:title="@string/dolby_preset" />
<SwitchPreference
android:key="dolby_virtualizer"
android:title="@string/dolby_virtualizer" />
<ListPreference
android:key="dolby_stereo"
android:entries="@array/dolby_stereo_entries"
android:entryValues="@array/dolby_stereo_values"
android:defaultValue="4"
android:title="@string/dolby_stereo_widening"
android:dependency="dolby_virtualizer" />
<ListPreference
android:key="dolby_dialogue"
android:entries="@array/dolby_dialogue_entries"
android:entryValues="@array/dolby_dialogue_values"
android:title="@string/dolby_dialogue_enhancer" />
<SwitchPreference
android:key="dolby_bass"
android:title="@string/dolby_bass_enhancer" />
<SwitchPreference
android:key="dolby_volume"
android:title="@string/dolby_volume_leveler" />
<Preference
android:key="dolby_reset"
android:title="@string/dolby_reset_profile" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2024 The LineageOS Project
2024 Flakeforever
Licensed under the Apache License, Version 2.0 (the "License"
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/feas_title">
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="feas_enable"
android:title="@string/feas_enable_title" />
<ListPreference
android:key="min_freq_limit_level"
android:title="@string/feas_min_freq_limit_level_title"
android:entries="@array/freq_limit_level_titles"
android:entryValues="@array/freq_limit_level_values"
android:singleLine="false"
android:defaultValue="0"
android:summary="%s" />
<ListPreference
android:key="max_freq_limit_level"
android:title="@string/feas_max_freq_limit_level_title"
android:entries="@array/freq_limit_level_titles"
android:entryValues="@array/freq_limit_level_values"
android:defaultValue="0"
android:summary="%s" />
</PreferenceScreen>

View File

@@ -23,11 +23,11 @@ import android.view.Display.HdrCapabilities;
import org.lineageos.settings.display.ColorService;
import org.lineageos.settings.dirac.DiracUtils;
import org.lineageos.settings.dolby.DolbyUtils;
import org.lineageos.settings.doze.AodBrightnessService;
import org.lineageos.settings.doze.DozeUtils;
import org.lineageos.settings.doze.PocketService;
import org.lineageos.settings.display.ColorService;
import org.lineageos.settings.feas.FEASUtils;
import org.lineageos.settings.thermal.ThermalUtils;
import org.lineageos.settings.refreshrate.RefreshUtils;
@@ -47,9 +47,6 @@ public class BootCompletedReceiver extends BroadcastReceiver {
// Dirac
DiracUtils.initialize(context);
// Dolby Atmos
DolbyUtils.getInstance(context);
// Doze
DozeUtils.checkDozeService(context);
@@ -70,5 +67,9 @@ public class BootCompletedReceiver extends BroadcastReceiver {
displayManager.overrideHdrTypes(Display.DEFAULT_DISPLAY, new int[]{
HdrCapabilities.HDR_TYPE_DOLBY_VISION, HdrCapabilities.HDR_TYPE_HDR10,
HdrCapabilities.HDR_TYPE_HLG, HdrCapabilities.HDR_TYPE_HDR10_PLUS});
// FEAS
final FEASUtils mFEASUtils = new FEASUtils(context);
mFEASUtils.initialize();
}
}

View File

@@ -26,26 +26,16 @@ import android.net.Uri;
import android.os.Bundle;
import org.lineageos.settings.R;
import org.lineageos.settings.dolby.DolbyUtils;
/** Provide preference summary for injected items. */
public class SummaryProvider extends ContentProvider {
private static final String KEY_DOLBY = "dolby";
@Override
public Bundle call(String method, String uri, Bundle extras) {
final Bundle bundle = new Bundle();
String summary;
switch (method) {
case KEY_DOLBY:
summary = getDolbySummary();
break;
default:
throw new IllegalArgumentException("Unknown method: " + method);
}
bundle.putString(META_DATA_PREFERENCE_SUMMARY, summary);
return bundle;
}
@Override
@@ -78,18 +68,4 @@ public class SummaryProvider extends ContentProvider {
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException();
}
private String getDolbySummary() {
final DolbyUtils dolbyUtils = DolbyUtils.getInstance(getContext());
final boolean dsOn = dolbyUtils.getDsOn();
if (!dsOn) {
return getContext().getString(R.string.dolby_off);
}
final String profileName = dolbyUtils.getProfileName();
if (profileName == null) {
return getContext().getString(R.string.dolby_on);
} else {
return getContext().getString(R.string.dolby_on_with_profile, profileName);
}
}
}

View File

@@ -1,160 +0,0 @@
/*
* Copyright (C) 2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.dolby;
import android.media.audiofx.AudioEffect;
import android.util.Log;
import org.lineageos.settings.dolby.DolbyConstants.DsParam;
import java.util.UUID;
class DolbyAtmos extends AudioEffect {
private static final String TAG = "DolbyAtmos";
private static final UUID EFFECT_TYPE_DAP =
UUID.fromString("9d4921da-8225-4f29-aefa-39537a04bcaa");
private static final int
EFFECT_PARAM_CPDP_VALUES = 5,
EFFECT_PARAM_ENABLE = 0,
EFFECT_PARAM_PROFILE = 0xA000000,
EFFECT_PARAM_SET_PROFILE_PARAMETER = 0x1000000,
EFFECT_PARAM_GET_PROFILE_PARAMETER = 0x1000005,
EFFECT_PARAM_RESET_PROFILE_SETTINGS = 0xC000000;
DolbyAtmos(int priority, int audioSession) {
super(EFFECT_TYPE_NULL, EFFECT_TYPE_DAP, priority, audioSession);
}
private static int int32ToByteArray(int value, byte[] dst, int index) {
dst[index++] = (byte) (value & 0xff);
dst[index++] = (byte) ((value >>> 8) & 0xff);
dst[index++] = (byte) ((value >>> 16) & 0xff);
dst[index] = (byte) ((value >>> 24) & 0xff);
return 4;
}
private static int byteArrayToInt32(byte[] ba) {
return ((ba[3] & 0xff) << 24) | ((ba[2] & 0xff) << 16)
| ((ba[1] & 0xff) << 8) | (ba[0] & 0xff);
}
private static int int32ArrayToByteArray(int[] src, byte[] dst, int index) {
for (int x : src) {
dst[index++] = (byte) ((x >>> 0) & 0xff);
dst[index++] = (byte) ((x >>> 8) & 0xff);
dst[index++] = (byte) ((x >>> 16) & 0xff);
dst[index++] = (byte) ((x >>> 24) & 0xff);
}
return src.length << 2;
}
private static int[] byteArrayToInt32Array(byte[] ba, int dstLength) {
int srcLength = ba.length >> 2;
if (dstLength > srcLength) {
dstLength = srcLength;
}
int[] dst = new int[dstLength];
for (int i = 0; i < dstLength; i++) {
dst[i] = ((ba[i * 4 + 3] & 0xff) << 24) | ((ba[i * 4 + 2] & 0xff) << 16)
| ((ba[i * 4 + 1] & 0xff) << 8) | (ba[i * 4] & 0xff);
}
return dst;
}
private void setIntParam(int param, int value) {
byte[] buf = new byte[12];
int i = int32ToByteArray(param, buf, 0);
int32ToByteArray(value, buf, i + int32ToByteArray(1, buf, i));
checkStatus(setParameter(EFFECT_PARAM_CPDP_VALUES, buf));
}
private int getIntParam(int param) {
byte[] buf = new byte[12];
int32ToByteArray(param, buf, 0);
checkStatus(getParameter(EFFECT_PARAM_CPDP_VALUES + param, buf));
return byteArrayToInt32(buf);
}
void setDsOn(boolean on) {
setIntParam(EFFECT_PARAM_ENABLE, on ? 1 : 0);
super.setEnabled(on);
}
boolean getDsOn() {
return getIntParam(EFFECT_PARAM_ENABLE) == 1;
}
void setProfile(int index) {
setIntParam(EFFECT_PARAM_PROFILE, index);
}
int getProfile() {
return getIntParam(EFFECT_PARAM_PROFILE);
}
void resetProfileSpecificSettings() {
int profile = getProfile();
Log.d(TAG, "resetProfileSpecificSettings: profile=" + profile);
setIntParam(EFFECT_PARAM_RESET_PROFILE_SETTINGS, profile);
}
void setDapParameter(int profile, DsParam param, int values[]) {
Log.d(TAG, "setDapParameter: profile=" + profile + " param=" + param);
int length = values.length;
byte[] buf = new byte[(length + 4) * 4];
int i = int32ToByteArray(EFFECT_PARAM_SET_PROFILE_PARAMETER, buf, 0);
int i2 = i + int32ToByteArray(length + 1, buf, i);
int i3 = i2 + int32ToByteArray(profile, buf, i2);
int32ArrayToByteArray(values, buf, i3 + int32ToByteArray(param.id, buf, i3));
checkStatus(setParameter(EFFECT_PARAM_CPDP_VALUES, buf));
}
void setDapParameter(DsParam param, int values[]) {
setDapParameter(getProfile(), param, values);
}
void setDapParameterBool(DsParam param, boolean enable) {
setDapParameter(param, new int[]{enable ? 1 : 0});
}
void setDapParameterInt(DsParam param, int value) {
setDapParameter(param, new int[]{value});
}
int[] getDapParameter(int profile, DsParam param) {
Log.d(TAG, "getDapParameter: profile=" + profile + " param=" + param);
int length = param.length;
byte[] buf = new byte[(length + 2) * 4];
int i = (param.id << 16) + EFFECT_PARAM_GET_PROFILE_PARAMETER;
checkStatus(getParameter(i + (profile << 8), buf));
return byteArrayToInt32Array(buf, length);
}
int[] getDapParameter(DsParam param) {
return getDapParameter(getProfile(), param);
}
boolean getDapParameterBool(DsParam param) {
return getDapParameter(param)[0] == 1;
}
int getDapParameterInt(DsParam param) {
return getDapParameter(param)[0];
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (C) 2023 Paranoid Android
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.dolby;
class DolbyConstants {
enum DsParam {
HEADPHONE_VIRTUALIZER(101),
SPEAKER_VIRTUALIZER(102),
VOLUME_LEVELER_ENABLE(103),
DIALOGUE_ENHANCER_ENABLE(105),
DIALOGUE_ENHANCER_AMOUNT(108),
GEQ_BAND_GAINS(110, 20),
BASS_ENHANCER_ENABLE(111),
STEREO_WIDENING_AMOUNT(113),
VOLUME_LEVELER_AMOUNT(116);
public int id, length;
DsParam(int id, int length) {
this.id = id;
this.length = length;
}
DsParam(int id) {
this(id, 1);
}
public String toString() {
return String.format("%s(%s)", name(), id);
}
}
}

View File

@@ -1,264 +0,0 @@
/*
* Copyright (C) 2018,2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.dolby;
import android.media.AudioAttributes;
import android.media.AudioDeviceAttributes;
import android.media.AudioDeviceCallback;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Toast;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import com.android.settingslib.widget.MainSwitchPreference;
import org.lineageos.settings.R;
import java.util.Arrays;
import java.util.List;
public class DolbySettingsFragment extends PreferenceFragment implements
OnPreferenceChangeListener, OnCheckedChangeListener {
private static final String TAG = "DolbySettingsFragment";
private static final AudioAttributes ATTRIBUTES_MEDIA = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.build();
public static final String PREF_ENABLE = "dolby_enable";
public static final String PREF_PROFILE = "dolby_profile";
public static final String PREF_PRESET = "dolby_preset";
public static final String PREF_VIRTUALIZER = "dolby_virtualizer";
public static final String PREF_STEREO = "dolby_stereo";
public static final String PREF_DIALOGUE = "dolby_dialogue";
public static final String PREF_BASS = "dolby_bass";
public static final String PREF_VOLUME = "dolby_volume";
public static final String PREF_RESET = "dolby_reset";
private MainSwitchPreference mSwitchBar;
private ListPreference mProfilePref, mPresetPref, mStereoPref, mDialoguePref;
private SwitchPreference mBassPref, mVirtualizerPref, mVolumePref;
private Preference mResetPref;
private CharSequence[] mPresets, mDeValues, mSwValues;
private DolbyUtils mDolbyUtils;
private AudioManager mAudioManager;
private boolean mDsOn, mIsOnSpeaker;
private int mCurrentProfile = -1;
private final Handler mHandler = new Handler();
private final AudioDeviceCallback mAudioDeviceCallback = new AudioDeviceCallback() {
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
updateSpeakerState(false);
}
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
updateSpeakerState(false);
}
};
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.dolby_settings);
mAudioManager = getActivity().getSystemService(AudioManager.class);
mDolbyUtils = DolbyUtils.getInstance(getActivity());
mDsOn = mDolbyUtils.getDsOn();
mSwitchBar = (MainSwitchPreference) findPreference(PREF_ENABLE);
mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.setChecked(mDsOn);
mProfilePref = (ListPreference) findPreference(PREF_PROFILE);
mProfilePref.setOnPreferenceChangeListener(this);
mProfilePref.setEnabled(mDsOn);
final CharSequence[] profiles = mProfilePref.getEntryValues();
final int profile = mDolbyUtils.getProfile();
if (Arrays.asList(profiles).contains(Integer.toString(profile))) {
mCurrentProfile = profile;
mProfilePref.setSummary("%s");
mProfilePref.setValue(Integer.toString(profile));
} else {
mCurrentProfile = -1;
mProfilePref.setSummary(getActivity().getString(R.string.dolby_unknown));
}
mPresetPref = (ListPreference) findPreference(PREF_PRESET);
mPresetPref.setOnPreferenceChangeListener(this);
mPresets = mPresetPref.getEntryValues();
mVirtualizerPref = (SwitchPreference) findPreference(PREF_VIRTUALIZER);
mVirtualizerPref.setOnPreferenceChangeListener(this);
mStereoPref = (ListPreference) findPreference(PREF_STEREO);
mStereoPref.setOnPreferenceChangeListener(this);
mSwValues = mStereoPref.getEntryValues();
mDialoguePref = (ListPreference) findPreference(PREF_DIALOGUE);
mDialoguePref.setOnPreferenceChangeListener(this);
mDeValues = mDialoguePref.getEntryValues();
mBassPref = (SwitchPreference) findPreference(PREF_BASS);
mBassPref.setOnPreferenceChangeListener(this);
mVolumePref = (SwitchPreference) findPreference(PREF_VOLUME);
mVolumePref.setOnPreferenceChangeListener(this);
mResetPref = (Preference) findPreference(PREF_RESET);
mResetPref.setOnPreferenceClickListener(p -> {
mDolbyUtils.resetProfileSpecificSettings();
updateProfileSpecificPrefs();
Toast.makeText(getActivity(),
getActivity().getString(R.string.dolby_reset_profile_toast,
mProfilePref.getSummary()), Toast.LENGTH_SHORT).show();
return true;
});
mAudioManager.registerAudioDeviceCallback(mAudioDeviceCallback, mHandler);
updateSpeakerState(true);
}
@Override
public void onDestroyView() {
mAudioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback);
super.onDestroyView();
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
switch (preference.getKey()) {
case PREF_PROFILE:
mCurrentProfile = Integer.parseInt((newValue.toString()));
mDolbyUtils.setProfile(mCurrentProfile);
updateProfileSpecificPrefs();
return true;
case PREF_PRESET:
mDolbyUtils.setPreset(newValue.toString());
return true;
case PREF_VIRTUALIZER:
if (mIsOnSpeaker)
mDolbyUtils.setSpeakerVirtualizerEnabled((Boolean) newValue);
else
mDolbyUtils.setHeadphoneVirtualizerEnabled((Boolean) newValue);
return true;
case PREF_STEREO:
mDolbyUtils.setStereoWideningAmount(Integer.parseInt((newValue.toString())));
return true;
case PREF_DIALOGUE:
mDolbyUtils.setDialogueEnhancerAmount(Integer.parseInt((newValue.toString())));
return true;
case PREF_BASS:
mDolbyUtils.setBassEnhancerEnabled((Boolean) newValue);
return true;
case PREF_VOLUME:
mDolbyUtils.setVolumeLevelerEnabled((Boolean) newValue);
return true;
default:
return false;
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mDsOn = isChecked;
mDolbyUtils.setDsOn(isChecked);
mProfilePref.setEnabled(isChecked);
mResetPref.setEnabled(isChecked);
updateProfileSpecificPrefs();
}
private void updateSpeakerState(boolean force) {
final AudioDeviceAttributes device =
mAudioManager.getDevicesForAttributes(ATTRIBUTES_MEDIA).get(0);
final boolean isOnSpeaker = (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER);
if (mIsOnSpeaker != isOnSpeaker || force) {
Log.d(TAG, "updateSpeakerState: " + mIsOnSpeaker);
mIsOnSpeaker = isOnSpeaker;
updateProfileSpecificPrefs();
}
}
private void updateProfileSpecificPrefs() {
final String unknownRes = getActivity().getString(R.string.dolby_unknown);
final String headphoneRes = getActivity().getString(R.string.dolby_connect_headphones);
Log.d(TAG, "updateProfileSpecificPrefs: mDsOn=" + mDsOn
+ " mCurrentProfile=" + mCurrentProfile + " mIsOnSpeaker=" + mIsOnSpeaker);
final boolean enable = mDsOn && (mCurrentProfile != -1);
mPresetPref.setEnabled(enable);
mVirtualizerPref.setEnabled(enable);
mDialoguePref.setEnabled(enable);
mVolumePref.setEnabled(enable);
mResetPref.setEnabled(enable);
mStereoPref.setEnabled(enable && !mIsOnSpeaker);
mBassPref.setEnabled(enable && !mIsOnSpeaker);
if (!enable) return;
final String preset = mDolbyUtils.getPreset();
if (Arrays.asList(mPresets).contains(preset)) {
mPresetPref.setSummary("%s");
mPresetPref.setValue(preset);
} else {
mPresetPref.setSummary(unknownRes);
}
final String deValue = Integer.toString(mDolbyUtils.getDialogueEnhancerAmount());
if (Arrays.asList(mDeValues).contains(deValue)) {
mDialoguePref.setSummary("%s");
mDialoguePref.setValue(deValue);
} else {
mDialoguePref.setSummary(unknownRes);
}
mVirtualizerPref.setChecked(mIsOnSpeaker ? mDolbyUtils.getSpeakerVirtualizerEnabled()
: mDolbyUtils.getHeadphoneVirtualizerEnabled());
mVolumePref.setChecked(mDolbyUtils.getVolumeLevelerEnabled());
if (mIsOnSpeaker) {
mStereoPref.setSummary(headphoneRes);
mBassPref.setSummary(headphoneRes);
return;
}
final String swValue = Integer.toString(mDolbyUtils.getStereoWideningAmount());
if (Arrays.asList(mSwValues).contains(swValue)) {
mStereoPref.setSummary("%s");
mStereoPref.setValue(swValue);
} else {
mStereoPref.setSummary(unknownRes);
}
mBassPref.setChecked(mDolbyUtils.getBassEnhancerEnabled());
mBassPref.setSummary(null);
}
}

View File

@@ -1,36 +0,0 @@
package org.lineageos.settings.dolby;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
public class DolbyTileService extends TileService {
@Override
public void onStartListening() {
Tile tile = getQsTile();
DolbyUtils dolbyUtils = DolbyUtils.getInstance(getApplicationContext());
if (dolbyUtils.getDsOn()) {
tile.setState(Tile.STATE_ACTIVE);
} else {
tile.setState(Tile.STATE_INACTIVE);
}
tile.setSubtitle(dolbyUtils.getProfileName());
tile.updateTile();
super.onStartListening();
}
@Override
public void onClick() {
Tile tile = getQsTile();
DolbyUtils dolbyUtils = DolbyUtils.getInstance(getApplicationContext());
if (dolbyUtils.getDsOn()) {
dolbyUtils.setDsOn(false);
tile.setState(Tile.STATE_INACTIVE);
} else {
dolbyUtils.setDsOn(true);
tile.setState(Tile.STATE_ACTIVE);
}
tile.updateTile();
super.onClick();
}
}

View File

@@ -1,190 +0,0 @@
/*
* Copyright (C) 2018,2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.dolby;
import android.content.Context;
import android.util.Log;
import org.lineageos.settings.R;
import org.lineageos.settings.dolby.DolbyConstants.DsParam;
import java.util.Arrays;
import java.util.List;
public final class DolbyUtils {
private static final String TAG = "DolbyUtils";
private static final int EFFECT_PRIORITY = 100;
private static final int VOLUME_LEVELER_AMOUNT = 2;
private static DolbyUtils mInstance;
private DolbyAtmos mDolbyAtmos;
private Context mContext;
private DolbyUtils(Context context) {
mContext = context;
mDolbyAtmos = new DolbyAtmos(EFFECT_PRIORITY, 0);
mDolbyAtmos.setEnabled(mDolbyAtmos.getDsOn());
}
public static synchronized DolbyUtils getInstance(Context context) {
if (mInstance == null) {
mInstance = new DolbyUtils(context);
}
return mInstance;
}
private void checkEffect() {
if (!mDolbyAtmos.hasControl()) {
Log.w(TAG, "lost control, recreating effect");
mDolbyAtmos.release();
mDolbyAtmos = new DolbyAtmos(EFFECT_PRIORITY, 0);
}
}
public void setDsOn(boolean on) {
checkEffect();
Log.d(TAG, "setDsOn: " + on);
mDolbyAtmos.setDsOn(on);
}
public boolean getDsOn() {
boolean on = mDolbyAtmos.getDsOn();
Log.d(TAG, "getDsOn: " + on);
return on;
}
public void setProfile(int index) {
checkEffect();
Log.d(TAG, "setProfile: " + index);
mDolbyAtmos.setProfile(index);
}
public int getProfile() {
int profile = mDolbyAtmos.getProfile();
Log.d(TAG, "getProfile: " + profile);
return profile;
}
public String getProfileName() {
String profile = Integer.toString(mDolbyAtmos.getProfile());
List<String> profiles = Arrays.asList(mContext.getResources().getStringArray(
R.array.dolby_profile_values));
int profileIndex = profiles.indexOf(profile);
Log.d(TAG, "getProfileName: profile=" + profile + " index=" + profileIndex);
return profileIndex == -1 ? null : mContext.getResources().getStringArray(
R.array.dolby_profile_entries)[profileIndex];
}
public void resetProfileSpecificSettings() {
checkEffect();
mDolbyAtmos.resetProfileSpecificSettings();
}
public void setPreset(String preset) {
checkEffect();
int[] gains = Arrays.stream(preset.split(",")).mapToInt(Integer::parseInt).toArray();
Log.d(TAG, "setPreset: " + Arrays.toString(gains));
mDolbyAtmos.setDapParameter(DsParam.GEQ_BAND_GAINS, gains);
}
public String getPreset() {
int[] gains = mDolbyAtmos.getDapParameter(DsParam.GEQ_BAND_GAINS);
Log.d(TAG, "getPreset: " + Arrays.toString(gains));
String[] preset = Arrays.stream(gains).mapToObj(String::valueOf).toArray(String[]::new);
return String.join(",", preset);
}
public void setHeadphoneVirtualizerEnabled(boolean enable) {
checkEffect();
Log.d(TAG, "setHeadphoneVirtualizerEnabled: " + enable);
mDolbyAtmos.setDapParameterBool(DsParam.HEADPHONE_VIRTUALIZER, enable);
}
public boolean getHeadphoneVirtualizerEnabled() {
boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.HEADPHONE_VIRTUALIZER);
Log.d(TAG, "getHeadphoneVirtualizerEnabled: " + enabled);
return enabled;
}
public void setSpeakerVirtualizerEnabled(boolean enable) {
checkEffect();
Log.d(TAG, "setSpeakerVirtualizerEnabled: " + enable);
mDolbyAtmos.setDapParameterBool(DsParam.SPEAKER_VIRTUALIZER, enable);
}
public boolean getSpeakerVirtualizerEnabled() {
boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.SPEAKER_VIRTUALIZER);
Log.d(TAG, "getSpeakerVirtualizerEnabled: " + enabled);
return enabled;
}
public void setStereoWideningAmount(int amount) {
checkEffect();
Log.d(TAG, "setStereoWideningAmount: " + amount);
mDolbyAtmos.setDapParameterInt(DsParam.STEREO_WIDENING_AMOUNT, amount);
}
public int getStereoWideningAmount() {
int amount = mDolbyAtmos.getDapParameterInt(DsParam.STEREO_WIDENING_AMOUNT);
Log.d(TAG, "getStereoWideningAmount: " + amount);
return amount;
}
public void setDialogueEnhancerAmount(int amount) {
checkEffect();
Log.d(TAG, "setDialogueEnhancerAmount: " + amount);
mDolbyAtmos.setDapParameterBool(DsParam.DIALOGUE_ENHANCER_ENABLE, amount > 0);
mDolbyAtmos.setDapParameterInt(DsParam.DIALOGUE_ENHANCER_AMOUNT, amount);
}
public int getDialogueEnhancerAmount() {
boolean enabled = mDolbyAtmos.getDapParameterBool(
DsParam.DIALOGUE_ENHANCER_ENABLE);
int amount = enabled ? mDolbyAtmos.getDapParameterInt(
DsParam.DIALOGUE_ENHANCER_AMOUNT) : 0;
Log.d(TAG, "getDialogueEnhancerAmount: " + enabled + " amount=" + amount);
return amount;
}
public void setBassEnhancerEnabled(boolean enable) {
checkEffect();
Log.d(TAG, "setBassEnhancerEnabled: " + enable);
mDolbyAtmos.setDapParameterBool(DsParam.BASS_ENHANCER_ENABLE, enable);
}
public boolean getBassEnhancerEnabled() {
boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.BASS_ENHANCER_ENABLE);
Log.d(TAG, "getBassEnhancerEnabled: " + enabled);
return enabled;
}
public void setVolumeLevelerEnabled(boolean enable) {
checkEffect();
Log.d(TAG, "setVolumeLevelerEnabled: " + enable);
mDolbyAtmos.setDapParameterBool(DsParam.VOLUME_LEVELER_ENABLE, enable);
mDolbyAtmos.setDapParameterInt(DsParam.VOLUME_LEVELER_AMOUNT,
enable ? VOLUME_LEVELER_AMOUNT : 0);
}
public boolean getVolumeLevelerEnabled() {
boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.VOLUME_LEVELER_ENABLE);
int amount = mDolbyAtmos.getDapParameterInt(DsParam.VOLUME_LEVELER_AMOUNT);
Log.d(TAG, "getVolumeLevelerEnabled: " + enabled + " amount=" + amount);
return enabled && (amount == VOLUME_LEVELER_AMOUNT);
}
}

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The LineageOS Project
* Copyright (C) 2024 The LineageOS Project
* 2024 Flakeforever
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,21 +15,21 @@
* limitations under the License.
*/
package org.lineageos.settings.dolby;
package org.lineageos.settings.feas;
import android.os.Bundle;
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
public class DolbyActivity extends CollapsingToolbarBaseActivity {
public class FEASActivity extends CollapsingToolbarBaseActivity {
private static final String TAG_DOLBY = "dolby";
private static final String TAG_FEAS = "FEAS";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame,
new DolbySettingsFragment(), TAG_DOLBY).commit();
new FEASFragment(), TAG_FEAS).commit();
}
}

View File

@@ -0,0 +1,117 @@
/*
* Copyright (C) 2024 The LineageOS Project
* 2024 Flakeforever
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.feas;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.text.InputType;
import android.text.InputFilter;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import android.util.Log;
import com.android.settingslib.widget.MainSwitchPreference;
import org.lineageos.settings.R;
public class FEASFragment extends PreferenceFragment
implements OnPreferenceChangeListener, OnCheckedChangeListener {
private static final String TAG = "FEAS";
private MainSwitchPreference mSwitchBar;
private ListPreference mMinFreqLimitLevel;
private ListPreference mMaxFreqLimitLevel;
private FEASUtils mFEASUtils;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.feas_settings);
mFEASUtils = new FEASUtils(getActivity());
mSwitchBar = (MainSwitchPreference) findPreference("feas_enable");
mSwitchBar.setOnPreferenceChangeListener(this);
mSwitchBar.setChecked(mFEASUtils.getValue(
mFEASUtils.PERFMGR_ENABLE_PATH, mFEASUtils.PERFMGR_ENABLE) == 1);
int minFreqLimitLevel = mFEASUtils.getValue(
mFEASUtils.MIN_FREQ_PATH, mFEASUtils.PERFMGR_MIN_FREQ);
int maxFreqLimitLevel = mFEASUtils.getValue(
mFEASUtils.MAX_FREQ_PATH, mFEASUtils.PERFMGR_MAX_FREQ);
mMinFreqLimitLevel = (ListPreference) findPreference("min_freq_limit_level");
mMinFreqLimitLevel.setValue(String.valueOf(minFreqLimitLevel));
mMaxFreqLimitLevel = (ListPreference) findPreference("max_freq_limit_level");
mMaxFreqLimitLevel.setValue(String.valueOf(maxFreqLimitLevel));
for (Preference preference : new Preference[]{
mMinFreqLimitLevel, mMaxFreqLimitLevel
}) {
preference.setOnPreferenceChangeListener(this);
}
updateDependencies();
}
private void updateDependencies() {
boolean enabled = mSwitchBar.isChecked();
mMinFreqLimitLevel.setEnabled(enabled);
mMaxFreqLimitLevel.setEnabled(enabled);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mSwitchBar) {
boolean enabled = (Boolean) newValue;
updateDependencies();
return mFEASUtils.putValue(
mFEASUtils.PERFMGR_ENABLE_PATH, mFEASUtils.PERFMGR_ENABLE, enabled? "1" : "0");
}
if (preference == mMinFreqLimitLevel) {
String value = newValue.toString();
return mFEASUtils.putValue(
mFEASUtils.MIN_FREQ_PATH, mFEASUtils.PERFMGR_MIN_FREQ, value);
}
if (preference == mMaxFreqLimitLevel) {
String value = newValue.toString();
return mFEASUtils.putValue(
mFEASUtils.MAX_FREQ_PATH, mFEASUtils.PERFMGR_MAX_FREQ, value);
}
return true;
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updateDependencies();
}
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2024 The LineageOS Project
* 2024 Flakeforever
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.feas;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import androidx.preference.PreferenceManager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import org.lineageos.settings.utils.FileUtils;
public class FEASUtils {
public static final String PERFMGR_ENABLE = "perfmgr_enable";
public static final String PERFMGR_MIN_FREQ = "min_freq_limit_level";
public static final String PERFMGR_MAX_FREQ = "max_freq_limit_level";
public static final String PERFMGR_ENABLE_PATH = "/sys/module/perfmgr/parameters/perfmgr_enable";
public static final String MIN_FREQ_PATH = "/sys/module/perfmgr/parameters/min_freq_limit_level";
public static final String MAX_FREQ_PATH = "/sys/module/perfmgr/parameters/max_freq_limit_level";
private SharedPreferences mSharedPrefs;
private boolean mInitialized;
public FEASUtils(Context context) {
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
}
public void initialize() {
if (!mInitialized) {
getValue(MIN_FREQ_PATH, PERFMGR_ENABLE);
getValue(MAX_FREQ_PATH, PERFMGR_MAX_FREQ);
getValue(PERFMGR_ENABLE_PATH, PERFMGR_ENABLE);
mInitialized = true;
}
}
public int getValue(String PATH, String KEY) {
String value = mSharedPrefs.getString(KEY, null);
String currentValue = FileUtils.readOneLine(PATH);
int ret = 0;
if (value == null || value.isEmpty()) {
mSharedPrefs.edit().putString(KEY, currentValue).apply();
return Integer.parseInt(currentValue.trim());
}
ret = Integer.parseInt(value.trim());
if (!value.equals(currentValue)) {
putValue(PATH, KEY, value);
}
return ret;
}
public boolean putValue(String PATH, String KEY, String value) {
mSharedPrefs.edit().putString(KEY, value).apply();
return FileUtils.writeLine(PATH, value);
}
}

View File

@@ -1,32 +0,0 @@
//
// Copyright (C) 2020 The LineageOS Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
cc_binary {
relative_install_path: "hw",
defaults: ["hidl_defaults"],
name: "vendor.lineage.powershare@1.0-service.xiaomi_mondrian",
init_rc: ["vendor.lineage.powershare@1.0-service.xiaomi_mondrian.rc"],
vintf_fragments: ["vendor.lineage.powershare@1.0-service.xiaomi_mondrian.xml"],
srcs: ["service.cpp", "PowerShare.cpp"],
shared_libs: [
"libbase",
"libhardware",
"libhidlbase",
"liblog",
"libutils",
"vendor.lineage.powershare@1.0",
],
proprietary: true,
}

View File

@@ -1,72 +0,0 @@
/*
* Copyright (C) 2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "PowerShareService"
#include "PowerShare.h"
#include <hidl/HidlTransportSupport.h>
#include <fstream>
namespace vendor {
namespace lineage {
namespace powershare {
namespace V1_0 {
namespace implementation {
#define WIRELESS_TX_ENABLE_PATH "/sys/class/qcom-battery/reverse_chg_mode"
/*
* Write value to path and close file.
*/
template <typename T>
static void set(const std::string& path, const T& value) {
std::ofstream file(path);
file << value;
}
template <typename T>
static T get(const std::string& path, const T& def) {
std::ifstream file(path);
T result;
file >> result;
return file.fail() ? def : result;
}
Return<bool> PowerShare::isEnabled() {
const auto value = get<std::string>(WIRELESS_TX_ENABLE_PATH, "");
return !(value == "disable" || value == "0");
}
Return<bool> PowerShare::setEnabled(bool enable) {
set(WIRELESS_TX_ENABLE_PATH, enable ? 1 : 0);
return isEnabled();
}
Return<uint32_t> PowerShare::getMinBattery() {
return 0;
}
Return<uint32_t> PowerShare::setMinBattery(uint32_t) {
return getMinBattery();
}
} // namespace implementation
} // namespace V1_0
} // namespace powershare
} // namespace lineage
} // namespace vendor

View File

@@ -1,45 +0,0 @@
/*
* Copyright (C) 2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VENDOR_LINEAGE_POWERSHARE_V1_0_POWERSHARE_H
#define VENDOR_LINEAGE_POWERSHARE_V1_0_POWERSHARE_H
#include <vendor/lineage/powershare/1.0/IPowerShare.h>
namespace vendor {
namespace lineage {
namespace powershare {
namespace V1_0 {
namespace implementation {
using ::android::sp;
using ::android::hardware::Return;
using ::android::hardware::Void;
class PowerShare : public IPowerShare {
public:
Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enable) override;
Return<uint32_t> getMinBattery() override;
Return<uint32_t> setMinBattery(uint32_t minBattery) override;
};
} // namespace implementation
} // namespace V1_0
} // namespace powershare
} // namespace lineage
} // namespace vendor
#endif // VENDOR_LINEAGE_POWERSHARE_V1_0_POWERSHARE_H

View File

@@ -1,50 +0,0 @@
/*
* Copyright (C) 2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "vendor.lineage.powershare@1.0-service.xiaomi_mondrian"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "PowerShare.h"
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using vendor::lineage::powershare::V1_0::IPowerShare;
using vendor::lineage::powershare::V1_0::implementation::PowerShare;
using android::OK;
using android::status_t;
int main() {
android::sp<IPowerShare> service = new PowerShare();
configureRpcThreadpool(1, true);
status_t status = service->registerAsService();
if (status != OK) {
LOG(ERROR) << "Cannot register PowerShare HAL service.";
return 1;
}
LOG(INFO) << "PowerShare HAL service ready.";
joinRpcThreadpool();
LOG(ERROR) << "PowerShare HAL service failed to join thread pool.";
return 1;
}

View File

@@ -1,8 +0,0 @@
on boot
chown system system /sys/class/qcom-battery/reverse_chg_mode
chmod 0644 /sys/class/qcom-battery/reverse_chg_mode
service vendor.powershare-hal-1-0 /vendor/bin/hw/vendor.lineage.powershare@1.0-service.xiaomi_mondrian
class hal
user system
group system

View File

@@ -1,11 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.lineage.powershare</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IPowerShare</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -0,0 +1,154 @@
# All unpinned blobs below are extracted from OS2.0.9.0.VMNMIXM
# Diag
system_ext/lib/vendor.qti.diaghal@1.0.so
system_ext/lib64/vendor.qti.diaghal@1.0.so
# Display calibration
product/etc/displayconfig/display_id_4630946545580055170.xml
# DPM
system_ext/bin/dpmd
system_ext/bin/tcmd
system_ext/etc/dpm/dpm.conf
system_ext/etc/init/dpmd.rc
system_ext/etc/init/tcmd.rc
system_ext/etc/permissions/com.qti.dpmframework.xml
system_ext/etc/permissions/dpmapi.xml
system_ext/etc/seccomp_policy/tcmd.policy
system_ext/framework/com.qti.dpmframework.jar
system_ext/framework/dpmapi.jar
system_ext/lib64/com.qualcomm.qti.dpm.api@1.0.so
system_ext/lib64/libdpmctmgr.so
system_ext/lib64/libdpmfdmgr.so
system_ext/lib64/libdpmframework.so
system_ext/lib64/libdpmtcm.so
system_ext/lib64/vendor.qti.hardware.dpmaidlservice-V1-ndk.so
system_ext/lib64/vendor.qti.hardware.dpmservice@1.0.so
system_ext/lib64/vendor.qti.hardware.dpmservice@1.1.so
system_ext/priv-app/dpmserviceapp/dpmserviceapp.apk
# Hotword Enrollment
product/priv-app/HotwordEnrollmentXGoogleHEXAGON_WIDEBAND/HotwordEnrollmentXGoogleHEXAGON_WIDEBAND.apk
product/priv-app/HotwordEnrollmentYGoogleHEXAGON_WIDEBAND/HotwordEnrollmentYGoogleHEXAGON_WIDEBAND.apk
system_ext/etc/permissions/com.android.hotwordenrollment.common.util.xml
system_ext/framework/com.android.hotwordenrollment.common.util.jar
# QCC - from ingot-user 14 UKQ1.240227.165 release-keys
system_ext/app/QCC/QCC.apk|d3cbc08cb41bb36ff705109c4c49eba6083a5807
system_ext/bin/qccsyshal@1.2-service|1d3fa5feff11e463204d31927cfb659f707989e1
system_ext/etc/init/vendor.qti.hardware.qccsyshal@1.2-service.rc|7279d09cf4d6f594dbab5c288ec16101bd668a95
system_ext/lib64/libqcc.so|a9dbbaebc96295adb9f996268d540170e0ab9f25
system_ext/lib64/libqcc_file_agent_sys.so|594caf0a2fba843dd34c87a7e4775cc1c25bc93a
system_ext/lib64/libqccdme.so|c05eb3ae79142a0d7bef3664028560a257872c8d
system_ext/lib64/libqccfileservice.so|8f46735705105dcd1237f45e311378512a844b4e
system_ext/lib64/vendor.qti.hardware.qccsyshal@1.0.so|196bce8c481180705cc04074af4fd8362f15f6d9
system_ext/lib64/vendor.qti.hardware.qccsyshal@1.1.so|cb060471bccda79a173bd26f58aea0e7162d65eb
system_ext/lib64/vendor.qti.hardware.qccsyshal@1.2-halimpl.so|9663f4512a1e33956a9a348ac19b139ddfe02ee6
system_ext/lib64/vendor.qti.hardware.qccsyshal@1.2.so|db1ea124c0f42fcc1a814d69308d4f9522012e1b
system_ext/lib64/vendor.qti.hardware.qccvndhal@1.0.so|15a47e8d6f3746e3cb3baa91577f206a1089edd5
system_ext/lib64/vendor.qti.qccvndhal_aidl-V1-ndk.so|ffccfde321f48e390c5af8d546e1c7cdf23f9152
# QMI
system/etc/sysconfig/qti_whitelist.xml
system_ext/etc/sysconfig/qti_telephony_system_packages_config.xml
system_ext/etc/sysconfig/qti_whitelist_system_ext.xml
# RIL
product/app/uimgbaservice/uimgbaservice.apk
product/etc/permissions/UimGba.xml
product/etc/permissions/UimGbaManager.xml
product/etc/permissions/UimService.xml
product/framework/uimgbalibrary.jar
product/framework/uimgbamanagerlibrary.jar
product/framework/uimservicelibrary.jar
system/lib/vendor.qti.diaghal-V1-ndk.so:system_ext/lib/vendor.qti.diaghal-V1-ndk.so
system/lib64/vendor.qti.diaghal-V1-ndk.so:system_ext/lib64/vendor.qti.diaghal-V1-ndk.so
system_ext/app/ImsRcsService/ImsRcsService.apk
system_ext/app/QtiTelephony/QtiTelephony.apk|3568126123554cbb94ea6f33ae6aa0e473ec8d88
system_ext/app/QtiTelephonyService/QtiTelephonyService.apk
system_ext/etc/permissions/qcrilhook.xml
system_ext/etc/permissions/qti_permissions.xml
system_ext/etc/permissions/telephony_system-ext_privapp-permissions-qti.xml
system_ext/etc/permissions/vendor.qti.ims.rcsservice.xml
system_ext/framework/qcrilhook.jar
system_ext/framework/vendor.qti.ims.connection-V1.0-java.jar
system_ext/framework/vendor.qti.ims.connectionaidlservice-V1-java.jar
system_ext/framework/vendor.qti.ims.factory-V2.0-java.jar
system_ext/framework/vendor.qti.ims.factory-V2.1-java.jar
system_ext/framework/vendor.qti.ims.factory-V2.2-java.jar
system_ext/framework/vendor.qti.ims.factoryaidlservice-V1-java.jar
system_ext/framework/vendor.qti.ims.rcssip-V1.0-java.jar
system_ext/framework/vendor.qti.ims.rcssip-V1.1-java.jar
system_ext/framework/vendor.qti.ims.rcssip-V1.2-java.jar
system_ext/framework/vendor.qti.ims.rcssipaidlservice-V1-java.jar
system_ext/framework/vendor.qti.ims.rcsuce-V1.0-java.jar
system_ext/framework/vendor.qti.ims.rcsuce-V1.1-java.jar
system_ext/framework/vendor.qti.ims.rcsuce-V1.2-java.jar
system_ext/framework/vendor.qti.ims.rcsuceaidlservice-V1-java.jar
system_ext/lib64/lib-imsvideocodec.so
system_ext/lib64/lib-imsvt.so
system_ext/lib64/lib-imsvtextutils.so
system_ext/lib64/lib-imsvtutils.so
system_ext/lib64/libdiag_system.so
system_ext/lib64/libimscamera_jni.so
system_ext/lib64/libimsmedia_jni.so
system_ext/lib64/vendor.qti.ImsRtpService-V1-ndk.so
system_ext/lib64/vendor.qti.imsrtpservice@3.0.so
system_ext/lib64/vendor.qti.imsrtpservice@3.1.so
system_ext/priv-app/ims/ims.apk|a4782ffc928d6d74b8757c4bf5fcbb6783e6e27a
system_ext/priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk
# WiFi Display
system/framework/WfdCommon.jar
system_ext/bin/wfdservice64
system_ext/etc/init/wfdservice.rc
system_ext/etc/permissions/wfd-system-ext-privapp-permissions-qti.xml
system_ext/etc/seccomp_policy/wfdservice64.policy
system_ext/etc/wfdconfigsink.xml
system_ext/lib/libmmosal.so
system_ext/lib/libmmparser_lite.so
system_ext/lib/libmmrtpdecoder.so
system_ext/lib/libmmrtpencoder.so
system_ext/lib/libwfdavenhancements.so
system_ext/lib/libwfdclient.so
system_ext/lib/libwfdcommonutils.so
system_ext/lib/libwfdconfigutils.so
system_ext/lib/libwfddisplayconfig.so
system_ext/lib/libwfdmminterface.so
system_ext/lib/libwfdmmsink.so
system_ext/lib/libwfdmmsrc_system.so
system_ext/lib/libwfdrtsp.so
system_ext/lib/libwfdservice.so
system_ext/lib/libwfdsinksm.so
system_ext/lib/libwfduibcinterface.so
system_ext/lib/libwfduibcsink.so
system_ext/lib/libwfduibcsinkinterface.so
system_ext/lib/libwfduibcsrc.so
system_ext/lib/libwfduibcsrcinterface.so
system_ext/lib/vendor.qti.hardware.wifidisplaysession@1.0.so
system_ext/lib/vendor.qti.hardware.wifidisplaysession_aidl-V1-ndk.so
system_ext/lib64/libmmosal.so
system_ext/lib64/libmmparser_lite.so
system_ext/lib64/libmmrtpdecoder.so
system_ext/lib64/libmmrtpencoder.so
system_ext/lib64/libwfdavenhancements.so
system_ext/lib64/libwfdclient.so
system_ext/lib64/libwfdcommonutils.so
system_ext/lib64/libwfdconfigutils.so
system_ext/lib64/libwfddisplayconfig.so
system_ext/lib64/libwfdmminterface.so
system_ext/lib64/libwfdmmsink.so
system_ext/lib64/libwfdmmsrc_system.so
system_ext/lib64/libwfdnative.so
system_ext/lib64/libwfdrtsp.so
system_ext/lib64/libwfdservice.so
system_ext/lib64/libwfdsinksm.so
system_ext/lib64/libwfduibcinterface.so
system_ext/lib64/libwfduibcsink.so
system_ext/lib64/libwfduibcsinkinterface.so
system_ext/lib64/libwfduibcsrc.so
system_ext/lib64/libwfduibcsrcinterface.so
system_ext/lib64/vendor.qti.hardware.wifidisplaysession@1.0.so
system_ext/lib64/vendor.qti.hardware.wifidisplaysession_aidl-V1-ndk.so
system_ext/priv-app/WfdService/WfdService.apk

File diff suppressed because it is too large Load Diff

View File

@@ -91,6 +91,10 @@ on early-boot
chown system system /mnt/vendor/persist/data/pfm/licenses/store_4
chmod 0664 /mnt/vendor/persist/data/pfm/licenses/store_4
# Allow system to read measured screen FPS
chown system graphics /sys/class/drm/card0/sde-crtc-0/measured_fps
chmod 0666 /sys/class/drm/card0/sde-crtc-0/measured_fps
on boot
chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power
chown bluetooth net_bt /sys/class/rfkill/rfkill0/type

View File

@@ -32,6 +32,12 @@ on boot
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
chmod 0666 /dev/input/event2
chmod 0666 /sys/module/perfmgr/parameters/perfmgr_enable
chmod 0666 /sys/module/perfmgr/parameters/min_freq_limit_level
chmod 0666 /sys/module/perfmgr/parameters/max_freq_limit_level
chown system system /sys/module/perfmgr/parameters/perfmgr_enable
chown system system /sys/module/perfmgr/parameters/min_freq_limit_level
chown system system /sys/module/perfmgr/parameters/max_freq_limit_level
on post-fs-data
mkdir /data/vendor/misc 01771 system system
@@ -45,5 +51,6 @@ on post-fs-data
mkdir /mnt/vendor/persist/goodix 0770 system system
mkdir /mnt/vendor/persist/fpc 0770 system system
on property:persist.sys.xtra-daemon.enabled=*
restart loc_launcher

View File

@@ -1,6 +1,10 @@
# Fastcharge
type sysfs_fastcharge, sysfs_type, fs_type;
# FEAS
type proc_perfmgr, fs_type, proc_type;
type sysfs_perfmgr, fs_type, sysfs_type;
# Fingerprint
type vendor_fingerprint_data_file, data_file_type, file_type;
type vendor_fingerprint_data_file_fpdump, data_file_type, file_type;

View File

@@ -30,8 +30,10 @@
/dev/goodix_fp u:object_r:vendor_fingerprint_device:s0
/mnt/vendor/persist/fpc(/.*)? u:object_r:vendor_fingerprint_data_file:s0
/mnt/vendor/persist/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.3-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.3-service\.sm8475 u:object_r:hal_fingerprint_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
# FPS info
/sys/class/drm/card0/sde-crtc-0/measured_fps u:object_r:vendor_sysfs_graphics:s0
# GNSS
/data/vendor/ins(/.*)? u:object_r:vendor_ins_vendor_data_file:s0
@@ -45,14 +47,15 @@
/data/vendor/mac_addr(/.*)? u:object_r:vendor_mac_vendor_data_file:s0
/vendor/bin/nv_mac u:object_r:vendor_wcnss_service_exec:s0
# Powershare
/vendor/bin/hw/vendor\.lineage\.powershare@1\.0-service\.xiaomi u:object_r:hal_lineage_powershare_default_exec:s0
# NFC
/(vendor|system/vendor)/bin/hw/vendor\.nxp\.hardware\.nfc@1\.2-service u:object_r:hal_nfc_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.nxp\.hardware\.nfc@2\.0-service u:object_r:hal_nfc_default_exec:s0
# Thermal
/sys/class/thermal/thermal_zone87/temp u:object_r:sysfs_thermal:s0
# Powershare
/vendor/bin/hw/vendor\.lineage\.powershare-service\.default u:object_r:hal_lineage_powershare_default_exec:s0
# Touch
/vendor/bin/hw/vendor\.lineage\.touch@1\.0-service\.xiaomi_sm8475 u:object_r:hal_lineage_touch_default_exec:s0
/vendor/bin/hw/vendor\.lineage\.touch-service\.xiaomi_sm8475 u:object_r:hal_lineage_touch_default_exec:s0
# Touchscreen
/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:sysfs_tp_fodstatus:s0

View File

@@ -1,9 +1,15 @@
# Battery
genfscon sysfs /class/qcom-battery u:object_r:vendor_sysfs_battery_supply:s0
# FEAS
genfscon proc /perfmgr u:object_r:proc_perfmgr:s0
genfscon sysfs "/module/perfmgr/parameters/perfmgr_enable" u:object_r:sysfs_perfmgr:s0
genfscon sysfs "/module/perfmgr/parameters/min_freq_limit_level" u:object_r:sysfs_perfmgr:s0
genfscon sysfs "/module/perfmgr/parameters/max_freq_limit_level" u:object_r:sysfs_perfmgr:s0
# Fingerprint
genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc u:object_r:vendor_sysfs_fingerprint:s0
# FPS info
genfscon sysfs /class/drm/card0/sde-crtc-0/measured_fps u:object_r:vendor_sysfs_graphics:s0
# Suspend
genfscon sysfs /devices/platform/soc/3000000.remoteproc-adsp/remoteproc/remoteproc2/3000000.remoteproc-adsp:glink-edge/3000000.remoteproc-adsp:glink-edge.adsp_apps.-1.-1/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/884000.i2c/i2c-3/3-005a/wakeup u:object_r:sysfs_wakeup:s0

View File

@@ -1,2 +1,5 @@
allow hal_bluetooth_default vendor_mac_vendor_data_file:dir search;
allow hal_bluetooth_default vendor_mac_vendor_data_file:file { open read };
allow hal_bluetooth_default vendor_bt_data_file:dir rw_dir_perms;
allow hal_bluetooth_default vendor_bt_data_file:file create_file_perms;
allow hal_bluetooth_default vendor_ramdump_vendor_data_file:dir { getattr map open read };

View File

@@ -29,6 +29,7 @@ allow hal_fingerprint_default mnt_vendor_file:dir search;
allow hal_fingerprint_default vendor_displayfeature_device:chr_file { ioctl open read write };
get_prop(hal_fingerprint_default, vendor_adsprpc_prop)
get_prop(hal_fingerprint_default, vendor_camera_prop)
get_prop(hal_fingerprint_default, vendor_panel_info_prop)
set_prop(hal_fingerprint_default, vendor_fp_prop)
set_prop(hal_fingerprint_default, vendor_fp_info_prop)

View File

@@ -5,3 +5,7 @@ set_prop(vendor_init, vendor_ssr_prop)
set_prop(vendor_init, vendor_edgnss_qxwz_downloadak_prop)
set_prop(vendor_init, vendor_qcc_prop)
set_prop(vendor_init, audio_prop)
# FPS info
allow init vendor_sysfs_graphics:dir search;
allow init vendor_sysfs_graphics:file rw_file_perms;

5
sepolicy/vendor/ioctl_defines vendored Normal file
View File

@@ -0,0 +1,5 @@
#####################################
# perf_ioctl.h : FEAS
#
define(`FEAS_QUEUE_BEG', `0x6701')
define(`FEAS_CONNECT', `0x670f')

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

@@ -0,0 +1,3 @@
# FPS info
allow platform_app vendor_sysfs_graphics:dir search;
allow platform_app vendor_sysfs_graphics:file r_file_perms;

View File

@@ -1,4 +1,5 @@
# Fingerprint
persist.vendor.fingerprint. u:object_r:vendor_fp_prop:s0
persist.vendor.fpc. u:object_r:vendor_fp_prop:s0
persist.vendor.sys.fp. u:object_r:vendor_fp_prop:s0
persist.vendor.sys.fp.info u:object_r:vendor_fp_info_prop:s0

7
sepolicy/vendor/surfaceflinger.te vendored Normal file
View File

@@ -0,0 +1,7 @@
# FEAS
allow surfaceflinger proc_perfmgr:dir {read search};
allow surfaceflinger proc_perfmgr:file {open read ioctl};
allowxperm surfaceflinger proc_perfmgr:file ioctl {
FEAS_QUEUE_BEG
FEAS_CONNECT
};

9
sepolicy/vendor/system_app.te vendored Normal file
View File

@@ -0,0 +1,9 @@
# FEAS
allow system_app proc_perfmgr:dir {read search};
allow system_app proc_perfmgr:file {open read ioctl};
allowxperm system_app proc_perfmgr:file ioctl {
FEAS_QUEUE_BEG
FEAS_CONNECT
};
allow system_app sysfs_perfmgr:dir r_dir_perms;
allow system_app sysfs_perfmgr:file { getattr open read setattr write };

9
sepolicy/vendor/system_server.te vendored Normal file
View File

@@ -0,0 +1,9 @@
# FEAS
allow system_server proc_perfmgr:dir {read search};
allow system_server proc_perfmgr:file {open read ioctl};
allowxperm system_server proc_perfmgr:file ioctl {
FEAS_QUEUE_BEG
FEAS_CONNECT
};
allow system_server sysfs_perfmgr:dir r_dir_perms;
allow system_server sysfs_perfmgr:file rw_file_perms;

7
sepolicy/vendor/untrusted_app.te vendored Normal file
View File

@@ -0,0 +1,7 @@
# FEAS
allow untrusted_app proc_perfmgr:dir {read search};
allow untrusted_app proc_perfmgr:file {open read ioctl};
allowxperm untrusted_app proc_perfmgr:file ioctl {
FEAS_QUEUE_BEG
FEAS_CONNECT
};

1
setup-makefiles.py Normal file
View File

@@ -0,0 +1 @@
#!./extract-files.py --regenerate_makefiles

View File

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

View File

@@ -1,14 +1,12 @@
//
// Copyright (C) 2024 The LineageOS Project
//
// SPDX-FileCopyrightText: 2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "vendor.lineage.touch@1.0-service.xiaomi_sm8475",
vintf_fragments: ["vendor.lineage.touch@1.0-service.xiaomi_sm8475.xml"],
init_rc: ["vendor.lineage.touch@1.0-service.xiaomi_sm8475.rc"],
defaults: ["hidl_defaults"],
name: "vendor.lineage.touch-service.xiaomi_sm8475",
init_rc: ["vendor.lineage.touch-service.xiaomi_sm8475.rc"],
vintf_fragments: ["vendor.lineage.touch-service.xiaomi-htpr.xml"],
relative_install_path: "hw",
proprietary: true,
srcs: [
@@ -17,9 +15,9 @@ cc_binary {
],
shared_libs: [
"libbase",
"libbinder",
"libhidlbase",
"libbinder_ndk",
"liblog",
"libutils",
"vendor.lineage.touch@1.0",
"vendor.lineage.touch-V1-ndk",
],
}
}

View File

@@ -1,23 +1,27 @@
/*
* Copyright (C) 2024 The LineageOS Project
* Copyright (C) 2024 Flakeforever
*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* 2023-2025 flakeforever
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.touch@1.0-service.xiaomi_sm8475"
#define LOG_TAG "vendor.lineage.touch-service.xiaomi"
#include "HighTouchPollingRate.h"
#include <android-base/file.h>
#include <android-base/logging.h>
#include <sys/ioctl.h>
#include "xiaomi_touch.h"
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <sys/ioctl.h>
using ::android::base::ReadFileToString;
using ::android::base::Trim;
using ::android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
#define TOUCH_DEV_PATH "/dev/xiaomi-touch"
#define TOUCH_ID 0
@@ -57,13 +61,15 @@ bool getTouchModeValue(int mode, int* value) {
return true;
}
Return<bool> HighTouchPollingRate::isEnabled() {
ndk::ScopedAStatus HighTouchPollingRate::getEnabled(bool* _aidl_return) {
int gameMode = 0;
getTouchModeValue(Touch_Game_Mode, &gameMode);
return gameMode == 1;
*_aidl_return = gameMode == 1;
return ndk::ScopedAStatus::ok();
}
Return<bool> HighTouchPollingRate::setEnabled(bool enabled) {
ndk::ScopedAStatus HighTouchPollingRate::setEnabled(bool enabled) {
if (enabled) {
getTouchModeValue(Touch_UP_THRESHOLD, &upThreshold);
getTouchModeValue(Touch_Tolerance, &tolerance);
@@ -82,11 +88,11 @@ Return<bool> HighTouchPollingRate::setEnabled(bool enabled) {
setTouchModeValue(Touch_Tolerance, tolerance);
setTouchModeValue(Touch_Edge_Filter, edgeFilter);
}
return true;
return ndk::ScopedAStatus::ok();
}
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor
} // namespace vendor
} // namespace aidl

View File

@@ -1,30 +1,24 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <vendor/lineage/touch/1.0/IHighTouchPollingRate.h>
#include <aidl/vendor/lineage/touch/BnHighTouchPollingRate.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
using ::android::hardware::Return;
class HighTouchPollingRate : public IHighTouchPollingRate {
class HighTouchPollingRate : public BnHighTouchPollingRate {
public:
// Methods from ::vendor::lineage::touch::V1_0::IHighTouchPollingRate follow.
Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enabled) override;
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool enabled) override;
};
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor
} // namespace vendor
} // namespace aidl

View File

@@ -1,33 +1,28 @@
/*
* Copyright (C) 2024 The LineageOS Project
*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.touch@1.0-service.xiaomi_sm8475"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#define LOG_TAG "vendor.lineage.touch-service.xiaomi"
#include "HighTouchPollingRate.h"
using ::vendor::lineage::touch::V1_0::IHighTouchPollingRate;
using ::vendor::lineage::touch::V1_0::implementation::HighTouchPollingRate;
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using aidl::vendor::lineage::touch::HighTouchPollingRate;
int main() {
android::sp<IHighTouchPollingRate> highTouchPollingRate = new HighTouchPollingRate();
binder_status_t status = STATUS_OK;
android::hardware::configureRpcThreadpool(1, true);
ABinderProcess_setThreadPoolMaxThreadCount(0);
if (highTouchPollingRate->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register touch high polling rate HAL service.";
return 1;
}
std::shared_ptr<HighTouchPollingRate> htpr = ndk::SharedRefBase::make<HighTouchPollingRate>();
const std::string htpr_instance = std::string(HighTouchPollingRate::descriptor) + "/default";
status = AServiceManager_addService(htpr->asBinder().get(), htpr_instance.c_str());
CHECK_EQ(status, STATUS_OK) << "Failed to add service " << htpr_instance << " " << status;
LOG(INFO) << "Touch HAL service ready.";
android::hardware::joinRpcThreadpool();
LOG(ERROR) << "Touch HAL service failed to join thread pool.";
return 1;
}
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}

View File

@@ -0,0 +1,10 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>vendor.lineage.touch</name>
<version>1</version>
<interface>
<name>IHighTouchPollingRate</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -0,0 +1,4 @@
service vendor.touch-hal /vendor/bin/hw/vendor.lineage.touch-service.xiaomi_sm8475
class hal
user system
group system

View File

@@ -1,11 +0,0 @@
#
# Copyright (C) 2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.xiaomi_sm8475
interface vendor.lineage.touch@1.0::IHighTouchPollingRate default
class hal
user system
group system

View File

@@ -1,7 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.lineage.touch</name>
<transport>hwbinder</transport>
<fqname>@1.0::IHighTouchPollingRate/default</fqname>
</hal>
</manifest>

View File

@@ -1,5 +1,5 @@
//
// Copyright (C) 2022 The LineageOS Project
// Copyright (C) 2022-2025 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
@@ -11,6 +11,9 @@ cc_library {
shared_libs: [
"libbase",
],
static_libs: [
"android.hardware.biometrics.fingerprint-V4-ndk",
],
header_libs: [
"//hardware/xiaomi:xiaomifingerprint_headers",
],

View File

@@ -1,13 +1,15 @@
/*
* Copyright (C) 2022 The LineageOS Project
* 2023 flakeforever
* Copyright (C) 2022-2025 The LineageOS Project
* 2023-2025 flakeforever
*
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "UdfpsHandler.xiaomi_sm8475"
#include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <poll.h>
@@ -64,6 +66,8 @@ struct disp_local_hbm_req {
#define FOD_PRESS_STATUS_PATH "/sys/class/touch/touch_dev/fod_press_status"
using ::aidl::android::hardware::biometrics::fingerprint::AcquiredInfo;
namespace {
template <typename T>
@@ -233,12 +237,6 @@ class XiaomiSm8475UdfpsHander : public UdfpsHandler {
}).detach();
}
void extCmd(int32_t cmd, int32_t param) {
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_X, fodX);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, fodY);
mDevice->extCmd(mDevice, cmd, param);
}
void onFingerDown(uint32_t /*x*/, uint32_t /*y*/, float /*minor*/, float /*major*/) {
// fodX = x;
// fodY = y;
@@ -258,11 +256,14 @@ class XiaomiSm8475UdfpsHander : public UdfpsHandler {
}
}
void onEnrollResult(uint32_t fingerId, uint32_t groupId, uint32_t remaining) {
LOG(INFO) << __func__ << " fingerId: " << fingerId << " remaining: " << remaining;
if (remaining == 0 && fingerPressed) {
setFingerUp();
}
void onAuthenticationSucceeded() {
LOG(INFO) << __func__;
onFingerUp();
}
void onAuthenticationFailed() {
LOG(INFO) << __func__;
onFingerUp();
}
void cancel() {
@@ -270,18 +271,6 @@ class XiaomiSm8475UdfpsHander : public UdfpsHandler {
setFingerUp();
}
void preEnroll() {
LOG(DEBUG) << __func__;
}
void enroll() {
LOG(DEBUG) << __func__;
}
void postEnroll() {
LOG(DEBUG) << __func__;
}
private:
fingerprint_device_t* mDevice;
android::base::unique_fd touchDevice;
@@ -292,6 +281,16 @@ class XiaomiSm8475UdfpsHander : public UdfpsHandler {
uint32_t fodX;
uint32_t fodY;
void extCmd(int32_t cmd, int32_t param) {
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_X, fodX);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, fodY);
mDevice->extCmd(mDevice, cmd, param);
if (param == 0) {
setFingerUp();
}
}
void registerDisplayEvent(int fd, int id, int type) {
disp_event_req req;
req.base.flag = 0;
@@ -314,17 +313,21 @@ class XiaomiSm8475UdfpsHander : public UdfpsHandler {
}
void setFingerUp() {
fingerPressed = false;
setDisplayLocalHBM(0, 0);
int buf[MAX_BUF_SIZE] = {TOUCH_ID, THP_FOD_DOWNUP_CTL, 0};
ioctl(touchDevice.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
if (fingerPressed) {
fingerPressed = false;
setDisplayLocalHBM(0, 0);
int buf[MAX_BUF_SIZE] = {TOUCH_ID, THP_FOD_DOWNUP_CTL, 0};
ioctl(touchDevice.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
}
}
void setFingerDown() {
fingerPressed = true;
setDisplayLocalHBM(0, 2);
int buf[MAX_BUF_SIZE] = {TOUCH_ID, THP_FOD_DOWNUP_CTL, 1};
ioctl(touchDevice.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
if (!fingerPressed) {
fingerPressed = true;
setDisplayLocalHBM(0, 2);
int buf[MAX_BUF_SIZE] = {TOUCH_ID, THP_FOD_DOWNUP_CTL, 1};
ioctl(touchDevice.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
}
}
};