Skip to content
Snippets Groups Projects
Commit ba8d581c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "FM: Take care of audio routing when BT is connected and disconnected."

parents 61bc467c b7941f7f
No related branches found
No related tags found
No related merge requests found
...@@ -553,7 +553,9 @@ public class FMRadioService extends Service ...@@ -553,7 +553,9 @@ public class FMRadioService extends Service
// audio policy manager switch audio to speaker. // audio policy manager switch audio to speaker.
mHandler.removeCallbacks(mHeadsetPluginHandler); mHandler.removeCallbacks(mHeadsetPluginHandler);
mHandler.post(mHeadsetPluginHandler); mHandler.post(mHeadsetPluginHandler);
} else if(mA2dpDeviceState.isA2dpStateChange(action) ) { } else if(mA2dpDeviceState.isA2dpStateChange(action) &&
(mA2dpDeviceState.isConnected(intent) ||
mA2dpDeviceState.isDisconnected(intent))) {
boolean bA2dpConnected = boolean bA2dpConnected =
mA2dpDeviceState.isConnected(intent); mA2dpDeviceState.isConnected(intent);
Log.d(LOGTAG, "bA2dpConnected:" +bA2dpConnected); Log.d(LOGTAG, "bA2dpConnected:" +bA2dpConnected);
......
...@@ -65,6 +65,15 @@ public class A2dpDeviceStatus { ...@@ -65,6 +65,15 @@ public class A2dpDeviceStatus {
} }
return isConnected; return isConnected;
} }
public boolean isDisconnected(Intent intent) {
boolean isDisconnected = false;
int state = intent.getIntExtra(BluetoothA2dp.EXTRA_STATE,
BluetoothA2dp.STATE_CONNECTED);
if((state == BluetoothA2dp.STATE_DISCONNECTED)) {
isDisconnected = true;
}
return isDisconnected;
}
public boolean isPlaying(Intent intent) { public boolean isPlaying(Intent intent) {
boolean isPlaying = false; boolean isPlaying = false;
int state = intent.getIntExtra(BluetoothA2dp.EXTRA_STATE, int state = intent.getIntExtra(BluetoothA2dp.EXTRA_STATE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment