forked from len0rd/rockbox
Android: Re-attach the media button receiver when entering Rockbox.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29335 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c9c28200c0
commit
36af29f4d8
1 changed files with 5 additions and 2 deletions
|
@ -80,6 +80,7 @@ public class RockboxService extends Service
|
||||||
public void onCreate()
|
public void onCreate()
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
|
mMediaButtonReceiver = new MediaButtonReceiver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RockboxService get_instance()
|
public static RockboxService get_instance()
|
||||||
|
@ -145,6 +146,9 @@ public class RockboxService extends Service
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* (Re-)attach the media button receiver, in case it has been lost */
|
||||||
|
mMediaButtonReceiver.register();
|
||||||
|
|
||||||
if (resultReceiver != null)
|
if (resultReceiver != null)
|
||||||
resultReceiver.send(RESULT_SERVICE_RUNNING, null);
|
resultReceiver.send(RESULT_SERVICE_RUNNING, null);
|
||||||
}
|
}
|
||||||
|
@ -175,8 +179,6 @@ public class RockboxService extends Service
|
||||||
fb = new RockboxFramebuffer(this);
|
fb = new RockboxFramebuffer(this);
|
||||||
if (resultReceiver != null)
|
if (resultReceiver != null)
|
||||||
resultReceiver.send(RESULT_FB_INITIALIZED, null);
|
resultReceiver.send(RESULT_FB_INITIALIZED, null);
|
||||||
mMediaButtonReceiver = new MediaButtonReceiver(this);
|
|
||||||
mMediaButtonReceiver.register();
|
|
||||||
Thread rb = new Thread(new Runnable()
|
Thread rb = new Thread(new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -325,6 +327,7 @@ public class RockboxService extends Service
|
||||||
{
|
{
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mMediaButtonReceiver.unregister();
|
mMediaButtonReceiver.unregister();
|
||||||
|
mMediaButtonReceiver = null;
|
||||||
/* Make sure our notification is gone. */
|
/* Make sure our notification is gone. */
|
||||||
stopForeground();
|
stopForeground();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue