ActivityManagerService sometimes kills an Activity skipping normal lifecycle

65 views
Skip to first unread message

Android007

unread,
Nov 25, 2012, 2:54:50 PM11/25/12
to android-...@googlegroups.com
I have noticed that sometimes when many apps are running the ActivityManagerService decides to kill a background app.
The decision is made according to that app's adj value (just like in Unix).
This happens in updateOomAdjLocked.
The service uses the KillProcessQuiet method, which, according to my understanding sends a "kill -9" SIG to the process and kills it.
This is fine, but when this happens (usually with the Launcher app), it skips the entire onStop() and onDestroy() methods which should be part of an activity's lifecycle

.My question is how can an application know when this is done to it (is there any way to save data before?)
To which applications can this happen? (the Quiet Kill that is)
Are there any other cases in which the ActivityMangerService kills processes without sending a notification?

Thank you

Johan Appelgren

unread,
Nov 26, 2012, 3:42:40 AM11/26/12
to android-...@googlegroups.com
According to Table 1 on http://developer.android.com/guide/components/activities.html#ImplementingLifecycleCallbacks only onPause is guaranteed (there are of course exceptions to this) to get called. After that the app process can be killed at any time as you've observed. 
Reply all
Reply to author
Forward
0 new messages