diff --git a/Patches/LineageOS-14.1/android_system_bt/0001-NO_READENCRKEYSIZE.patch b/Patches/LineageOS-14.1/android_system_bt/0001-NO_READENCRKEYSIZE.patch new file mode 100644 index 00000000..26529fe8 --- /dev/null +++ b/Patches/LineageOS-14.1/android_system_bt/0001-NO_READENCRKEYSIZE.patch @@ -0,0 +1,47 @@ +From f7fceea92ea8d1ac0ea8164d35a42721ad27aa98 Mon Sep 17 00:00:00 2001 +From: Tad +Date: Wed, 6 Oct 2021 04:49:33 -0400 +Subject: [PATCH] Add an option to disable the assert added in fc2ca9ee + +To prevent breaking Bluetooth on devices that lack such command. + +Signed-off-by: Tad +Change-Id: If4853d441bdf5ad728c8637a56c8ec7785794dda +--- + Android.mk | 4 ++++ + device/src/controller.c | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/Android.mk b/Android.mk +index b370cc06f..3fff6aa16 100644 +--- a/Android.mk ++++ b/Android.mk +@@ -21,6 +21,10 @@ ifeq ($(TARGET_BUILD_VARIANT),eng) + bluetooth_CFLAGS += -DBLUEDROID_DEBUG + endif + ++ifeq ($(TARGET_BLUETOOTH_NO_READENCRKEYSIZE),true) ++bluetooth_CFLAGS += -DNO_READENCRKEYSIZE ++endif ++ + bluetooth_CFLAGS += -DUSE_AUDIO_TRACK + + bluetooth_CFLAGS += -DEXPORT_SYMBOL="__attribute__((visibility(\"default\")))" +diff --git a/device/src/controller.c b/device/src/controller.c +index 60820c2c0..89963dc30 100644 +--- a/device/src/controller.c ++++ b/device/src/controller.c +@@ -293,8 +293,9 @@ static future_t *start_up(void) { + response, + &number_of_local_supported_codecs, local_supported_codecs); + } +- ++#ifndef NO_READENCRKEYSIZE + assert(HCI_READ_ENCR_KEY_SIZE_SUPPORTED(supported_commands)); ++#endif + + readable = true; + return future_new_immediate(FUTURE_SUCCESS); +-- +2.31.1 + diff --git a/Scripts/LineageOS-14.1/Functions.sh b/Scripts/LineageOS-14.1/Functions.sh index c3bacd42..cc851ffe 100644 --- a/Scripts/LineageOS-14.1/Functions.sh +++ b/Scripts/LineageOS-14.1/Functions.sh @@ -98,6 +98,7 @@ patchWorkspace() { repopick -it n-asb-2021-08; repopick -i 315718; #CVE-2021-1957 repopick -it n-asb-2021-09; + repopick -it n-asb-2021-10; source "$DOS_SCRIPTS/Patch.sh"; source "$DOS_SCRIPTS_COMMON/Copy_Keys.sh"; diff --git a/Scripts/LineageOS-14.1/Patch.sh b/Scripts/LineageOS-14.1/Patch.sh index 96fd1b33..012d5209 100644 --- a/Scripts/LineageOS-14.1/Patch.sh +++ b/Scripts/LineageOS-14.1/Patch.sh @@ -255,6 +255,7 @@ if enterAndClear "system/bt"; then patch -p1 < "$DOS_PATCHES/android_system_bt/229574.patch"; #Increase maximum Bluetooth SBC codec bitrate for SBC HD patch -p1 < "$DOS_PATCHES/android_system_bt/229575.patch"; #Explicit SBC Dual Channel (SBC HD) support patch -p1 < "$DOS_PATCHES/android_system_bt/242134.patch"; #avrc_bld_get_attrs_rsp - fix attribute length position off by one +patch -p1 < "$DOS_PATCHES/android_system_bt/0001-NO_READENCRKEYSIZE.patch"; #Add an option to let devices opt-out of the HCI_READ_ENCR_KEY_SIZE_SUPPORTED assert fi; if enterAndClear "system/core"; then @@ -312,6 +313,7 @@ fi; #START OF DEVICE CHANGES # if enterAndClear "device/amazon/hdx-common"; then +echo "TARGET_BLUETOOTH_NO_READENCRKEYSIZE := true" >> BoardConfigCommon.mk; #Fix BT crash sed -i 's/,encryptable=footer//' rootdir/etc/fstab.qcom; #Using footer will break the bootloader, it might work with /misc enabled #XXX: If not used with a supported recovery, it'll be thrown into a bootloop, don't worry just 'fastboot erase misc' and reboot #echo "/dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults" >> rootdir/etc/fstab.qcom; #Add the misc (mmcblk0p5) partition for recovery flags