In general, just going through a couple heavy applications (web browser,
maps, camera) without pressing back will remove previous apps as much as any
"task manager" kind of program that you use to kill processes.  The system
will kill the background app's process as it needs memory for the other
apps, and this will happen pretty quickly when running through larger
applications.

For example, if you look at the output of "adb logcat -b events" you can see
this happen as I go through apps:

First I start Alarm Clock:

I/am_proc_start(   56):
[13494,10024,com.android.alarmclock,activity,com.android.alarmclock/.AlarmClock]
I/am_restart_activity(   56):
[1131476400,119,com.android.alarmclock/.AlarmClock]
I/am_on_resume_called(13494): com.android.alarmclock.AlarmClock
I/activity_launch_time(   56):
[1131476400,com.android.alarmclock/.AlarmClock,1230]


Then I press home and start Browser (here the Browser process was already
running, so it isn't started):

I/am_pause_activity(   56): [1131476400,com.android.alarmclock/.AlarmClock]
I/am_resume_activity(   56): [1130026096,2,com.android.launcher/.Launcher]
I/am_pause_activity(   56): [1130026096,com.android.launcher/.Launcher]
I/am_new_intent(   56):
[1131909552,62,com.android.browser/.BrowserActivity,android.intent.action.MAIN,,,272629760]
I/am_resume_activity(   56):
[1132547568,62,com.android.browser/.BrowserActivity]

Then home again and go to Maps (and again the Maps process was already
running):

I/am_pause_activity(   56):
[1132547568,com.android.browser/.BrowserActivity]
I/am_resume_activity(   56): [1130026096,2,com.android.launcher/.Launcher]
I/am_pause_activity(   56): [1130026096,com.android.launcher/.Launcher]
I/am_new_intent(   56):
[1131416032,175,com.google.android.apps.maps/com.google.android.maps.MapsActivity,android.intent.action.MAIN,,,272629760]
I/am_resume_activity(   56):
[1132428392,175,com.google.android.apps.maps/com.google.android.maps.MapsActivity]

Next home and then Camera, again the process was already running:

I/am_pause_activity(   56):
[1132428392,com.google.android.apps.maps/com.google.android.maps.MapsActivity]
I/am_resume_activity(   56): [1130026096,2,com.android.launcher/.Launcher]
I/am_pause_activity(   56): [1130026096,com.android.launcher/.Launcher]
I/am_resume_activity(   56): [1132606040,176,com.android.camera/.Camera]

Back to home and then to Calendar, and in this case the Calendar process
wasn't already running so needs to be started:

I/am_pause_activity(   56): [1132606040,com.android.camera/.Camera]
I/am_resume_activity(   56): [1130026096,2,com.android.launcher/.Launcher]
I/am_create_activity(   56):
[1132590128,177,com.android.calendar/.LaunchActivity,android.intent.action.MAIN,,,270532608]
I/am_pause_activity(   56): [1130026096,com.android.launcher/.Launcher]
I/am_proc_start(   56):
[13525,10006,com.android.calendar,activity,com.android.calendar/.LaunchActivity]
I/am_create_activity(   56):
[1131596992,177,com.android.calendar/.DayActivity,,,,0]
I/am_pause_activity(   56):
[1132590128,com.android.calendar/.LaunchActivity]
I/am_finish_activity(   56):
[1132590128,177,com.android.calendar/.LaunchActivity,app-request]

And now we will go home and go to Gmail, at which point the system will kill
the alarm clock process because there is not enough memory to run everything
we have done so far + Gmail:

I/am_pause_activity(   56): [1131596992,com.android.calendar/.DayActivity]
I/am_resume_activity(   56): [1130026096,2,com.android.launcher/.Launcher]
I/am_create_activity(   56): [1132519848,178,
com.google.android.gm/.ConversationListActivityGmail,android.intent.action.MAIN,,,270532608
]
I/am_pause_activity(   56): [1130026096,com.android.launcher/.Launcher]
I/am_proc_start(   56): [13540,10020,com.google.android.gm,activity,
com.google.android.gm/.ConversationListActivityGmail]

Boom!  Alarm clock is gone, and Gmail continues:

I/am_proc_died(   56): [13494,com.android.alarmclock]
I/am_create_activity(   56): [1132200088,178,
com.google.android.gm/.ConversationListActivity,android.intent.action.MAIN,,,41943040
]
I/am_pause_activity(   56): [1132519848,
com.google.android.gm/.ConversationListActivityGmail]
I/am_finish_activity(   56): [1132519848,178,
com.google.android.gm/.ConversationListActivityGmail,app-request]

Oh and bye-bye Browser too. :)

I/am_proc_died(   56): [13383,com.android.browser]


Some things to note about this:

- The android system outright kills a processes when it needs more memory
elsewhere, no less than your task manager would be killing a process if you
request it.  We don't kindly ask a process to go away and assume it is well
behaved and will respect that, we just kill it dead.

- Just killing a process is -not- going to help you much with applications
that have background services running, because the Android system will
quickly schedule them to restart since as far as it is concerned that
service should still be running.

- Yes, a "running application manager" kind of thing would be nice, but just
looking at things in terms of running processes misses a lot of the key
things going on: who is running services, what processes are in the
foreground vs. background vs. empty, and apps doing things like scheduling
alarms that cause them to be launched at regular intervals.


On Tue, Jan 27, 2009 at 8:51 PM, EboMike <[email protected]> wrote:

>
> The "Task Manager for Root Users" app works just fine for the purpose,
> no point for every single application to implement its own custom exit
> functionality.
> That said, a task manager is somewhat of a necessity to get rid of
> rogue apps that feel like onPause() doesn't apply to them and have
> some threads running in the background.
>
> It's not as much of a problem as in Windows Mobile where you just had
> to manually kill tasks every so often to keep your system somewhat
> responsive, but I've found myself use the Android Task Manager app a
> few times to kill an app that refused to STFU.
>
>
> On Jan 27, 1:02 pm, technick <[email protected]> wrote:
> > It would be nice to have a will to exit applications IMHO
> >
> > On Jan 27, 3:34 pm, "[email protected]"
> >
> > <[email protected]> wrote:
> > > Hi there,
> >
> > > I wonder: should an Android application have an exit button (or menu
> > > function) or not?
> > > Ok, if there's some service or other resources consuming something
> > > running in the background I think the user should have an option to
> > > make it stop. But what about an application that would just sit there,
> > > inactive?
> >
> > > If I take a look at the standard application it seems that the Android
> > > philosophy is to keep the applications running and let the system
> > > decide when to stop and destroy an application idling in the
> > > background. I didn't recognize "exit" or "quit" options in the
> > > standard programs.
> >
> > > On the other hand - why not let the user decide and give the option to
> > > quit some software if he knows it's currently not used.
> >
> > > So, what's the advice here?
> > > Give even a "passive" application an exit button?
> > > Or not and just leave it to the system?
> >
> > > thanks -
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  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 [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