What actually happens when you swipe an app out of the recent apps list?

The recent apps list in Ice Cream Sandwich included the capacity to swipe applications out of the checklist, therefore disregarding them completely (and also regarding I recognize this is a vanilla function, not a CM/custom ROM one). The documents and also system highlights do not show up to cover the under - the - hood operations of this capability, yet I'm interested to recognize what the system is in fact doing.

More including in my inquisitiveness, I determined to do a fast examination : I launched Music on a CM9 install, after that revoked it. I after that examined the recent apps list and also saw it was without a doubt there (and also in the correct state, based upon the thumbnail). I after that entered into Settings->Applications and also pressure quit the Music application, yet it was still detailed in the current checklist, leading me to think it is not attached to procedures sticking around behind-the-scenes.

Understanding since Music might have been an inadequate selection, I additionally examined with the USA Today application. This showed primarily the very same actions, and also it felt like it was compelled to "relaunch" after the pressure stop (that makes feeling) though the thumbnail in the recent apps list really did not mirror this (cached, I'm presuming?).

So, what in fact takes place at the OS degree when you swipe an application out of the current checklist? Does it merely clear the application is information out of RAM and also waste accumulate it, damaging its conserved state?

2022-06-03 23:23:08
Source Share
Answers: 5

It closes the app, and its data that is stored in the RAM. Thus, giving you more RAM space so you can run other apps. However, background services are NOT automatically force closed as a result of closing the using app.

2022-07-15 00:22:43

I assume it will certainly do the like the back switch do. Other than one little adjustment. It will certainly finish() all task/ pieces in the application.

Simply did a little screening with a little selfbuild application. You can examine, also. Heres my screening application : https://bitbucket.org/Leandros99/lifecycletest (download readily available, also. For those that angle construct.)
In every Activity lifecycle method (http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle) publish the application a log. You can watch it with adb logcat (install Android SDK, cd to system - devices in cmd/ covering and also type adb logcat. Currently you will certainly see, everytime you do something like countered or home switch, the application publishes the lifecycle method, stated over.)

Your inquiry : If I swipe an application from the current applications cabinet, the onDestroy method will certainly be called. It does virtually the like the back switch.
Hope I aided a little bit. If there are inquiries, simply ask.

2022-06-04 17:59:03

I show up to have actually located the enchanting search terms that brought about some descriptions from Google staff members. Especially, I located a number of various areas where Dianne Hackborn clarifies what takes place when you swipe something out of the current checklist. The first is a comment on one of her Google+ posts :

[W ] hat especially takes place when you swipe away a current job is it : (1) eliminates any kind of history or vacant procedures of the application (see http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html#Lifecycle wherefore this suggests), and also (2) makes use of the new http://developer.android.com/reference/android/app/Service.html#onTaskRemoved(android.content.Intent) API to inform any kind of solutions of the application concerning the job being gotten rid of so it can do whatever it assumes is ideal.

She additionally notes in a blog comment :

Actually, getting rid of an access in current jobs will certainly eliminate any kind of history refines that exist for the procedure. It will not straight creates solutions to stop, nonetheless there is an API for them to figure out the job was gotten rid of to determine if they desire this to suggest they need to stop. This is to make sure that getting rid of claim the current job of an e - mail application will not create it to stop looking for e - mail.

If you actually intend to entirely stop an application, you can long continue current jobs to head to application details, and also struck pressure stop there. For stop is a full kill of the application - - all procedures are eliminated, all solutions quit, all alerts got rid of, all alarm systems got rid of, and so on The application is not permitted to release once more till clearly asked for.

So, it resembles the recap is that swiping an application out of the checklist will certainly first eliminate all history procedures for the application, after that make use of onTaskRemoved to alert the application that the history job was gotten rid of. Then it resembles it depends on the application to determine what takes place, so I presume there practically isn't a tough - and also - rapid regulation concerning what takes place to the application past that factor.

2022-06-04 17:56:54

There is some details in the resource code in the courses com.android.internal.policy.impl.RecentApplicationsBackground and also com.android.internal.policy.impl.RecentApplicationsDialog.

If I read these appropriately, there specify trainers for picking the applications yet second best for swiping them with the exception of onDetachedFromWindow(), which calls com.android.View.onDetachedFromWindow() which primarily conceals the component and also removes it is information. This would certainly hint to the reality that second best takes place on swiping the application, which refers Austin Mills' solution, due to the fact that given that the checklist does not show the energetic application, the onPause() and also various other system calls that are done when "quitting" an application have actually currently taken place.

2022-06-04 17:51:44

Swiping applications out of the recent apps list is vanilla, and also of course, not well recorded. This has actually been the subject of a suitable quantity of conversation on numerous Android discussion forums ... the agreement appears to be ideal defined here in some comments : that the actions resembles yet not specifically the like shutting an application - - as a whole (for applications that do not specify specific back switch handling) it coincides point as countering adequate times from within an application that you exit from it.

The link has some even more information on the specifics, yet on the whole you can consider it as giving up the application.

Details to the Music application, I think it begins a solution, so while the job itself (the Music app/UI) might be shut, the solution remains to run in the history to make sure that your songs does not instantly stop even if the job obtained removed for memory monitoring factors. That might have influenced what you saw.

2022-06-04 17:08:08