summaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-02-19 01:31:45 +0000
committerThomas Martitz <kugel@rockbox.org>2011-02-19 01:31:45 +0000
commit36af29f4d86772a3bf536469b206e268e7193f06 (patch)
tree1e1189f3033dfed57aa763bb5f806e65c355dce5 /android
parentc9c28200c0f4e7d1a77ebb5e96774969b15d07ec (diff)
downloadrockbox-36af29f4d86772a3bf536469b206e268e7193f06.tar.gz
rockbox-36af29f4d86772a3bf536469b206e268e7193f06.tar.bz2
rockbox-36af29f4d86772a3bf536469b206e268e7193f06.zip
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
Diffstat (limited to 'android')
-rw-r--r--android/src/org/rockbox/RockboxService.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/android/src/org/rockbox/RockboxService.java b/android/src/org/rockbox/RockboxService.java
index 4f5df62280..912142c7a1 100644
--- a/android/src/org/rockbox/RockboxService.java
+++ b/android/src/org/rockbox/RockboxService.java
@@ -80,6 +80,7 @@ public class RockboxService extends Service
public void onCreate()
{
instance = this;
+ mMediaButtonReceiver = new MediaButtonReceiver(this);
}
public static RockboxService get_instance()
@@ -145,6 +146,9 @@ public class RockboxService extends Service
e.printStackTrace();
}
}
+ /* (Re-)attach the media button receiver, in case it has been lost */
+ mMediaButtonReceiver.register();
+
if (resultReceiver != null)
resultReceiver.send(RESULT_SERVICE_RUNNING, null);
}
@@ -175,8 +179,6 @@ public class RockboxService extends Service
fb = new RockboxFramebuffer(this);
if (resultReceiver != null)
resultReceiver.send(RESULT_FB_INITIALIZED, null);
- mMediaButtonReceiver = new MediaButtonReceiver(this);
- mMediaButtonReceiver.register();
Thread rb = new Thread(new Runnable()
{
public void run()
@@ -325,6 +327,7 @@ public class RockboxService extends Service
{
super.onDestroy();
mMediaButtonReceiver.unregister();
+ mMediaButtonReceiver = null;
/* Make sure our notification is gone. */
stopForeground();
}