I just did a quick test (twice, to be sure) on my Nexus 5 with 4.4.2, and
found that:

1 - Having a foreground service does not prevent the process, including the
service, from being killed

2 - The killed process does not get automatically restarted, at least not
in any reasonable timeframe

3 - To add insult to injury, the service's foreground icon stays stuck in
the status bar

4 - Existing alarms that target the package's components continue to work
(so the package is not placed in a "disabled" state, as someone speculated)

5 - Killing a process with DDMS behaves the same way: a foreground service
goes away with the process (that's expected), but does not get restarted
after a short time, like it did in earlier Android versions.

Item 4 makes it look like an intentional change, while the third one makes
it look like a bug.

I'm more inclined to think it's a bug, maybe caused by memory optimization
changes in the system's internals (yes, I'm speculating).

At the same time, I see things like these in the logcat:

I/ActivityManager(  758): Killing
28081:com.google.android.setupwizard/u0a17 (adj 15): empty for 1806s
I/ActivityManager(  758): Killing 28113:com.google.android.youtube/u0a73
(adj 15): empty for 1806s

It's likely that Google's apps aren't affected by this, as they often use
GCM (Gmail, G+, other cloud centric apps).

So we have substantial changes / bugs in how process lifecycles are
handled, likely to optimize memory usage, and at the same time Google's own
apps, including those built into the firmware, continue to run when they've
not been used (ever / for a long time).

-- K



2013/12/15 Piren <gpi...@gmail.com>

