Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Dianne Hackborn
On Fri, Jan 7, 2011 at 2:29 PM, Moto  wrote:

> I guess my knowledge on the subject was not far off...  I guess I was being
> mislead by all these task killers and users complaining... They just assume
> a visible process is hogging CPU and memory.  Well it could on applications
> that aren't managing things properly.
>

Actually, even misbehaving applications can't -- if they are to the point of
hogging memory, then as being in the background in will be on the list of
things to be killed to get memory back.  And if it is trying to suck CPU,
all of the background apps put together can only get at most 10% of the CPU
cycles from any foreground processes that want them.

Prior to 2.3, one thing they could do is use CPU in the background when no
foreground apps are trying to run, which could more quickly drain the
battery (and they would show up in battery usage due to this).  In 2.3 we
now try to look for this to more aggressively kill background processes with
this behavior.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Frank Weiss
I want to say thank you to Dianne Hackborn for correcting my mistaken
assumption that an Android process could serially host different apps. I'll
have to take some time to study how the Android OS manages processes and the
DVK someday.

-- 
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

Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Moto
I kept telling my users I don't want to place an exit button cause it's 
pointless! If you program the application properly there is no need for an 
exit button on many type of applications such as mine, a media playback 
application.  I explain users and some understand while other don't... 

-- 
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

Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Moto
I guess my knowledge on the subject was not far off...  I guess I was being 
mislead by all these task killers and users complaining... They just assume 
a visible process is hogging CPU and memory.  Well it could on applications 
that aren't managing things properly.

Thanks for your reply

-- 
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

Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Dianne Hackborn
On Fri, Jan 7, 2011 at 12:23 PM, Frank Weiss  wrote:

> This is a problem that the Google engineers have acknowledged. As you
> probably know, the issue is that the Android OS does delayed garbage
> collection of - and possibly reuses -  "dead" porcesses,  however the
> process name remains that of the last app it hosted, as reported via DDMS or
> via phone's running processes.
>

The process *is* the app it hosts.  It will never change name; there is no
way to safely change the whole identity of a process (especially its uid)
without killing and restarting it.  So there is no bug here in that sense,
it is all working as intended; the main issue has been letting users see
these processes with no context for what they are.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Frank Weiss
This is a problem that the Google engineers have acknowledged. As you
probably know, the issue is that the Android OS does delayed garbage
collection of - and possibly reuses -  "dead" porcesses,  however the
process name remains that of the last app it hosted, as reported via DDMS or
via phone's running processes.

Forcefully killing the process may seem to placate your users, but as you
know is frowned upon by the Android engineers. Could you instead explain
that what they see is not a running process, but a process ready to run in
case they need the service soon. It's really a lot like a hybrid car at a
stop sign. The ignition is on, but the engine isn't running, but can start
up instantly if you press on the gas.

-- 
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

Re: [android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Dianne Hackborn
That is working as intended.  The process is kept around with nothing
running in it if there is enough memory, to reduce the work if it is needed
again in the future.

On Fri, Jan 7, 2011 at 11:59 AM, Moto  wrote:

> Currently I believe I'm doing a ok job managing my application's remote
> service. When I'm done using it I can see the onDestroy() called, perfect...
>
> Now the issue is I can see the remote process still hanging around, via
> DDMS or via phone's running processes. Users see this and think I'm doing
> stuff on the background etc... blaming my app and than asking for an exit
> button... Truth is they don't need an exit button!
>
> So my question:
>
> How to gracefully terminate a remote service process?
>
> I could get the PID and kill it but something tells me this might not be
> the nice way to do this since the service might be restarted again...
>
> Any help would be greatly apreciated!
>
> -Moto
>
> --
> 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




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

[android-developers] How to gracefully terminate a remote service process?

2011-01-07 Thread Moto
Currently I believe I'm doing a ok job managing my application's remote 
service. When I'm done using it I can see the onDestroy() called, perfect...

Now the issue is I can see the remote process still hanging around, via DDMS 
or via phone's running processes. Users see this and think I'm doing stuff 
on the background etc... blaming my app and than asking for an exit 
button... Truth is they don't need an exit button!

So my question:

How to gracefully terminate a remote service process?

I could get the PID and kill it but something tells me this might not be the 
nice way to do this since the service might be restarted again...

Any help would be greatly apreciated!

-Moto

-- 
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