diff --git a/caiman/extract-files.py b/caiman/extract-files.py new file mode 100755 index 00000000..4af70673 --- /dev/null +++ b/caiman/extract-files.py @@ -0,0 +1,98 @@ +#!/usr/bin/env -S PYTHONPATH=../../../../tools/extract-utils python3 +# +# SPDX-FileCopyrightText: 2024 The LineageOS Project +# SPDX-License-Identifier: Apache-2.0 +# + +from extract_utils.extract import extract_fns_user_type +from extract_utils.extract_pixel import ( + extract_pixel_factory_image, + extract_pixel_firmware, + pixel_factory_image_regex, + pixel_firmware_regex, +) +from extract_utils.file import FileArgs, FileList +from extract_utils.fixups_blob import ( + blob_fixup, + blob_fixups_user_type, +) +from extract_utils.fixups_lib import ( + lib_fixups, + lib_fixups_user_type, +) +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'device/google/caimito', + 'hardware/google/av', + 'hardware/google/gchips', + 'hardware/google/graphics/common', + 'hardware/google/interfaces', + 'hardware/google/pixel', +] + + +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, + ( + 'com.google.edgetpu_app_service-V4-ndk', + 'com.google.edgetpu_vendor_service-V2-ndk', + 'vendor.google.whitechapel.audio.audioext@4.0', + 'vendor.google.whitechapel.audio.extension-V2-ndk', + ): lib_fixup_vendor_suffix, +} + +blob_fixups: blob_fixups_user_type = { + 'product/etc/felica/common.cfg': blob_fixup() + .patch_file('osaifu-keitai.patch'), + 'vendor/etc/init/init.modem_logging_control.rc': blob_fixup() + .regex_replace(' && property:ro.debuggable=0', ''), +} # fmt: skip + +extract_fns: extract_fns_user_type = { + pixel_factory_image_regex: extract_pixel_factory_image, + pixel_firmware_regex: extract_pixel_firmware, +} + +module = ExtractUtilsModule( + 'caiman', + 'google', + device_rel_path='device/google/caimito/caiman', + blob_fixups=blob_fixups, + lib_fixups=lib_fixups, + namespace_imports=namespace_imports, + add_generated_carriersettings_file=True, + add_firmware_proprietary_file=True, + extract_fns=extract_fns, +) + + +def fix_vendor_file_list(file_list: FileList): + module_suffix_file_paths = [ + 'vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so', + 'vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so', + 'vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so', + 'vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so', + ] + + for file_path in module_suffix_file_paths: + file_list.get_file(file_path).set_arg(FileArgs.MODULE_SUFFIX, '_vendor') + + +module.add_generated_proprietary_file( + 'proprietary-files-vendor.txt', + partition='vendor', + skip_file_list_name='skip-files-vendor.txt', + fix_file_list=fix_vendor_file_list, +) + +if __name__ == '__main__': + utils = ExtractUtils.device(module) + utils.run() diff --git a/caiman/extract-files.sh b/caiman/extract-files.sh deleted file mode 100755 index 37383756..00000000 --- a/caiman/extract-files.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -DEVICE=caiman -VENDOR=google - -# 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 - -ONLY_FIRMWARE= -KANG= -SECTION= -CARRIER_SKIP_FILES=() -VENDOR_SKIP_FILES=() - -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 - product/etc/felica/common.cfg) - [ "$2" = "" ] && return 0 - sed -i -e '$a00000018,1' -e '/^00000014/d' -e '/^00000015/d' "${2}" - ;; - vendor/etc/init/init.modem_logging_control.rc) - [ "$2" = "" ] && return 0 - sed -i 's/ && property:ro.debuggable=0//' "${2}" - ;; - *) - return 1 - ;; - esac - - return 0 -} - -function blob_fixup_dry() { - blob_fixup "$1" "" -} - -function prepare_firmware() { - if [ "${SRC}" != "adb" ]; then - bash "${ANDROID_ROOT}"/lineage/scripts/pixel/prepare-firmware.sh "${DEVICE}" "${SRC}" - fi -} - -# Initialize the helper -setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" - -if [ -z "${ONLY_FIRMWARE}" ]; then - extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" - - generate_prop_list_from_image "product.img" "${MY_DIR}/proprietary-files-carriersettings.txt" CARRIER_SKIP_FILES carriersettings - extract "${MY_DIR}/proprietary-files-carriersettings.txt" "${SRC}" "${KANG}" --section "${SECTION}" - - readarray -t VENDOR_SKIP_FILES < <(cat "${MY_DIR}/skip-files-vendor.txt" | sed -E "/^[[:blank:]]*(#|$)/d") - VENDOR_TXT="${MY_DIR}/proprietary-files-vendor.txt" - generate_prop_list_from_image "vendor.img" "${VENDOR_TXT}" VENDOR_SKIP_FILES - - set_module_suffix "vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so" "-vendor" "${VENDOR_TXT}" - - extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}" -fi - -if [ -z "${SECTION}" ]; then - extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}" -fi - -"${MY_DIR}/setup-makefiles.sh" diff --git a/caiman/osaifu-keitai.patch b/caiman/osaifu-keitai.patch new file mode 100644 index 00000000..83d6d0ef --- /dev/null +++ b/caiman/osaifu-keitai.patch @@ -0,0 +1,24 @@ +From aab255f2807cfc460c0dce40decd5554d49c0076 Mon Sep 17 00:00:00 2001 +From: jabashque +Date: Mon, 5 Feb 2024 21:36:03 +0000 +Subject: [PATCH 1/1] Enable Osaifu-Keitai on non-Japanese SKUs + +--- + common.cfg | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/common.cfg b/common.cfg +index 3b78765..00f53cb 100644 +--- a/common.cfg ++++ b/common.cfg +@@ -11,6 +11,5 @@ + 02030001,0 + 02030002,0 + 02030003,intent:#Intent;action=android.settings.NFC_SETTINGS;end +-00000014,content://com.google.android.pixelnfc.provider.DeviceInfoContentProvider/isJapanSku +-00000015,is_japan_sku + 00000016,0001 ++00000018,1 +-- +2.47.0 + diff --git a/caiman/proprietary-files-vendor.txt b/caiman/proprietary-files-vendor.txt index eec16d95..cccd5552 100644 --- a/caiman/proprietary-files-vendor.txt +++ b/caiman/proprietary-files-vendor.txt @@ -2734,8 +2734,8 @@ vendor/lib64/android.hardware.weaver2-impl.nos.so vendor/lib64/aocx-ndk.so vendor/lib64/com.google.edgetpu.dba-V1-ndk.so vendor/lib64/com.google.edgetpu.tachyon-V1-ndk.so -vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so;MODULE_SUFFIX=-vendor -vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=-vendor +vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so;MODULE_SUFFIX=_vendor +vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=_vendor vendor/lib64/com.google.hardware.biometrics.fingerprint.fingerprint-ext-V1-ndk.so vendor/lib64/com.google.input-V2-ndk.so vendor/lib64/com.google.input-V3-ndk.so @@ -2841,8 +2841,8 @@ vendor/lib64/vendor.google.battery_mitigation.service_static.so vendor/lib64/vendor.google.bluetooth_ext-V1-ndk.so vendor/lib64/vendor.google.google_battery-V3-ndk.so vendor/lib64/vendor.google.radio_ext-V1-ndk.so -vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so;MODULE_SUFFIX=-vendor -vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so;MODULE_SUFFIX=-vendor +vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so;MODULE_SUFFIX=_vendor +vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so;MODULE_SUFFIX=_vendor vendor/lib64/vendor.google.whitechapel.audio.hal.audio.so vendor/lib64/vendor.google.whitechapel.audio.hal.audio.sound_dose.aoc.so vendor/lib64/vendor.google.whitechapel.audio.hal.effect.so diff --git a/caiman/setup-makefiles.py b/caiman/setup-makefiles.py new file mode 100755 index 00000000..32947cfe --- /dev/null +++ b/caiman/setup-makefiles.py @@ -0,0 +1 @@ +#!./extract-files.py --regenerate_makefiles diff --git a/caiman/setup-makefiles.sh b/caiman/setup-makefiles.sh deleted file mode 100755 index aeb6f67a..00000000 --- a/caiman/setup-makefiles.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -DEVICE=caiman -VENDOR=google - -# 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}" - -function vendor_imports() { - cat <>"$1" - "device/google/caimito", - "hardware/google/av", - "hardware/google/gchips", - "hardware/google/graphics/common", - "hardware/google/interfaces", - "hardware/google/pixel", -EOF -} - -function lib_to_package_fixup_vendor_variants() { - if [ "$2" != "vendor" ]; then - return 1 - fi - - case "$1" in - com.google.edgetpu_app_service-V4-ndk | \ - com.google.edgetpu_vendor_service-V2-ndk | \ - vendor.google.whitechapel.audio.audioext@4.0 | \ - vendor.google.whitechapel.audio.extension-V2-ndk) - echo "$1-vendor" - ;; - libprotobuf-cpp-full-21.12) - echo "libprotobuf-cpp-full" - ;; - libprotobuf-cpp-lite-21.12) - echo "libprotobuf-cpp-lite" - ;; - *) - return 1 - ;; - esac -} - -function lib_to_package_fixup() { - lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || - lib_to_package_fixup_proto_3_9_1 "$1" || - lib_to_package_fixup_vendor_variants "$@" -} - -# Initialize the helper -setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" - -# Warning headers and guards -write_headers - -write_makefiles "${MY_DIR}/proprietary-files.txt" -write_makefiles "${MY_DIR}/proprietary-files-carriersettings.txt" -write_makefiles "${MY_DIR}/proprietary-files-vendor.txt" - -append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt" - -# Finish -write_footers diff --git a/caiman/skip-files-vendor.txt b/caiman/skip-files-vendor.txt index be543cc8..ca2b29ee 100644 --- a/caiman/skip-files-vendor.txt +++ b/caiman/skip-files-vendor.txt @@ -1052,6 +1052,10 @@ bin/dump/dump_gsc.sh lib64/libevent.so lib64/libion.so +# Odex +framework/oat/arm64/com.google.android.camera.experimental2024.odex +framework/oat/arm64/com.google.android.camera.experimental2024.vdex + # Completely skip files that are not required # Google diff --git a/komodo/extract-files.py b/komodo/extract-files.py new file mode 100755 index 00000000..c55a93c6 --- /dev/null +++ b/komodo/extract-files.py @@ -0,0 +1,98 @@ +#!/usr/bin/env -S PYTHONPATH=../../../../tools/extract-utils python3 +# +# SPDX-FileCopyrightText: 2024 The LineageOS Project +# SPDX-License-Identifier: Apache-2.0 +# + +from extract_utils.extract import extract_fns_user_type +from extract_utils.extract_pixel import ( + extract_pixel_factory_image, + extract_pixel_firmware, + pixel_factory_image_regex, + pixel_firmware_regex, +) +from extract_utils.file import FileArgs, FileList +from extract_utils.fixups_blob import ( + blob_fixup, + blob_fixups_user_type, +) +from extract_utils.fixups_lib import ( + lib_fixups, + lib_fixups_user_type, +) +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'device/google/caimito', + 'hardware/google/av', + 'hardware/google/gchips', + 'hardware/google/graphics/common', + 'hardware/google/interfaces', + 'hardware/google/pixel', +] + + +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, + ( + 'com.google.edgetpu_app_service-V4-ndk', + 'com.google.edgetpu_vendor_service-V2-ndk', + 'vendor.google.whitechapel.audio.audioext@4.0', + 'vendor.google.whitechapel.audio.extension-V2-ndk', + ): lib_fixup_vendor_suffix, +} + +blob_fixups: blob_fixups_user_type = { + 'product/etc/felica/common.cfg': blob_fixup() + .patch_file('osaifu-keitai.patch'), + 'vendor/etc/init/init.modem_logging_control.rc': blob_fixup() + .regex_replace(' && property:ro.debuggable=0', ''), +} # fmt: skip + +extract_fns: extract_fns_user_type = { + pixel_factory_image_regex: extract_pixel_factory_image, + pixel_firmware_regex: extract_pixel_firmware, +} + +module = ExtractUtilsModule( + 'komodo', + 'google', + device_rel_path='device/google/caimito/komodo', + blob_fixups=blob_fixups, + lib_fixups=lib_fixups, + namespace_imports=namespace_imports, + add_generated_carriersettings_file=True, + add_firmware_proprietary_file=True, + extract_fns=extract_fns, +) + + +def fix_vendor_file_list(file_list: FileList): + module_suffix_file_paths = [ + 'vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so', + 'vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so', + 'vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so', + 'vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so', + ] + + for file_path in module_suffix_file_paths: + file_list.get_file(file_path).set_arg(FileArgs.MODULE_SUFFIX, '_vendor') + + +module.add_generated_proprietary_file( + 'proprietary-files-vendor.txt', + partition='vendor', + skip_file_list_name='skip-files-vendor.txt', + fix_file_list=fix_vendor_file_list, +) + +if __name__ == '__main__': + utils = ExtractUtils.device(module) + utils.run() diff --git a/komodo/extract-files.sh b/komodo/extract-files.sh deleted file mode 100755 index f6adfaa4..00000000 --- a/komodo/extract-files.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -DEVICE=komodo -VENDOR=google - -# 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 - -ONLY_FIRMWARE= -KANG= -SECTION= -CARRIER_SKIP_FILES=() -VENDOR_SKIP_FILES=() - -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 - product/etc/felica/common.cfg) - [ "$2" = "" ] && return 0 - sed -i -e '$a00000018,1' -e '/^00000014/d' -e '/^00000015/d' "${2}" - ;; - vendor/etc/init/init.modem_logging_control.rc) - [ "$2" = "" ] && return 0 - sed -i 's/ && property:ro.debuggable=0//' "${2}" - ;; - *) - return 1 - ;; - esac - - return 0 -} - -function blob_fixup_dry() { - blob_fixup "$1" "" -} - -function prepare_firmware() { - if [ "${SRC}" != "adb" ]; then - bash "${ANDROID_ROOT}"/lineage/scripts/pixel/prepare-firmware.sh "${DEVICE}" "${SRC}" - fi -} - -# Initialize the helper -setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" - -if [ -z "${ONLY_FIRMWARE}" ]; then - extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" - - generate_prop_list_from_image "product.img" "${MY_DIR}/proprietary-files-carriersettings.txt" CARRIER_SKIP_FILES carriersettings - extract "${MY_DIR}/proprietary-files-carriersettings.txt" "${SRC}" "${KANG}" --section "${SECTION}" - - readarray -t VENDOR_SKIP_FILES < <(cat "${MY_DIR}/skip-files-vendor.txt" | sed -E "/^[[:blank:]]*(#|$)/d") - VENDOR_TXT="${MY_DIR}/proprietary-files-vendor.txt" - generate_prop_list_from_image "vendor.img" "${VENDOR_TXT}" VENDOR_SKIP_FILES - - set_module_suffix "vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so" "-vendor" "${VENDOR_TXT}" - - extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}" -fi - -if [ -z "${SECTION}" ]; then - extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}" -fi - -"${MY_DIR}/setup-makefiles.sh" diff --git a/komodo/osaifu-keitai.patch b/komodo/osaifu-keitai.patch new file mode 100644 index 00000000..83d6d0ef --- /dev/null +++ b/komodo/osaifu-keitai.patch @@ -0,0 +1,24 @@ +From aab255f2807cfc460c0dce40decd5554d49c0076 Mon Sep 17 00:00:00 2001 +From: jabashque +Date: Mon, 5 Feb 2024 21:36:03 +0000 +Subject: [PATCH 1/1] Enable Osaifu-Keitai on non-Japanese SKUs + +--- + common.cfg | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/common.cfg b/common.cfg +index 3b78765..00f53cb 100644 +--- a/common.cfg ++++ b/common.cfg +@@ -11,6 +11,5 @@ + 02030001,0 + 02030002,0 + 02030003,intent:#Intent;action=android.settings.NFC_SETTINGS;end +-00000014,content://com.google.android.pixelnfc.provider.DeviceInfoContentProvider/isJapanSku +-00000015,is_japan_sku + 00000016,0001 ++00000018,1 +-- +2.47.0 + diff --git a/komodo/proprietary-files-vendor.txt b/komodo/proprietary-files-vendor.txt index e87fbbd1..2ae470c7 100644 --- a/komodo/proprietary-files-vendor.txt +++ b/komodo/proprietary-files-vendor.txt @@ -2732,8 +2732,8 @@ vendor/lib64/android.hardware.weaver2-impl.nos.so vendor/lib64/aocx-ndk.so vendor/lib64/com.google.edgetpu.dba-V1-ndk.so vendor/lib64/com.google.edgetpu.tachyon-V1-ndk.so -vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so;MODULE_SUFFIX=-vendor -vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=-vendor +vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so;MODULE_SUFFIX=_vendor +vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=_vendor vendor/lib64/com.google.hardware.biometrics.fingerprint.fingerprint-ext-V1-ndk.so vendor/lib64/com.google.input-V2-ndk.so vendor/lib64/com.google.input-V3-ndk.so @@ -2839,8 +2839,8 @@ vendor/lib64/vendor.google.battery_mitigation.service_static.so vendor/lib64/vendor.google.bluetooth_ext-V1-ndk.so vendor/lib64/vendor.google.google_battery-V3-ndk.so vendor/lib64/vendor.google.radio_ext-V1-ndk.so -vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so;MODULE_SUFFIX=-vendor -vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so;MODULE_SUFFIX=-vendor +vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so;MODULE_SUFFIX=_vendor +vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so;MODULE_SUFFIX=_vendor vendor/lib64/vendor.google.whitechapel.audio.hal.audio.so vendor/lib64/vendor.google.whitechapel.audio.hal.audio.sound_dose.aoc.so vendor/lib64/vendor.google.whitechapel.audio.hal.effect.so diff --git a/komodo/setup-makefiles.py b/komodo/setup-makefiles.py new file mode 100755 index 00000000..32947cfe --- /dev/null +++ b/komodo/setup-makefiles.py @@ -0,0 +1 @@ +#!./extract-files.py --regenerate_makefiles diff --git a/komodo/setup-makefiles.sh b/komodo/setup-makefiles.sh deleted file mode 100755 index fafb328a..00000000 --- a/komodo/setup-makefiles.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -DEVICE=komodo -VENDOR=google - -# 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}" - -function vendor_imports() { - cat <>"$1" - "device/google/caimito", - "hardware/google/av", - "hardware/google/gchips", - "hardware/google/graphics/common", - "hardware/google/interfaces", - "hardware/google/pixel", -EOF -} - -function lib_to_package_fixup_vendor_variants() { - if [ "$2" != "vendor" ]; then - return 1 - fi - - case "$1" in - com.google.edgetpu_app_service-V4-ndk | \ - com.google.edgetpu_vendor_service-V2-ndk | \ - vendor.google.whitechapel.audio.audioext@4.0 | \ - vendor.google.whitechapel.audio.extension-V2-ndk) - echo "$1-vendor" - ;; - libprotobuf-cpp-full-21.12) - echo "libprotobuf-cpp-full" - ;; - libprotobuf-cpp-lite-21.12) - echo "libprotobuf-cpp-lite" - ;; - *) - return 1 - ;; - esac -} - -function lib_to_package_fixup() { - lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || - lib_to_package_fixup_proto_3_9_1 "$1" || - lib_to_package_fixup_vendor_variants "$@" -} - -# Initialize the helper -setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" - -# Warning headers and guards -write_headers - -write_makefiles "${MY_DIR}/proprietary-files.txt" -write_makefiles "${MY_DIR}/proprietary-files-carriersettings.txt" -write_makefiles "${MY_DIR}/proprietary-files-vendor.txt" - -append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt" - -# Finish -write_footers diff --git a/komodo/skip-files-vendor.txt b/komodo/skip-files-vendor.txt index 23af5347..2ef75e2a 100644 --- a/komodo/skip-files-vendor.txt +++ b/komodo/skip-files-vendor.txt @@ -1053,6 +1053,10 @@ bin/dump/dump_gsc.sh lib64/libevent.so lib64/libion.so +# Odex +framework/oat/arm64/com.google.android.camera.experimental2024.odex +framework/oat/arm64/com.google.android.camera.experimental2024.vdex + # Completely skip files that are not required # Google diff --git a/tokay/extract-files.py b/tokay/extract-files.py new file mode 100755 index 00000000..68026053 --- /dev/null +++ b/tokay/extract-files.py @@ -0,0 +1,98 @@ +#!/usr/bin/env -S PYTHONPATH=../../../../tools/extract-utils python3 +# +# SPDX-FileCopyrightText: 2024 The LineageOS Project +# SPDX-License-Identifier: Apache-2.0 +# + +from extract_utils.extract import extract_fns_user_type +from extract_utils.extract_pixel import ( + extract_pixel_factory_image, + extract_pixel_firmware, + pixel_factory_image_regex, + pixel_firmware_regex, +) +from extract_utils.file import FileArgs, FileList +from extract_utils.fixups_blob import ( + blob_fixup, + blob_fixups_user_type, +) +from extract_utils.fixups_lib import ( + lib_fixups, + lib_fixups_user_type, +) +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'device/google/caimito', + 'hardware/google/av', + 'hardware/google/gchips', + 'hardware/google/graphics/common', + 'hardware/google/interfaces', + 'hardware/google/pixel', +] + + +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, + ( + 'com.google.edgetpu_app_service-V4-ndk', + 'com.google.edgetpu_vendor_service-V2-ndk', + 'vendor.google.whitechapel.audio.audioext@4.0', + 'vendor.google.whitechapel.audio.extension-V2-ndk', + ): lib_fixup_vendor_suffix, +} + +blob_fixups: blob_fixups_user_type = { + 'product/etc/felica/common.cfg': blob_fixup() + .patch_file('osaifu-keitai.patch'), + 'vendor/etc/init/init.modem_logging_control.rc': blob_fixup() + .regex_replace(' && property:ro.debuggable=0', ''), +} # fmt: skip + +extract_fns: extract_fns_user_type = { + pixel_factory_image_regex: extract_pixel_factory_image, + pixel_firmware_regex: extract_pixel_firmware, +} + +module = ExtractUtilsModule( + 'tokay', + 'google', + device_rel_path='device/google/caimito/tokay', + blob_fixups=blob_fixups, + lib_fixups=lib_fixups, + namespace_imports=namespace_imports, + add_generated_carriersettings_file=True, + add_firmware_proprietary_file=True, + extract_fns=extract_fns, +) + + +def fix_vendor_file_list(file_list: FileList): + module_suffix_file_paths = [ + 'vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so', + 'vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so', + 'vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so', + 'vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so', + ] + + for file_path in module_suffix_file_paths: + file_list.get_file(file_path).set_arg(FileArgs.MODULE_SUFFIX, '_vendor') + + +module.add_generated_proprietary_file( + 'proprietary-files-vendor.txt', + partition='vendor', + skip_file_list_name='skip-files-vendor.txt', + fix_file_list=fix_vendor_file_list, +) + +if __name__ == '__main__': + utils = ExtractUtils.device(module) + utils.run() diff --git a/tokay/extract-files.sh b/tokay/extract-files.sh deleted file mode 100755 index a9223ddd..00000000 --- a/tokay/extract-files.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -DEVICE=tokay -VENDOR=google - -# 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 - -ONLY_FIRMWARE= -KANG= -SECTION= -CARRIER_SKIP_FILES=() -VENDOR_SKIP_FILES=() - -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 - product/etc/felica/common.cfg) - [ "$2" = "" ] && return 0 - sed -i -e '$a00000018,1' -e '/^00000014/d' -e '/^00000015/d' "${2}" - ;; - vendor/etc/init/init.modem_logging_control.rc) - [ "$2" = "" ] && return 0 - sed -i 's/ && property:ro.debuggable=0//' "${2}" - ;; - *) - return 1 - ;; - esac - - return 0 -} - -function blob_fixup_dry() { - blob_fixup "$1" "" -} - -function prepare_firmware() { - if [ "${SRC}" != "adb" ]; then - bash "${ANDROID_ROOT}"/lineage/scripts/pixel/prepare-firmware.sh "${DEVICE}" "${SRC}" - fi -} - -# Initialize the helper -setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" - -if [ -z "${ONLY_FIRMWARE}" ]; then - extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" - - generate_prop_list_from_image "product.img" "${MY_DIR}/proprietary-files-carriersettings.txt" CARRIER_SKIP_FILES carriersettings - extract "${MY_DIR}/proprietary-files-carriersettings.txt" "${SRC}" "${KANG}" --section "${SECTION}" - - readarray -t VENDOR_SKIP_FILES < <(cat "${MY_DIR}/skip-files-vendor.txt" | sed -E "/^[[:blank:]]*(#|$)/d") - VENDOR_TXT="${MY_DIR}/proprietary-files-vendor.txt" - generate_prop_list_from_image "vendor.img" "${VENDOR_TXT}" VENDOR_SKIP_FILES - - set_module_suffix "vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so" "-vendor" "${VENDOR_TXT}" - set_module_suffix "vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so" "-vendor" "${VENDOR_TXT}" - - extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}" -fi - -if [ -z "${SECTION}" ]; then - extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}" -fi - -"${MY_DIR}/setup-makefiles.sh" diff --git a/tokay/osaifu-keitai.patch b/tokay/osaifu-keitai.patch new file mode 100644 index 00000000..83d6d0ef --- /dev/null +++ b/tokay/osaifu-keitai.patch @@ -0,0 +1,24 @@ +From aab255f2807cfc460c0dce40decd5554d49c0076 Mon Sep 17 00:00:00 2001 +From: jabashque +Date: Mon, 5 Feb 2024 21:36:03 +0000 +Subject: [PATCH 1/1] Enable Osaifu-Keitai on non-Japanese SKUs + +--- + common.cfg | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/common.cfg b/common.cfg +index 3b78765..00f53cb 100644 +--- a/common.cfg ++++ b/common.cfg +@@ -11,6 +11,5 @@ + 02030001,0 + 02030002,0 + 02030003,intent:#Intent;action=android.settings.NFC_SETTINGS;end +-00000014,content://com.google.android.pixelnfc.provider.DeviceInfoContentProvider/isJapanSku +-00000015,is_japan_sku + 00000016,0001 ++00000018,1 +-- +2.47.0 + diff --git a/tokay/proprietary-files-vendor.txt b/tokay/proprietary-files-vendor.txt index fda140a0..da7f8976 100644 --- a/tokay/proprietary-files-vendor.txt +++ b/tokay/proprietary-files-vendor.txt @@ -2723,8 +2723,8 @@ vendor/lib64/android.hardware.weaver2-impl.nos.so vendor/lib64/aocx-ndk.so vendor/lib64/com.google.edgetpu.dba-V1-ndk.so vendor/lib64/com.google.edgetpu.tachyon-V1-ndk.so -vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so;MODULE_SUFFIX=-vendor -vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=-vendor +vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so;MODULE_SUFFIX=_vendor +vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=_vendor vendor/lib64/com.google.hardware.biometrics.fingerprint.fingerprint-ext-V1-ndk.so vendor/lib64/com.google.input-V2-ndk.so vendor/lib64/com.google.input-V3-ndk.so @@ -2830,8 +2830,8 @@ vendor/lib64/vendor.google.battery_mitigation.service_static.so vendor/lib64/vendor.google.bluetooth_ext-V1-ndk.so vendor/lib64/vendor.google.google_battery-V3-ndk.so vendor/lib64/vendor.google.radio_ext-V1-ndk.so -vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so;MODULE_SUFFIX=-vendor -vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so;MODULE_SUFFIX=-vendor +vendor/lib64/vendor.google.whitechapel.audio.audioext@4.0.so;MODULE_SUFFIX=_vendor +vendor/lib64/vendor.google.whitechapel.audio.extension-V2-ndk.so;MODULE_SUFFIX=_vendor vendor/lib64/vendor.google.whitechapel.audio.hal.audio.so vendor/lib64/vendor.google.whitechapel.audio.hal.audio.sound_dose.aoc.so vendor/lib64/vendor.google.whitechapel.audio.hal.effect.so diff --git a/tokay/setup-makefiles.py b/tokay/setup-makefiles.py new file mode 100755 index 00000000..32947cfe --- /dev/null +++ b/tokay/setup-makefiles.py @@ -0,0 +1 @@ +#!./extract-files.py --regenerate_makefiles diff --git a/tokay/setup-makefiles.sh b/tokay/setup-makefiles.sh deleted file mode 100755 index 1cf89501..00000000 --- a/tokay/setup-makefiles.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -DEVICE=tokay -VENDOR=google - -# 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}" - -function vendor_imports() { - cat <>"$1" - "device/google/caimito", - "hardware/google/av", - "hardware/google/gchips", - "hardware/google/graphics/common", - "hardware/google/interfaces", - "hardware/google/pixel", -EOF -} - -function lib_to_package_fixup_vendor_variants() { - if [ "$2" != "vendor" ]; then - return 1 - fi - - case "$1" in - com.google.edgetpu_app_service-V4-ndk | \ - com.google.edgetpu_vendor_service-V2-ndk | \ - vendor.google.whitechapel.audio.audioext@4.0 | \ - vendor.google.whitechapel.audio.extension-V2-ndk) - echo "$1-vendor" - ;; - libprotobuf-cpp-full-21.12) - echo "libprotobuf-cpp-full" - ;; - libprotobuf-cpp-lite-21.12) - echo "libprotobuf-cpp-lite" - ;; - *) - return 1 - ;; - esac -} - -function lib_to_package_fixup() { - lib_to_package_fixup_clang_rt_ubsan_standalone "$1" || - lib_to_package_fixup_proto_3_9_1 "$1" || - lib_to_package_fixup_vendor_variants "$@" -} - -# Initialize the helper -setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" - -# Warning headers and guards -write_headers - -write_makefiles "${MY_DIR}/proprietary-files.txt" -write_makefiles "${MY_DIR}/proprietary-files-carriersettings.txt" -write_makefiles "${MY_DIR}/proprietary-files-vendor.txt" - -append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt" - -# Finish -write_footers diff --git a/tokay/skip-files-vendor.txt b/tokay/skip-files-vendor.txt index 62daa24e..4b2f61a9 100644 --- a/tokay/skip-files-vendor.txt +++ b/tokay/skip-files-vendor.txt @@ -1044,6 +1044,10 @@ bin/dump/dump_gsc.sh lib64/libevent.so lib64/libion.so +# Odex +framework/oat/arm64/com.google.android.camera.experimental2024.odex +framework/oat/arm64/com.google.android.camera.experimental2024.vdex + # Completely skip files that are not required # Google