> First, i'll have to agree with Kristopher, you're being an asshole... tone
> down your rhetoric, people might be more inclined to help you.
> Second, you keep going on and on selling us what you think the swipe means
> and what users think the swipe means, who cares? the only thing that
> matters is what google thought it is, and sadly, they made practically no
> documentation of it.
>
> It is however supposed to keep services running.... sometimes :)
> See posts by Dianne here:
> https://plus.google.com/105051985738280261832/posts/GfwRYCC42uX
>
> And there's also a known bug about it here:
> https://groups.google.com/forum/#!topic/android-developers/LtmA9xbrD5A
>
> And what you're describing might be another bug, or just a policy change
> which again was badly documented.
> Either way, the simplest solution to your issue will be to change the
> service to be a Foreground Service, it should* keep the service running.
>
> * With google, it's always a guess
>
> On Saturday, December 14, 2013 10:40:58 PM UTC+2, 3c wrote:
>
>> And I did dig into the sources. App is permanently killed, except for
>> manifest registered events (unverified) and alarms. So any sticky device
>> not relying on those is a dead service. In 4.4.x only that is.
>>
>> I found a work around but its so dirty I wait for a better option if any
>> before posting.
>> Le 14 déc. 2013 17:37, "Kristopher Micinski" <krismi...@gmail.com> a
>> écrit :
>>
>>> Just as a note: you're being fairly condescending to people who are
>>> suggesting solutions to you free of charge in a pretty polite way..
>>>
>>> I personally don't know what the semantics of the swipe away are: but
>>> I wouldn't be surprised if it were to kill the app.  I am not sure
>>> whether or not I'd call it a bug or not (I'd personally lean toward
>>> not) but it's obvious you feel differently.  If nobody else
>>> (presumably, someone who's read the source..) responds to this you
>>> could always dig through the system source to find out!
>>>
>>> Kris
>>>
>>>
>>> On Fri, Dec 13, 2013 at 6:59 AM, 3c <ccou...@gmail.com> wrote:
>>> > Thanks but I'm fully aware of this and as the title suggest I'm
>>> referring to
>>> > swiping an app from the recent task list. Not sure how this has
>>> anything to
>>> > do with this.
>>> >
>>> > On Android 4.4, the recent task list is now acting like a force-stop
>>> and
>>> > that's a definitive and obvious bug. And this behavior is anything but
>>> what
>>> > end-users do expect when removing apps from recent list. I've already
>>> > received a dozen reports from end-users who think my app stops
>>> functioning
>>> > unexpectedly, while they only swiped it away from the recent list, they
>>> > expect its services to continue running!
>>> >
>>> > How nice this is when an app actually has widgets on the launcher?
>>> Those
>>> > simply stop refreshing forever! If that's not a bug, I guess Android
>>> OS and
>>> > my app both have 0 bug. I'll make sure to refer my users to your posts
>>> so
>>> > they understand there's no bug!
>>> >
>>> > Have a read at these:
>>> > http://developer.android.com/reference/android/app/Service.
>>> html#onTaskRemoved(android.content.Intent)
>>> > http://developer.android.com/reference/android/content/pm/
>>> ServiceInfo.html#FLAG_STOP_WITH_TASK
>>> >
>>> >
>>> > On Friday, December 13, 2013 4:25:42 AM UTC+1, RichardC wrote:
>>> >>
>>> >> Have a read of:
>>> >>
>>> >> Launch controls on stopped applications in
>>> >> http://developer.android.com/about/versions/android-3.1.html
>>> >>
>>> >> Note that it says:
>>> >> "Applications are in a stopped state when they are first installed
>>> but are
>>> >> not yet launched and when they are manually stopped by the user (in
>>> Manage
>>> >> Applications)."
>>> >>
>>> >> This was introduced in 3.1 before we had swiping away.
>>> >>
>>> >>
>>> >> On Friday, December 13, 2013 1:22:27 AM UTC, 3c wrote:
>>> >>>
>>> >>> I cannot agree with this as the recent task list in no way suggest
>>> >>> killing the apps. Actually every users seems to see it differently.
>>> Some
>>> >>> take that recent task list as the name suggest, recent tasks and
>>> activities,
>>> >>> others see it as you suggest an app killing, but most users don't
>>> know
>>> >>> what's actually happening when removing a task from that list.
>>> >>>
>>> >>> Furthermore that list doesn't actually reflect apps still running,
>>> but
>>> >>> the recent tasks or apps used by end-user. On boot I may have a
>>> dozen apps
>>> >>> running, but no way to kill them (except going into settings,
>>> force-stop) if
>>> >>> I haven't started them once, making this task killer the worse I've
>>> ever
>>> >>> seen: it requires end-user to open the app before being able to kill
>>> it
>>> >>> permanently! And it's not because I remove a task from that very
>>> list that I
>>> >>> don't want its services to continue running.
>>> >>>
>>> >>> Looking at documentation for the Service class and the related
>>> manifest
>>> >>> attributes definitely confirm the behavior of Android 4.0 to 4.3:
>>> >>>
>>> >>> With Android 4.4, the below flag is now ineffective, which falls
>>> into the
>>> >>> bug category, not the other way around as you suggest.
>>> >>>
>>> >>>
>>> >>> public static final int stopWithTask
>>> >>> Added in API level 14
>>> >>>
>>> >>> If set to true, this service with be automatically stopped when the
>>> user
>>> >>> remove a task rooted in an activity owned by the application. The
>>> default is
>>> >>> false.
>>> >>>
>>> >>> Must be a boolean value, either "true" or "false".
>>> >>>
>>> >>> public void onTaskRemoved (Intent rootIntent)
>>> >>>
>>> >>> Added in API level 14
>>> >>>
>>> >>> This is called if the service is currently running and the user has
>>> >>> removed a task that comes from the service's application. If you
>>> have set
>>> >>> ServiceInfo.FLAG_STOP_WITH_TASK then you will not receive this
>>> callback;
>>> >>> instead, the service will simply be stopped.
>>> >>>
>>> >>>
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups "Android Developers" group.
>>> > To post to this group, send email to android-d...@googlegroups.com
>>>
>>> > To unsubscribe from this group, send email to
>>> > android-developers+unsubscr...@googlegroups.com
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/android-developers?hl=en
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Android Developers" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> > email to android-developers+unsubscr...@googlegroups.com.
>>> > For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-d...@googlegroups.com
>>>
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Android Developers" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/android-developers/H-DSQ4-tiac/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> android-developers+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to