Skip to content

Commit

Permalink
On Samsung devices, we need to tell Audio HAL if we're running narrow…
Browse files Browse the repository at this point in the history
… band or wide band

Ported to Android 13.

Change-Id: I7802b7a29c017a2cd7018e82772183df1dfa0b89
  • Loading branch information
cryptomilk authored and AndyCGYan committed Apr 17, 2023
1 parent 88e0ca8 commit e717a2f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public class HeadsetStateMachine extends StateMachine {
// Audio Parameters
private boolean mHasNrecEnabled = false;
private boolean mHasWbsEnabled = false;
private int mReportScoSampleRate = 0;
// AT Phone book keeps a group of states used by AT+CPBR commands
@VisibleForTesting
final AtPhonebook mPhonebook;
Expand Down Expand Up @@ -228,6 +229,7 @@ public void cleanup() {
}
mHasWbsEnabled = false;
mHasNrecEnabled = false;
mReportScoSampleRate = 0;
}

public void dump(StringBuilder sb) {
Expand Down Expand Up @@ -457,6 +459,7 @@ public void enter() {
mNeedDialingOutReply = false;
mHasWbsEnabled = false;
mHasNrecEnabled = false;
mReportScoSampleRate = 0;
broadcastStateTransitions();
// Remove the state machine for unbonded devices
if (mPrevState != null
Expand Down Expand Up @@ -1542,6 +1545,9 @@ private void setAudioParameters() {
+ " hasNrecEnabled=" + mHasNrecEnabled
+ " hasWbsEnabled=" + mHasWbsEnabled);
am.setBluetoothHeadsetProperties(getCurrentDeviceName(), mHasNrecEnabled, mHasWbsEnabled);
if (mReportScoSampleRate > 0) {
am.setParameters("g_sco_samplerate=" + mReportScoSampleRate);
}
}

@VisibleForTesting
Expand Down Expand Up @@ -1685,10 +1691,12 @@ private void processWBSEvent(int wbsConfig) {
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);
Expand Down

0 comments on commit e717a2f

Please sign in to comment.