mirror of
https://github.com/pjgowtham/android_device_realme_ferrarri.git
synced 2026-11-27 16:24:08 +00:00
The face HAL ends an attempt that sees no face for 151 frames with UNABLE_TO_PROCESS. SystemUI treats that as a hardware error and retries up to four times, so a single lock screen wake keeps the front camera cycling for about a minute, racing any other camera client. E face_aidl.FaceSession: No face times have reached 151 counts, so cancel! E face_aidl.FaceSession: onError(error=2, vendor=0) E FaceAuthenticateOptions: unmapped FaceAuthUiEvent FACE_AUTH_TRIGGERED_RETRY_AFTER_HW_UNAVAILABLE One such camera close stalled while Aperture opened the rear camera, and the HAL's watchdog killed it: F DEBUG : signal 11 (SIGSEGV), code 0 (SI_USER), fault addr -------- F DEBUG : #08 pc 000000000003dfcc /vendor/lib64/libcamera2ndk_vendor.so (ACameraDevice_close.cfi+36) F DEBUG : #09 pc 0000000000025e60 /odm/bin/hw/vendor.oplus.hardware.biometrics.face@1.0-service (CameraHelper::closeCameraNoLock()+316) Report it as TIMEOUT, which is what it is. Assisted-by: LLM Change-Id: Ibbb5189c7181427d975e3c26695927ffbca2b9e6
139 lines
6.0 KiB
Python
Executable File
139 lines
6.0 KiB
Python
Executable File
#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3
|
|
#
|
|
# SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from extract_utils.fixups_blob import (
|
|
BlobFixupCtx,
|
|
File,
|
|
blob_fixup,
|
|
blob_fixups_user_type,
|
|
)
|
|
from extract_utils.fixups_lib import (
|
|
lib_fixups,
|
|
)
|
|
from extract_utils.main import (
|
|
ExtractUtils,
|
|
ExtractUtilsModule,
|
|
)
|
|
from extract_utils.tools import (
|
|
llvm_objdump_path,
|
|
)
|
|
from extract_utils.utils import (
|
|
run_cmd,
|
|
)
|
|
|
|
namespace_imports = [
|
|
'hardware/oplus',
|
|
'vendor/oneplus/sm8450-common',
|
|
'hardware/qcom-caf/sm8450-6.6',
|
|
'vendor/qcom/opensource/commonsys-intf/display',
|
|
'vendor/qcom/opensource/commonsys/display',
|
|
]
|
|
|
|
|
|
def blob_fixup_nop_call(
|
|
ctx: BlobFixupCtx,
|
|
file: File,
|
|
file_path: str,
|
|
call_instruction: str,
|
|
disassemble_symbol: str,
|
|
symbol: str,
|
|
*args,
|
|
**kwargs,
|
|
):
|
|
for line in run_cmd(
|
|
[
|
|
llvm_objdump_path,
|
|
f'--disassemble-symbols={disassemble_symbol}',
|
|
file_path,
|
|
]
|
|
).splitlines():
|
|
line = line.split(maxsplit=3)
|
|
|
|
if len(line) != 4:
|
|
continue
|
|
|
|
offset, _, instruction, args = line
|
|
|
|
if instruction != call_instruction:
|
|
continue
|
|
|
|
if not args.endswith(f' <{symbol}>'):
|
|
continue
|
|
|
|
with open(file_path, 'rb+') as f:
|
|
f.seek(int(offset[:-1], 16))
|
|
f.write(b'\x1f\x20\x03\xd5') # AArch64 NOP
|
|
|
|
break
|
|
|
|
|
|
blob_fixups: blob_fixups_user_type = {
|
|
'odm/bin/hw/vendor.oplus.hardware.biometrics.face@1.0-service': blob_fixup()
|
|
.binary_regex_replace(b'\x41\x00\x80\x52\xe0\x03\x14\xaa\xf3\xf8\xff\x97', b'\x61\x00\x80\x52\xe0\x03\x14\xaa\xf3\xf8\xff\x97') # no face timeout: UNABLE_TO_PROCESS -> TIMEOUT
|
|
.replace_needed('android.hardware.biometrics.common-V1-ndk_platform.so', 'android.hardware.biometrics.common-V1-ndk.so')
|
|
.replace_needed('android.hardware.biometrics.face-V1-ndk_platform.so', 'android.hardware.biometrics.face-V1-ndk.so'),
|
|
'odm/bin/hw/vendor.oplus.hardware.biometrics.fingerprint@2.1-service': blob_fixup()
|
|
.replace_needed('android.hardware.biometrics.common-V1-ndk_platform.so', 'android.hardware.biometrics.common-V1-ndk.so')
|
|
.replace_needed('android.hardware.biometrics.fingerprint-V1-ndk_platform.so', 'android.hardware.biometrics.fingerprint-V1-ndk.so'),
|
|
'odm/etc/camera/CameraHWConfiguration.config': blob_fixup()
|
|
.regex_replace('SystemCamera = 0; 0; 1; 1; 1', 'SystemCamera = 0; 0; 0; 0; 1')
|
|
.regex_replace('SystemCamera = com.oplus.camera', 'SystemCamera = org.lineageos.aperture'),
|
|
'odm/etc/camera/config/camera_unit_config': blob_fixup()
|
|
.regex_replace('^{', '{\n "cameraExtensionConfig":[\n'
|
|
' {"type":4, "cameraId":"0", "support_ratio":"standard,16_9", "format":"256,35", "specific_preview_ratio_size":{"standard":"1440x1080", "16_9":"1920x1080"}, "capture_latency_range":"100,7000"},\n'
|
|
' {"type":2, "cameraId":"0", "support_ratio":"standard", "format":"256,35", "capture_latency_range":"100,10000"}\n'
|
|
' ],\n'),
|
|
'odm/etc/camera/config/oplus_camera_algo_switch_config': blob_fixup()
|
|
.regex_replace(r'(?s)("mode": "portrait",\s*"entity": \[\s*\{\s*"id": 0,\s*"camera_num": )2(.*?"slave_input_width": )1440(,\s*"slave_input_height": )1080(.*?"algo_list": \[ )"preview_rtb", "preview_aicolor", ("preview_lsd" \])',
|
|
r'\g<1>1\g<2>0\g<3>0\g<4>\g<5>'),
|
|
'odm/lib64/libAlgoProcess.so': blob_fixup()
|
|
.replace_needed('android.hardware.graphics.common-V2-ndk_platform.so', 'android.hardware.graphics.common-V7-ndk.so'),
|
|
('odm/lib64/libCOppLceTonemapAPI.so', 'odm/lib64/libSuperRaw.so', 'odm/lib64/libYTCommon.so', 'odm/lib64/libaps_frame_registration.so'): blob_fixup()
|
|
.replace_needed('libstdc++.so', 'libstdc++_vendor.so'),
|
|
('odm/lib64/libHIS.so', 'odm/lib64/libOGLManager.so'): blob_fixup()
|
|
.clear_symbol_version('AHardwareBuffer_allocate')
|
|
.clear_symbol_version('AHardwareBuffer_describe')
|
|
.clear_symbol_version('AHardwareBuffer_lock')
|
|
.clear_symbol_version('AHardwareBuffer_release')
|
|
.clear_symbol_version('AHardwareBuffer_unlock'),
|
|
('odm/lib64/libaiboost_hexagon.so', 'odm/lib64/libarcsoft_high_dynamic_range_v4.so'): blob_fixup()
|
|
.clear_symbol_version('remote_handle_close')
|
|
.clear_symbol_version('remote_handle_invoke')
|
|
.clear_symbol_version('remote_handle_open')
|
|
.clear_symbol_version('remote_handle64_close')
|
|
.clear_symbol_version('remote_handle64_invoke')
|
|
.clear_symbol_version('remote_handle64_open')
|
|
.clear_symbol_version('remote_register_buf_attr')
|
|
.clear_symbol_version('remote_register_buf'),
|
|
('odm/lib64/libarcsoft_dual_sat.so', 'odm/lib64/libarcsoft_dual_zoomtranslator.so', 'odm/lib64/libarcsoft_triple_sat.so', 'odm/lib64/libarcsoft_triple_zoomtranslator.so'): blob_fixup()
|
|
.add_needed('libc++_shared.so'),
|
|
'odm/lib64/libextensionlayer.so': blob_fixup()
|
|
.replace_needed('libziparchive.so', 'libziparchive_odm.so'),
|
|
'vendor/etc/libnfc-nci.conf': blob_fixup()
|
|
.regex_replace('NFC_DEBUG_ENABLED=1', 'NFC_DEBUG_ENABLED=0'),
|
|
'vendor/etc/libnfc-nxp.conf': blob_fixup()
|
|
.regex_replace('(NXPLOG_.*_LOGLEVEL)=0x03', '\\1=0x02')
|
|
.regex_replace('NFC_DEBUG_ENABLED=1', 'NFC_DEBUG_ENABLED=0'),
|
|
'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/libmidasserviceintf_aidl.so': blob_fixup()
|
|
.replace_needed('android.frameworks.stats-V1-ndk_platform.so', 'android.frameworks.stats-V1-ndk.so'),
|
|
} # fmt: skip
|
|
|
|
module = ExtractUtilsModule(
|
|
'ferrari',
|
|
'realme',
|
|
namespace_imports=namespace_imports,
|
|
blob_fixups=blob_fixups,
|
|
lib_fixups=lib_fixups,
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
utils = ExtractUtils.device_with_common(
|
|
module, 'sm8450-common', 'oneplus'
|
|
)
|
|
utils.run()
|