diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-02-19 01:31:45 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-02-19 01:31:45 +0000 |
commit | 36af29f4d86772a3bf536469b206e268e7193f06 (patch) | |
tree | 1e1189f3033dfed57aa763bb5f806e65c355dce5 | |
parent | c9c28200c0f4e7d1a77ebb5e96774969b15d07ec (diff) | |
download | rockbox-36af29f4d86772a3bf536469b206e268e7193f06.tar.gz 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
-rw-r--r-- | android/src/org/rockbox/RockboxService.java | 7 |
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 | |||
80 | public void onCreate() | 80 | public void onCreate() |
81 | { | 81 | { |
82 | instance = this; | 82 | instance = this; |
83 | mMediaButtonReceiver = new MediaButtonReceiver(this); | ||
83 | } | 84 | } |
84 | 85 | ||
85 | public static RockboxService get_instance() | 86 | public static RockboxService get_instance() |
@@ -145,6 +146,9 @@ public class RockboxService extends Service | |||
145 | e.printStackTrace(); | 146 | e.printStackTrace(); |
146 | } | 147 | } |
147 | } | 148 | } |
149 | /* (Re-)attach the media button receiver, in case it has been lost */ | ||
150 | mMediaButtonReceiver.register(); | ||
151 | |||
148 | if (resultReceiver != null) | 152 | if (resultReceiver != null) |
149 | resultReceiver.send(RESULT_SERVICE_RUNNING, null); | 153 | resultReceiver.send(RESULT_SERVICE_RUNNING, null); |
150 | } | 154 | } |
@@ -175,8 +179,6 @@ public class RockboxService extends Service | |||
175 | fb = new RockboxFramebuffer(this); | 179 | fb = new RockboxFramebuffer(this); |
176 | if (resultReceiver != null) | 180 | if (resultReceiver != null) |
177 | resultReceiver.send(RESULT_FB_INITIALIZED, null); | 181 | resultReceiver.send(RESULT_FB_INITIALIZED, null); |
178 | mMediaButtonReceiver = new MediaButtonReceiver(this); | ||
179 | mMediaButtonReceiver.register(); | ||
180 | Thread rb = new Thread(new Runnable() | 182 | Thread rb = new Thread(new Runnable() |
181 | { | 183 | { |
182 | public void run() | 184 | public void run() |
@@ -325,6 +327,7 @@ public class RockboxService extends Service | |||
325 | { | 327 | { |
326 | super.onDestroy(); | 328 | super.onDestroy(); |
327 | mMediaButtonReceiver.unregister(); | 329 | mMediaButtonReceiver.unregister(); |
330 | mMediaButtonReceiver = null; | ||
328 | /* Make sure our notification is gone. */ | 331 | /* Make sure our notification is gone. */ |
329 | stopForeground(); | 332 | stopForeground(); |
330 | } | 333 | } |