17 Commits
vic ... 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
37 changed files with 330 additions and 2566 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
@@ -82,8 +80,8 @@ 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
@@ -116,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
@@ -126,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
@@ -166,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
@@ -217,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
@@ -233,7 +228,7 @@ BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE := true
ENABLE_VENDOR_RIL_SERVICE := true
# Security patch level
VENDOR_SECURITY_PATCH := 2025-03-01
VENDOR_SECURITY_PATCH := 2025-06-06
# Sensor
SOONG_CONFIG_NAMESPACES += SENSORS_XIAOMI

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

@@ -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,6 +440,9 @@ 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

View File

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

View File

@@ -47,19 +47,10 @@ PRODUCT_PACKAGES += \
otapreopt_script
# 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 \
@@ -112,6 +103,8 @@ 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
@@ -126,14 +119,10 @@ 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)
@@ -161,8 +150,8 @@ PRODUCT_PACKAGES += \
# 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
@@ -320,14 +309,11 @@ 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 += \
@@ -357,9 +343,9 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf
PRODUCT_PACKAGES += \
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 \
@@ -415,11 +401,11 @@ PRODUCT_COPY_FILES += \
# Thermal
PRODUCT_PACKAGES += \
android.hardware.thermal@2.0-service.qti-v2
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 += \

View File

@@ -84,11 +84,13 @@ lib_fixups: lib_fixups_user_type = {
# 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',
@@ -97,11 +99,6 @@ lib_fixups: lib_fixups_user_type = {
}
blob_fixups: blob_fixups_user_type = {
'vendor/lib64/libcamximageformatutils.so': blob_fixup()
.replace_needed(
'vendor.qti.hardware.display.config-V2-ndk_platform.so',
'vendor.qti.hardware.display.config-V2-ndk.so',
),
(
'vendor/lib64/libTrueSight.so',
'vendor/lib64/libalAILDC.so',
@@ -114,7 +111,10 @@ blob_fixups: blob_fixups_user_type = {
.clear_symbol_version('AHardwareBuffer_lockPlanes')
.clear_symbol_version('AHardwareBuffer_release')
.clear_symbol_version('AHardwareBuffer_unlock'),
'system_ext/lib64/libwfdmmsrc_system.so': blob_fixup()
(
'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')
@@ -123,6 +123,7 @@ blob_fixups: blob_fixups_user_type = {
'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',
@@ -219,4 +220,4 @@ module = ExtractUtilsModule(
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()
utils.run()

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

@@ -21,8 +21,8 @@ PRODUCT_SYSTEM_DEVICE := mondrian
PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
PRODUCT_BUILD_PROP_OVERRIDES += \
BuildDesc="mondrian_global-user 12 SKQ1.230401.001 OS2.0.7.0.VMNMIXM release-keys" \
BuildFingerprint=POCO/mondrian_global/mondrian:12/SKQ1.230401.001/OS2.0.7.0.VMNMIXM:user/release-keys \
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

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

@@ -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,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

View File

@@ -1,4 +1,4 @@
# All unpinned blobs below are extracted from OS2.0.3.0.VMNMIXM
# All unpinned blobs below are extracted from OS2.0.9.0.VMNMIXM
# ACDB
vendor/etc/acdbdata/IDP_UPD/IDP_UPD_acdb_cal.acdb
@@ -2098,7 +2098,7 @@ vendor/lib/libmlipay.so
vendor/lib/libmlipay@1.1.so
vendor/lib/libmt.so
vendor/lib/libtida@1.2.so
vendor/lib/vendor.xiaomi.hardware.mfidoca@1.0.so
vendor/lib/vendor.xiaomi.hardware.mfidoca@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib/vendor.xiaomi.hardware.mlipay@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib/vendor.xiaomi.hardware.mlipay@1.1.so;MODULE_SUFFIX=_vendor
vendor/lib/vendor.xiaomi.hardware.mtdservice@1.0.so;MODULE_SUFFIX=_vendor
@@ -2111,13 +2111,13 @@ vendor/lib64/libmlipay@1.1.so
vendor/lib64/libmt.so
vendor/lib64/libmt@1.3.so
vendor/lib64/libtida@1.2.so
vendor/lib64/vendor.xiaomi.hardware.mfidoca@1.0.so
vendor/lib64/vendor.xiaomi.hardware.mfidoca@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.mlipay@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.mlipay@1.1.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.mtdservice@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.mtdservice@1.1.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.mtdservice@1.2.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.mtdservice@1.3.so
vendor/lib64/vendor.xiaomi.hardware.mtdservice@1.3.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.tidaservice@1.0.so
vendor/lib64/vendor.xiaomi.hardware.tidaservice@1.1.so
vendor/lib64/vendor.xiaomi.hardware.tidaservice@1.2.so

View File

@@ -30,8 +30,7 @@
/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
@@ -53,13 +52,10 @@
/(vendor|system/vendor)/bin/hw/vendor\.nxp\.hardware\.nfc@2\.0-service u:object_r:hal_nfc_default_exec:s0
# Powershare
/vendor/bin/hw/vendor\.lineage\.powershare@1\.0-service\.xiaomi u:object_r:hal_lineage_powershare_default_exec:s0
# Thermal
/sys/class/thermal/thermal_zone87/temp u:object_r:sysfs_thermal:s0
/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

@@ -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

@@ -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

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);
}
}
};