1
0
mirror of https://github.com/ponces/treble_aosp.git synced 2024-11-22 06:36:13 +00:00
treble_aosp/patches/trebledroid/platform_packages_modules_Bluetooth/0005-On-Samsung-devices-we-need-to-tell-Audio-HAL-if-we-r.patch
2024-06-18 10:56:01 +01:00

68 lines
2.7 KiB
Diff

From 2a3b6faebd0bef5228786f6306460063da9066e1 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@cryptomilk.org>
Date: Sat, 12 Nov 2022 00:35:46 +0000
Subject: [PATCH 5/8] On Samsung devices, we need to tell Audio HAL if we're
running narrow band or wide band
Ported to Android 13.
Change-Id: I7802b7a29c017a2cd7018e82772183df1dfa0b89
---
.../com/android/bluetooth/hfp/HeadsetStateMachine.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 38db4dc656..f764f6aa9d 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -158,6 +158,7 @@ public class HeadsetStateMachine extends StateMachine {
private boolean mHasWbsEnabled = false;
private boolean mHasSwbLc3Enabled = false;
private boolean mHasSwbAptXEnabled = false;
+ private int mReportScoSampleRate = 0;
// AT Phone book keeps a group of states used by AT+CPBR commands
@VisibleForTesting
final AtPhonebook mPhonebook;
@@ -277,6 +278,7 @@ public class HeadsetStateMachine extends StateMachine {
mHasNrecEnabled = false;
mHasSwbLc3Enabled = false;
mHasSwbAptXEnabled = false;
+ mReportScoSampleRate = 0;
}
public void dump(StringBuilder sb) {
@@ -518,6 +520,7 @@ public class HeadsetStateMachine extends StateMachine {
mHasSwbLc3Enabled = false;
mHasNrecEnabled = false;
mHasSwbAptXEnabled = false;
+ mReportScoSampleRate = 0;
broadcastStateTransitions();
logFailureIfNeeded();
@@ -1704,6 +1707,9 @@ public class HeadsetStateMachine extends StateMachine {
am.setParameters("bt_swb=" + (mHasSwbAptXEnabled ? "0" : "65535"));
}
am.setBluetoothHeadsetProperties(getCurrentDeviceName(), mHasNrecEnabled, mHasWbsEnabled);
+ if (mReportScoSampleRate > 0) {
+ am.setParameters("g_sco_samplerate=" + mReportScoSampleRate);
+ }
}
@VisibleForTesting
@@ -1847,10 +1853,12 @@ public class HeadsetStateMachine extends StateMachine {
switch (wbsConfig) {
case HeadsetHalConstants.BTHF_WBS_YES:
mHasWbsEnabled = true;
+ mReportScoSampleRate = 16000;
break;
case HeadsetHalConstants.BTHF_WBS_NO:
case HeadsetHalConstants.BTHF_WBS_NONE:
mHasWbsEnabled = false;
+ mReportScoSampleRate = 8000;
break;
default:
Log.e(TAG, "processWBSEvent: unknown wbsConfig " + wbsConfig);
--
2.34.1