I was not trying to save state for orientation change, but for general 
application state preserving while getting into background in case OS 
decided to kill/restore application.

The ANR assumption is wrong. While OS makes all these activity calls on UI 
thread, there's no direct time limit applied; I tried explicit 10 seconds 
delay and OS does not kill my test application.
BTW, UI does not appear frozen; I suppose UI thread is still per-process, 
so that when OS is switching application the delayed state save call does 
not matter.

Now my assumption is that if during that state save process OS requires 
even more memory immediately - it just recycles the process, whatever state 
it was in.
That means that any application could be killed this way; just those who 
spend more time within state save are more vulnerable statistically.


On Thursday, July 19, 2012 3:53:15 PM UTC-4, Andrew wrote:
>
> Hello,
>
> I'm experiencing an unexpected OS behaviour; mentioned at least on Android 
> 2.x, possible applicable to newer versions too.
>
> When OS calls 
> onSaveInstanceState<http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)>(for
>  whatever reason) apparently application may be killed while within 
> this call if it is run for rather a long time (several seconds).
>
> Is there a known time limit for this call to run inside application?
> Is this a proper behaviour in general?  It is not mentioned in 
> documentation.
> Is this preventable?
>
>
> BTW, there's something ambiguous mentioned in 
> onPause<http://developer.android.com/reference/android/app/Activity.html#onPause()>
>  method:
>
>> When activity B is launched in front of activity A, this callback will be 
>> invoked on A. B will not be created until A's onPause() returns, so be sure 
>> to not do anything lengthy here.
>
> *Lengthy* is not a measurable thing :)
>
>
> TIA.
> Andrew.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to