* Fixes audio playback in some cases with USB headphones. Change-Id: I4d904b1610dc6e17f29546f6f7f4f04bac0ca4c3 Signed-off-by: alextrack2013 <alextrack2013@gmail.com> Signed-off-by: fjrXTR <fajarslebew31@gmail.com>
180 lines
7.1 KiB
Bash
Executable File
180 lines
7.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
|
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
set -e
|
|
|
|
DEVICE=S666LN
|
|
VENDOR=itel
|
|
|
|
# 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}/../../.."
|
|
|
|
export TARGET_ENABLE_CHECKELF=false
|
|
|
|
# If XML files don't have comments before the XML header, use this flag
|
|
# Can still be used with broken XML files by using blob_fixup
|
|
export TARGET_DISABLE_XML_FIXING=true
|
|
|
|
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
|
|
--only-firmware)
|
|
ONLY_FIRMWARE=true
|
|
;;
|
|
-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/mt6789/vendor.mediatek.hardware.pq@2.15-impl.so|\
|
|
vendor/bin/hw/vendor.mediatek.hardware.pq@2.2-service)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --replace-needed "libbinder.so" "libbinder-v31.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v31.so" "${2}"
|
|
;;
|
|
vendor/etc/init/android.hardware.media.c2@1.2-mediatek.rc)
|
|
[ "$2" = "" ] && return 0
|
|
sed -i 's/@1.2-mediatek/@1.2-mediatek-64b/g' "${2}"
|
|
;;
|
|
vendor/bin/hw/android.hardware.media.c2@1.2-mediatek-64b)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --replace-needed "libavservices_minijail_vendor.so" "libavservices_minijail.so" "${2}"
|
|
"${PATCHELF}" --add-needed "libstagefright_foundation-v33.so" "${2}"
|
|
;;
|
|
vendor/bin/hw/android.hardware.gnss-service.mediatek |\
|
|
vendor/lib64/hw/android.hardware.gnss-impl-mediatek.so)
|
|
[ "$2" = "" ] && return 0
|
|
"$PATCHELF" --replace-needed "android.hardware.gnss-V1-ndk_platform.so" "android.hardware.gnss-V1-ndk.so" "$2"
|
|
;;
|
|
vendor/bin/mnld|\
|
|
vendor/lib64/hw/android.hardware.sensors@2.X-subhal-mediatek.so|\
|
|
vendor/lib64/hw/mt6789/vendor.mediatek.hardware.pq@2.15-impl.so|\
|
|
vendor/lib64/mt6789/libaalservice.so|\
|
|
vendor/lib64/mt6789/libcam.utils.sensorprovider.so)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --add-needed "libshim_sensors.so" "${2}"
|
|
;;
|
|
vendor/lib*/libwvhidl.so|\
|
|
vendor/lib*/mediadrm/libwvdrmengine.so)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --replace-needed "libprotobuf-cpp-lite-3.9.1.so" "libprotobuf-cpp-full-3.9.1.so" "${2}"
|
|
;;
|
|
vendor/bin/hw/android.hardware.security.keymint-service.trustonic)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --replace-needed "android.hardware.security.keymint-V1-ndk_platform.so" "android.hardware.security.keymint-V1-ndk.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "android.hardware.security.secureclock-V1-ndk_platform.so" "android.hardware.security.secureclock-V1-ndk.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "android.hardware.security.sharedsecret-V1-ndk_platform.so" "android.hardware.security.sharedsecret-V1-ndk.so" "${2}"
|
|
grep -q "android.hardware.security.rkp-V3-ndk.so" "${2}" || ${PATCHELF} --add-needed "android.hardware.security.rkp-V3-ndk.so" "${2}"
|
|
;;
|
|
vendor/lib64/hw/mt6789/android.hardware.camera.provider@2.6-impl-mediatek.so)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v31.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}"
|
|
grep -q libshim_camera_metadata.so "${2}" || "${PATCHELF}" --add-needed libshim_camera_metadata.so "${2}"
|
|
;;
|
|
vendor/lib64/hw/mt6789/vendor.mediatek.hardware.camera.isphal@1.0-impl.so|\
|
|
vendor/lib64/hw/mt6789/vendor.mediatek.hardware.camera.isphal@1.1-impl.so|\
|
|
vendor/bin/hw/mt6789/camerahalserver)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v31.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "libbinder.so" "libbinder-v31.so" "${2}"
|
|
"${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}"
|
|
"${PATCHELF}" --add-needed "libprocessgroup_shim.so" "${2}"
|
|
;;
|
|
vendor/etc/init/init.thermal_core.rc)
|
|
[ "$2" = "" ] && return 0
|
|
sed -i 's|ro.vendor.mtk_thermal_2_0|vendor.thermal.link_ready|g' "${2}"
|
|
;;
|
|
vendor/etc/init/android.hardware.bluetooth@1.1-service-mediatek.rc)
|
|
sed -i '/vts/Q' "$2"
|
|
;;
|
|
vendor/etc/vintf/manifest/manifest_media_c2_V1_2_default.xml)
|
|
[ "$2" = "" ] && return 0
|
|
sed -i 's/1.1/1.2/' "$2"
|
|
;;
|
|
vendor/lib64/hw/hwcomposer.mtk_common.so)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --add-needed "libprocessgroup_shim.so" "${2}"
|
|
;;
|
|
vendor/lib64/mt6789/libneuralnetworks_sl_driver_mtk_prebuilt.so|\
|
|
vendor/lib*/libstfactory-vendor.so|\
|
|
vendor/lib*/libnvram.so|\
|
|
vendor/lib*/libsysenv.so|\
|
|
vendor/lib64/ese_spi_nxp.so|\
|
|
vendor/lib64/nfc_nci_nxp.so|\
|
|
vendor/lib*/libtflite_mtk.so)
|
|
[ "$2" = "" ] && return 0
|
|
"${PATCHELF}" --add-needed "libbase_shim.so" "${2}"
|
|
;;
|
|
vendor/lib64/hw/gf_fingerprint.default.so)
|
|
[ "$2" = "" ] && return 0
|
|
sed -i 's/libfingerprint.default.so/gf_fingerprint.default.so/' "${2}"
|
|
;;
|
|
vendor/lib64/libvendor.goodix.hardware.biometrics.fingerprint@2.1.so)
|
|
[ "$2" = "" ] && return 0
|
|
"{$PATCHELF}" --remove-needed "libhidlbase.so" "${2}"
|
|
sed -i "s/libhidltransport.so/libhidlbase-v31.so\x00/" "${2}"
|
|
;;
|
|
vendor/lib64/hw/audio.primary.mediatek.so)
|
|
[ "$2" = "" ] && return 0
|
|
"$PATCHELF" --replace-needed "libalsautils.so" "libalsautils-v31.so" "${2}"
|
|
grep -q "libstagefright_foundation-v33.so" "${2}" || "$PATCHELF" --add-needed "libstagefright_foundation-v33.so" "${2}"
|
|
;;
|
|
*)
|
|
return 1
|
|
;;
|
|
esac
|
|
|
|
return 0
|
|
}
|
|
|
|
function blob_fixup_dry() {
|
|
blob_fixup "${1}" ""
|
|
}
|
|
|
|
# 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"
|