diff --git a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp index d3153b4a1ea..fcdde473d2b 100644 --- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp @@ -371,17 +371,13 @@ BluetoothHfpManager::ResetCallArray() } void -BluetoothHfpManager::Reset() +BluetoothHfpManager::Cleanup() { mReceiveVgsFlag = false; mDialingRequestProcessed = true; mConnectionState = BTHF_CONNECTION_STATE_DISCONNECTED; mPrevConnectionState = BTHF_CONNECTION_STATE_DISCONNECTED; - mAudioState = BTHF_AUDIO_STATE_DISCONNECTED; - - // Phone & Device CIND - ResetCallArray(); mBattChg = 5; mService = 0; mRoam = 0; @@ -390,6 +386,16 @@ BluetoothHfpManager::Reset() mController = nullptr; } +void +BluetoothHfpManager::Reset() +{ + // Phone & Device CIND + ResetCallArray(); + // Clear Sco state + mAudioState = BTHF_AUDIO_STATE_DISCONNECTED; + Cleanup(); +} + bool BluetoothHfpManager::Init() { @@ -818,7 +824,7 @@ BluetoothHfpManager::NotifyConnectionStateChanged(const nsAString& aType) } else { OnDisconnect(EmptyString()); } - Reset(); + Cleanup(); } } } diff --git a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h index 3c09fa9dc2f..f6607561fe5 100644 --- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h +++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.h @@ -136,6 +136,7 @@ private: BluetoothHfpManager(); bool Init(); + void Cleanup(); void HandleShutdown(); void HandleVolumeChanged(const nsAString& aData);