forked from len0rd/rockbox
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
This commit is contained in:
parent
74ab227b58
commit
76b6db375a
1 changed files with 5 additions and 1 deletions
|
@ -167,8 +167,12 @@ public class RockboxService extends Service
|
||||||
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId)
|
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);
|
do_start(intent);
|
||||||
return 1; /* old API compatibility: 1 == START_STICKY */
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startservice()
|
private void startservice()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue