summaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-07-18 18:56:29 +0000
committerThomas Martitz <kugel@rockbox.org>2011-07-18 18:56:29 +0000
commit76b6db375a057129cac64bc157df8b10e2e4a5c9 (patch)
tree8c6e81b3843c20374078ce06610e4a875ec5304f /android
parent74ab227b58ee3eae152c1142eb9144ee5332a7d9 (diff)
downloadrockbox-76b6db375a057129cac64bc157df8b10e2e4a5c9.tar.gz
rockbox-76b6db375a057129cac64bc157df8b10e2e4a5c9.tar.bz2
rockbox-76b6db375a057129cac64bc157df8b10e2e4a5c9.zip
Android: Fix sporadic force closes.
Android restarts services that are killed during memory pressure. The intent parameter is null then. This caused a null pointer exception. Now replace this null intent with one saying we've been restarted. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30156 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android')
-rw-r--r--android/src/org/rockbox/RockboxService.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/android/src/org/rockbox/RockboxService.java b/android/src/org/rockbox/RockboxService.java
index 3182b73b1c..49abb52dd5 100644
--- a/android/src/org/rockbox/RockboxService.java
+++ b/android/src/org/rockbox/RockboxService.java
@@ -167,8 +167,12 @@ public class RockboxService extends Service
public int onStartCommand(Intent intent, int flags, int startId)
{
+ /* if null, then the service was most likely restarted by android
+ * after getting killed for memory pressure earlier */
+ if (intent == null)
+ intent = new Intent("org.rockbox.ServiceRestarted");
do_start(intent);
- return 1; /* old API compatibility: 1 == START_STICKY */
+ return START_STICKY;
}
private void startservice()