forked from len0rd/rockbox
Rework MediaButtonReceiver a bit:
* Get rid of reflection since the lack of methods can be detected via exceptions * Use requestAudioFocus/abandonAudioFocus APIs on 2.2+ to play nice with other music apps. * Don't unregister the receiver on exit so we can receive media button presses (and startup the service) after idle poweroff (hopefully it's ok if mMediaButtonReceiver is garbage collected) This should fix that Android calls the standard music app sometimes when those buttons are pressed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29865 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fffc6c4a80
commit
94dacca559
2 changed files with 32 additions and 19 deletions
|
@ -353,7 +353,10 @@ public class RockboxService extends Service
|
|||
public void onDestroy()
|
||||
{
|
||||
super.onDestroy();
|
||||
mMediaButtonReceiver.unregister();
|
||||
/* Don't unregister so we can receive them (and startup the service)
|
||||
* after idle poweroff. Hopefully it's ok if mMediaButtonReceiver is
|
||||
* garbage collected.
|
||||
* mMediaButtonReceiver.unregister(); */
|
||||
mMediaButtonReceiver = null;
|
||||
/* Make sure our notification is gone. */
|
||||
stopForeground();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue