Files
device_xiaomi_rosemary/extract-files.sh
R0rt1z2 59e0aa7dec rosemary: Patch Goodix fingerprint HAL to ignore conflicting events
This will fix the long standing issue of the screenshot button
combination not working properly in AOSP for Goodix sensors.

The patch will replace the first instruction of the
'gf_hal_send_key_event' function with a ret so that the touch
events which conflict with AOSP do not get reported to userspace.

Change-Id: I9e15a46b519fd7f75e39af4690c271aa63af4790
2023-04-25 17:59:38 +02:00

112 lines
3.5 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
DEVICE=rosemary
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/lib*/hw/audio.primary.mt6785.so)
"${PATCHELF}" --add-needed "libshim_audio.so" "${2}"
"${PATCHELF}" --replace-needed "libalsautils.so" "libalsautils-v30.so" "${2}"
;;
vendor/lib*/hw/audio.usb.mt6785.so)
"${PATCHELF}" --replace-needed "libalsautils.so" "libalsautils-v30.so" "${2}"
;;
vendor/lib64/libwifi-hal-mtk.so)
"$PATCHELF" --set-soname libwifi-hal-mtk.so "${2}"
;;
vendor/lib64/libmtkcam_stdutils.so)
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
;;
vendor/lib*/hw/dfps.mt6785.so)
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
;;
vendor/lib/libMtkOmxVdecEx.so)
"${PATCHELF}" --replace-needed "libui.so" "libui-v32.so" "${2}"
;;
vendor/lib*/hw/vendor.mediatek.hardware.pq@2.6-impl.so)
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
;;
vendor/lib64/libvendor.goodix.hardware.biometrics.fingerprint@2.1.so)
"${PATCHELF_0_8}" --remove-needed "libhidlbase.so" "${2}"
sed -i "s/libhidltransport.so/libhidlbase-v32.so\x00/" "${2}"
;;
vendor/lib64/libcam.halsensor.so)
"${PATCHELF}" --add-needed "libshim_utils.so" "${2}"
;;
vendor/lib64/libgf_hal.so)
xxd -p "${2}" | sed "s/ffc301d1fd7b06a9fd830191e8031f2ae2037db2a94300d14ad03bd54a15/000080d2c0035fd6fd830191e8031f2ae2037db2a94300d14ad03bd54a15/g" | xxd -r -p > "${2}".patched
mv "${2}".patched "${2}"
;;
vendor/bin/hw/android.hardware.keymaster@4.0-service.beanpod)
"${PATCHELF}" --add-needed "libshim_beanpod.so" "${2}"
;;
vendor/bin/hw/vendor.mediatek.hardware.mtkpower@1.0-service)
"${PATCHELF}" --replace-needed "android.hardware.power-V1-ndk_platform.so" "android.hardware.power-V1-ndk.so" "${2}"
;;
lib/libshowlogo.so)
"${PATCHELF}" --add-needed "libshim_showlogo.so" "${2}"
;;
lib/libsink.so)
"${PATCHELF}" --add-needed "libshim_vtservice.so" "${2}"
;;
esac
}
# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
"${MY_DIR}/setup-makefiles.sh"