Closed smithdtyler closed 9 years ago
Looks like this might be related to Android 4.3+ Potentially related SO post
Success case:
01-31 20:21:24.114: V/MediaPlayer[Native](18583): isPlaying: 1
01-31 20:21:24.114: V/MediaPlayer[Native](18583): getDuration_l
01-31 20:21:24.114: V/MediaPlayer[Native](18583): getCurrentPosition
01-31 20:21:24.224: I/ViewRootImpl(18583): ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PLAY, scanCode=200, metaState=0, flags=0x8, repeatCount=0, eventTime=457497212, downTime=457497212, deviceId=26, source=0x101 } to com.android.internal.policy.impl.PhoneWindow$DecorView{43f87d60 V.E..... R....... 0,0-1440,2392}
01-31 20:21:24.234: I/MusicBroadcastReceiver(18583): got a thingy!
01-31 20:21:24.234: I/MusicBroadcastReceiver(18583): Media Button Receiver: received media button intent: Intent { act=android.intent.action.MEDIA_BUTTON flg=0x10000010 cmp=com.smithdtyler.prettygoodmusicplayer/.MusicBroadcastReceiver (has extras) }
01-31 20:21:24.234: I/MusicBroadcastReceiver(18583): Got a key event
01-31 20:21:24.254: I/MusicBroadcastReceiver(18583): got a thingy!
01-31 20:21:24.254: I/MusicBroadcastReceiver(18583): Media Button Receiver: received media button intent: Intent { act=android.intent.action.MEDIA_BUTTON flg=0x10000010 cmp=com.smithdtyler.prettygoodmusicplayer/.MusicBroadcastReceiver (has extras) }
01-31 20:21:24.254: I/MusicBroadcastReceiver(18583): Got a key event
01-31 20:21:24.254: I/MusicBroadcastReceiver(18583): Got a key up event
01-31 20:21:24.254: I/MusicBroadcastReceiver(18583): key pressed KEYCODE_MEDIA_PLAY
01-31 20:21:24.254: I/MyService(18583): Received start id 12: Intent { cmp=com.smithdtyler.prettygoodmusicplayer/.MusicPlaybackService (has extras) }
01-31 20:21:24.254: I/ViewRootImpl(18583): ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PLAY, scanCode=200, metaState=0, flags=0x8, repeatCount=0, eventTime=457497243, downTime=457497212, deviceId=26, source=0x101 } to com.android.internal.policy.impl.PhoneWindow$DecorView{43f87d60 V.E..... R....... 0,0-1440,2392}
01-31 20:21:24.264: I/MusicPlaybackService(18583): I got a message! 3
01-31 20:21:24.264: I/MusicPlaybackService(18583): I got a playpause message
01-31 20:21:24.264: V/MediaPlayer[Native](18583): isPlaying: 1
01-31 20:21:24.264: V/MediaPlayer[Native](18583): isPlaying: 1
01-31 20:21:24.264: V/MediaPlayer[Native](18583): pause
01-31 20:21:24.264: V/MediaPlayer[Native](18583): message received msg=7, ext1=0, ext2=0
01-31 20:21:24.264: D/MediaPlayer[Native](18583): calling notify_player_state: 32
01-31 20:21:24.264: V/MediaPlayer[Native](18583): unrecognized message: (7, 0, 0)
01-31 20:21:24.264: V/MediaPlayer[Native](18583): callback application
01-31 20:21:24.264: V/MediaPlayer[Native](18583): back from callback
01-31 20:21:24.264: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.274: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.274: D/MediaPlayer[JAVA](18583): broadcasting MEDIA_CHANGE_PLAYER_STATE(no context) : 0x0
01-31 20:21:24.274: E/MediaPlayer[Native](18583): invoke invokeId=0xbe885270
01-31 20:21:24.274: E/MediaPlayer[Native](18583): invoke key=0xbe885274
01-31 20:21:24.274: E/MediaPlayer[Native](18583): [MediaPlayer::getMediaSystemInfo] key = 4000
01-31 20:21:24.274: V/MediaPlayer[Native](18583): invoke 72
01-31 20:21:24.274: D/MediaPlayer[Native](18583): invoke lgeInvokeId=0x7e000002
01-31 20:21:24.274: D/MediaPlayer[Native](18583): MediaPlayer::invoke::getparam
01-31 20:21:24.274: D/MediaPlayer[Native](18583): MediaPlayer::getParameter mCurrentState = 0x00000020
01-31 20:21:24.274: D/MediaPlayer[JAVA](18583): broadcasting MEDIA_CHANGE_PLAYER_STATE(no context) : state = 32
01-31 20:21:24.274: V/MediaPlayer[Native](18583): getCurrentPosition
01-31 20:21:24.274: V/MediaPlayer[Native](18583): getDuration_l
01-31 20:21:24.574: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.574: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.584: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.584: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.584: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:24.594: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:25.024: I/ViewRootImpl(18583): ViewRoot's KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PAUSE, scanCode=201, metaState=0, flags=0x8, repeatCount=0, eventTime=457498012, downTime=457498012, deviceId=26, source=0x101 } to com.android.internal.policy.impl.PhoneWindow$DecorView{43f87d60 V.E..... R....... 0,0-1440,2392}
01-31 20:21:25.034: I/MusicBroadcastReceiver(18583): got a thingy!
01-31 20:21:25.034: I/MusicBroadcastReceiver(18583): Media Button Receiver: received media button intent: Intent { act=android.intent.action.MEDIA_BUTTON flg=0x10000010 cmp=com.smithdtyler.prettygoodmusicplayer/.MusicBroadcastReceiver (has extras) }
01-31 20:21:25.034: I/MusicBroadcastReceiver(18583): Got a key event
01-31 20:21:25.054: I/MusicBroadcastReceiver(18583): got a thingy!
01-31 20:21:25.054: I/MusicBroadcastReceiver(18583): Media Button Receiver: received media button intent: Intent { act=android.intent.action.MEDIA_BUTTON flg=0x10000010 cmp=com.smithdtyler.prettygoodmusicplayer/.MusicBroadcastReceiver (has extras) }
01-31 20:21:25.054: I/MusicBroadcastReceiver(18583): Got a key event
01-31 20:21:25.054: I/MusicBroadcastReceiver(18583): Got a key up event
01-31 20:21:25.054: I/MusicBroadcastReceiver(18583): key pressed KEYCODE_MEDIA_PAUSE
01-31 20:21:25.054: I/MyService(18583): Received start id 13: Intent { cmp=com.smithdtyler.prettygoodmusicplayer/.MusicPlaybackService (has extras) }
01-31 20:21:25.054: I/MusicPlaybackService(18583): I got a message! 3
01-31 20:21:25.054: I/MusicPlaybackService(18583): I got a playpause message
01-31 20:21:25.054: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:25.054: I/ViewRootImpl(18583): ViewRoot's KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PAUSE, scanCode=201, metaState=0, flags=0x8, repeatCount=0, eventTime=457498043, downTime=457498012, deviceId=26, source=0x101 } to com.android.internal.policy.impl.PhoneWindow$DecorView{43f87d60 V.E..... R....... 0,0-1440,2392}
01-31 20:21:25.064: V/MediaPlayer[Native](18583): isPlaying: 0
01-31 20:21:25.064: D/MusicPlaybackService(18583): requestAudioFocus result = 1
01-31 20:21:25.064: I/MusicPlaybackService(18583): About to play /storage/external_SD/Music/Tool/Salival/06 Merkaba (Live).mp3
01-31 20:21:25.064: D/MusicPlaybackService(18583): We got audio focus!
01-31 20:21:25.064: V/MediaPlayer[Native](18583): start
01-31 20:21:25.064: D/MediaPlayer[Native](18583): calling notify_player_state: 16
01-31 20:21:25.074: V/MediaPlayer[Native](18583): isPlaying: 1
I'm going to try manually opening a connection to the bluetooth device to see if I can force the connection to stay open.
https://developer.android.com/guide/topics/connectivity/bluetooth.html#QueryingPairedDevices
The app itself seems to be timing out in its bluetooth access window. I can turn my headset on and off with no effect, but if I restart the app I can regain bluetooth control. I think the app needs to do something to tell the OS "I'm still using bluetooth..."
An approach of periodically checking the status of the device doesn't seem to help.
Next I want to try periodically un-registering and re-registering for bluetooth events and media events. Perhaps my media event listener is being timed out?
I also should re-register the event listener when bluetooth is connected.
This issue appears to be resolved by upgrading to Lollipop.
Problem is intermittent, and didn't manifest itself on Droid Maxx.
Info from Logcat while this problem was occurring (I was pressing the pause button repeatedly):