[guardian-dev] Orbot v14.1.4: The Battle for the Background!

Michael Rogers michael at briarproject.org
Mon Dec 1 10:45:17 EST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Maybe I'm misinterpreting the docs - I read the Process Lifecycle
section as saying that a process may be killed (in the classic Linux
sense of the word) at any time, but a process hosting a foreground
activity or service will only be killed under desperate circumstances.

"Generally, only a few foreground processes exist at any given time.
They are killed only as a last resort - if memory is so low that they
cannot all continue to run."

According to the same section, a service is considered to be running
in the foreground while executing onDestroy(). Since a process hosting
a foreground service may be killed (under desperate circumstances), I
take that to imply that onDestroy() is not guaranteed to complete
before the hosting process is killed.

I agree that onLowMemory() would be a good place to shut down cleanly,
as the docs say it will "generally" be called before killing
foreground processes.

"While the exact point at which this will be called is not defined,
generally it will happen when all background process have been killed.
That is, before reaching the point of killing processes hosting
service and foreground UI that we would like to avoid killing."

https://developer.android.com/reference/android/app/Application.html#onLowMemory%28%29

Cheers,
Michael

On 01/12/14 14:52, Hans-Christoph Steiner wrote:
> 
> I don't see the particular thing you're referencing in the
> Lifecycle page. One notable time when apps are killed without
> warning is during an upgrade or removal.
> 
> My understanding of the normal lifecycle is that Activities and
> Services are always shutdown using the whole sequence (onPause(),
> onStop(), onDestroy() etc.) before being killed.  Maybe that's
> based on my wishful thinking.
> 
> One thing to help tracking low memory conditions is creating
> onTrimMemory() and onLowMemory() in an Application subclass.
> Android should call those when memory is getting low as the first
> step before killing things.  That's how I understand it at least.
> 
> .hc that's Michael Rogers:
>> Sorry if I'm misunderstanding the issue, but hasn't it always
>> been possible for a service (even a foreground service) to be
>> killed by the system without any methods being called?
>> 
>> https://developer.android.com/guide/components/processes-and-threads.html#Lifecycle
>>
>>
>> 
Cheers,
>> Michael
>> 
>> On 01/12/14 08:14, Hans-Christoph Steiner wrote:
>> 
>>> Is there any documentation about onDestroy() no longer being 
>>> called?  That would be a pretty big change.  Maybe something
>>> in TorService is crashing? Then onDestroy() wouldn't be
>>> called.
>> 
>>> .hc
>> 
>>> Nathan of Guardian:
>>>> I think we've finally gotten all the background service
>>>> longevity sorted out, especially on Lollipop where it seemed
>>>> to be much more brutal, in outright killing of the TorService
>>>> instant, even without calling onDestroy(). Anyhow, now
>>>> startForeground() is doing what it should be, we aren't
>>>> binding any more (Just use broadcasts and startService()
>>>> calls), and Orbot doesn't show up in recent apps anymore, so
>>>> no more swiping away....
>>>> 
>>>> 
>>>> /** 14.1.4 / 29-Nov-2014 / 
>>>> b7fcbdc4e85071191cc95c3824e7b5a90d36d1e8 **/
>>>> 
>>>> * Stop background service being killed 1e0f640 adding 
>>>> dummyactivity to stop task/broadcast from killing foreground 
>>>> service ec9204a clean-up of code to make service more
>>>> long-lived and stable da4866c update polipo to latest head
>>>> 
>>>> * Activity and theme updates 917cfa1 support SDK 16, add
>>>> custom theme, make Orbot singleTop activity 91f4fa0 cleanup
>>>> landscape layout ad7d92f clean-up / remove un-used code
>>>> d5823e3 updates to layout to make it cleaner 2d6c26a show
>>>> exit node info in log
>>>> 
>>>> APK Lollipop: 
>>>> https://guardianproject.info/releases/Orbot-v14.1.4-LollipopPIE.apk
>>>>
>>>>
>>
>>>> 
(.asc)
>>>> APK <= KitKat: 
>>>> https://guardianproject.info/releases/Orbot-v14.1.4-UpToKitKat-nonPIE.apk
>>>>
>>>>
>>
>>>> 
(.asc)
>>>> 
>>>> Souirce: 
>>>> https://gitweb.torproject.org/orbot.git/commit/b34d971193d843f1258904cba55779a58c819d0f
>>>>
>>>>
>>>>
>>>>
>>
>>>> 
_______________________________________________
>>>> Guardian-dev mailing list
>>>> 
>>>> Post: Guardian-dev at lists.mayfirst.org List info: 
>>>> https://lists.mayfirst.org/mailman/listinfo/guardian-dev
>>>> 
>>>> To Unsubscribe Send email to: 
>>>> Guardian-dev-unsubscribe at lists.mayfirst.org Or visit: 
>>>> https://lists.mayfirst.org/mailman/options/guardian-dev/hans%40guardianproject.info
>>>>
>>>>
>>>>
>>
>>>> 
You are subscribed as: hans at guardianproject.info
>>>> 
>> 
>> 
>> 
>>> _______________________________________________ Guardian-dev 
>>> mailing list
>> 
>>> Post: Guardian-dev at lists.mayfirst.org List info: 
>>> https://lists.mayfirst.org/mailman/listinfo/guardian-dev
>> 
>>> To Unsubscribe Send email to: 
>>> Guardian-dev-unsubscribe at lists.mayfirst.org Or visit: 
>>> https://lists.mayfirst.org/mailman/options/guardian-dev/michael%40briarproject.org
>>
>>>
>>> 
You are subscribed as: michael at briarproject.org
>> 
>> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBCAAGBQJUfI0NAAoJEBEET9GfxSfM6IEH/i4BmVNzhDVsePZlvtjWoV9b
Xwfm13maTTnBR3G03DxNsW8X8tsCVsvNotVYwn8Qq94wrDJ6stk+DOv8U1xDogZv
i1TD/4n3DkVAjRojlSMMpfTw49+DElrdPWKfI9kJy7hgWw2w3QpE0P6xuqcvDLn9
bZNrvvA7BaHvobyCvnuMeVHQJe2xYwtryn/RYXQ3Q24/gdzPbaB3/LuNh+e99tmA
q5UDaEYul9fd3r7qm8KoTW1p65mIb3i1XOA/J61QPqSk2kC2v+Wzts9TKvxUo9+A
8y+suqcZdOB2/AP+K5n5yORMbGQPe6JQNz+LhIrLAGmzUmLB/SZbuxmLMpb3pM0=
=cQbJ
-----END PGP SIGNATURE-----


More information about the Guardian-dev mailing list