AudioService: cleanup sco audio mode upon disconnection.

Clean up SCO forced usage and A2DP suspend state upon
SCO device or profile disconnection.
This is in case the Bluetooth Headset service does not
do it.

Bug: 24316765.
Change-Id: Ifc0305607c186be49b2eb42b7868647292e56137
This commit is contained in:
Eric Laurent
2015-09-24 18:41:48 -07:00
parent e1de9f6745
commit 48221250ba

View File

@@ -2527,11 +2527,14 @@ public class AudioService extends IAudioService.Stub {
}
/** @see AudioManager#setBluetoothScoOn(boolean) */
public void setBluetoothScoOn(boolean on){
public void setBluetoothScoOn(boolean on) {
if (!checkAudioSettingsPermission("setBluetoothScoOn()")) {
return;
}
setBluetoothScoOnInt(on);
}
public void setBluetoothScoOnInt(boolean on) {
if (on) {
mForcedUseForComm = AudioSystem.FORCE_BT_SCO;
} else if (mForcedUseForComm == AudioSystem.FORCE_BT_SCO) {
@@ -2892,6 +2895,8 @@ public class AudioService extends IAudioService.Stub {
mScoAudioState = SCO_STATE_INACTIVE;
broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED);
}
AudioSystem.setParameters("A2dpSuspended=false");
setBluetoothScoOnInt(false);
}
private void broadcastScoConnectionState(int state) {