[Galaxy S I9000 Android Development] dangrayorg:
Bluetooth playback bug

Hi,

I have a problem with Bluetooth audio streaming. A2DP works find when you start the phone and connect a paired speaker. Combinations of powering speakers on and off do not seem to manifest tbis bug, with audio seamlessly transferring from internal speaker to the Bluetooth device, likewise with cycling Bluetooth on the phone.

If you carry the phone out of range from the speakers, however, so that contact is lost, and then bring it back into range and re-connect to the speakers, media playing applications attempt to use the bluetooth audio (so internal speaker is silent and the volume rocker still adjusts Bluetooth audio volume), but sound is not heard from the speakers.

Please see logcat below, in this instance audio was already playing through the internal speaker when I re-enabled bluetooth on the phone, expected behavior was a smooth transfer from internal speaker to A2DP speaker, actual behavior was apparent transfer but no audio:

I/AudioService( 195): AudioFocus abandonAudioFocus() from android.media.AudioManager@413120f8com.maxmpz.audioplayer.player.PlayerService$19@412c7e98
D/dalvikvm(20115): GC_EXPLICIT freed 288K, 31% free 7555K/10887K, paused 2ms+2ms
W/PlayerService(20115): Poweramp Player Service leaves the scene
D/BluetoothAdapterStateMachine( 195): HotOff process message: 1
D/BluetoothAdapterStateMachine( 195): Bluetooth state 10 -> 11
V/BluetoothEventManager(20802): Received android.bluetooth.adapter.action.STATE_CHANGED
D/BluetoothEventLoop( 195): Property Changed: Powered : true
D/BluetoothAdapterStateMachine( 195): Switching process message: 54
D/BluetoothEventLoop( 195): Property Changed: Pairable : true
D/BluetoothEventLoop( 195): Property Changed: Class : 5898764
D/BluetoothEventLoop( 195): Property Changed: Pairable : true
D/BluetoothEventLoop( 195): Property Changed: Discoverable : false
D/BluetoothAdapterStateMachine( 195): Switching process message: 53
D/BluetoothBondState( 195): found 1 bonded devices
I/BluetoothDeviceProfileState( 195): Entering ACL Connected state with: -2
D/BluetoothAdapterStateMachine( 195): Bluetooth state 11 -> 12
V/BluetoothEventManager(20802): Received android.bluetooth.adapter.action.STATE_CHANGED
D/DockEventReceiver(20802): finishStartingService: stopping service
D/BluetoothA2dpService( 195): connectSink(00:02:5B:00:A5:A5)
I/BluetoothProfileState( 195): Message:Entering PendingCommandState State
I/BluetoothDeviceProfileState( 195): Entering OutgoingA2dp state with: 3
D/BluetoothA2dpService( 195): A2DP state : device: 00:02:5B:00:A5:A5 State:0->1
D/BluetoothService( 195): CONNECTION_STATE_CHANGE: 00:02:5B:00:A5:A5: 0 -> 1
D/BluetoothA2dpService( 195): A2DP: onSinkPropertyChanged newState is: 1mPlayingA2dpDevice: null
V/BluetoothEventManager(20802): Received android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED
D/CachedBluetoothDevice(20802): onProfileStateChanged: profile A2DP newProfileState 1
I/BtOppRfcommListener(16950): Accept thread started on channel 12
V/PhoneStatusBar( 278): setLightsOn(true)
W/InputManagerService( 195): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41603f50
D/BluetoothEventLoop( 195): Device property changed: 00:02:5B:00:A5:A5 property: Connected value: true
I/HeadsetService(18111): Headset=false; Bluetooth=true
I/HeadsetService(18111): Selected configuration: bluetooth
D/o (21012): bookmark force=false mainService=[binders=0][WakeLock=true][WifiLock=true][locks=[1: o]][downloading=false][playing=true][updating=false]
D/EventHub( 195): No input device configuration file found for device 'AVRCP'.
I/EventHub( 195): New device: id=18, fd=235, path='/dev/input/event9', name='AVRCP', classes=0x80000001, configuration='', keyLayout='/system/usr/keylayout/AVRCP.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false
I/InputReader( 195): Device added: id=18, name='AVRCP', sources=0x00000101
D/BluetoothA2dpService( 195): A2DP: onSinkPropertyChanged newState is: 2mPlayingA2dpDevice: null
I/BluetoothProfileState( 195): Message:Entering Stable State
D/A2DP ( 135): a2dp_init rate: 44100 channels: 2
D/BluetoothA2dpService( 195): A2DP state : device: 00:02:5B:00:A5:A5 State:1->2
D/BluetoothService( 195): CONNECTION_STATE_CHANGE: 00:02:5B:00:A5:A5: 1 -> 2
D/A2DP ( 135): a2dp_thread started
D/A2DP ( 135): bluetooth_init
V/BluetoothEventManager(20802): Received android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED
I/AudioFlinger( 135): AudioFlinger's thread 0xa2d3d8 ready to run
I/AudioFlinger( 135): AudioFlinger's thread 0xa1f1e0 ready to run
W/AudioTrack( 135): dead IAudioTrack, creating a new one from obtainBuffer() TID 21039
D/A2DP ( 135): a2dp_stop
D/A2DP ( 135): bluetooth_configure
D/A2DP ( 135): Received BT_RESPONSE - BT_GET_CAPABILITIES
E/A2DP ( 135): bluetooth_parse_capabilities failed err: -22
D/A2DP ( 135): bluetooth_close
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-19)
D/A2DP ( 135): bluetooth_init
I/BluetoothDeviceProfileState( 195): Entering ACL Connected state with: 102
D/CachedBluetoothDevice(20802): onProfileStateChanged: profile A2DP newProfileState 2
I/AudioService( 195): AudioFocus abandonAudioFocus() from android.media.AudioManager@413797c8com.google.android.music.MusicPlaybackService$8@413a8388
I/HeadsetService(18111): Audio session removed: 1730
I/MusicDL (17042): DownloadManager.onDestroy
I/HeadsetService(18111): Selected configuration: bluetooth
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-110)
W/AudioFlinger( 135): write blocked for 989 msecs, 1 delayed writes, thread 0xa1f1e0
D/A2DP ( 135): bluetooth_configure
D/A2DP ( 135): Received BT_RESPONSE - BT_GET_CAPABILITIES
E/A2DP ( 135): bluetooth_parse_capabilities failed err: -22
D/A2DP ( 135): bluetooth_close
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-19)
D/A2DP ( 135): bluetooth_init
D/A2DP ( 135): a2dp_stop
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-110)
W/AudioTrack( 135): obtainBuffer timed out (is the CPU pegged?) 0xa2e1a0 user=000b1cfe, server=000b0e7b
D/A2DP ( 135): bluetooth_configure
D/A2DP ( 135): Received BT_RESPONSE - BT_GET_CAPABILITIES
E/A2DP ( 135): bluetooth_parse_capabilities failed err: -22
D/A2DP ( 135): bluetooth_close
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-19)
D/A2DP ( 135): bluetooth_init
D/AudioHardware( 135): AudioHardware pcm playback is going to standby.
V/AudioHardware( 135): closeMixer_l() mMixerOpenCnt: 1
D/AudioHardware( 135): closePcmOut_l() mPcmOpenCnt: 1
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-110)
D/A2DP ( 135): bluetooth_configure
D/A2DP ( 135): Received BT_RESPONSE - BT_GET_CAPABILITIES
E/A2DP ( 135): bluetooth_parse_capabilities failed err: -22
D/A2DP ( 135): bluetooth_close
E/a2dp_audio_hw( 135): _out_buf_thread_func: a2dp_write failed (-19)
D/A2DP ( 135): bluetooth_init