赞
踩
An important and unusual feature of Android is that an application process's lifetime is notdirectly controlled by the application itself. Instead, it is determined by the system through a combination of the parts of the application that the system knows are running, how important these things are to the user, and how much overall memory is available in the system.
A foreground process is one holding an Activity at the top of the screen that the user is interacting with (its onResume() method has been called) or an IntentReceiver that is currently running (its onReceiveIntent() method is executing). There will only ever be a few such processes in the system, and these will only be killed as a last resort if memory is so low that not even these processes can continue to run. Generally at this point the device has reached a memory paging state, so this action is required in order to keep the user interface responsive.
A visible process is one holding an Activity that is visible to the user on-screen but not in the foreground (its onPause() method has been called). This may occur, for example, if the foreground activity has been displayed with a dialog appearance that allows the previous activity to be seen behind it. Such a process is considered extremely important and will not be killed unless doing so is required to keep all foreground processes running.
一个可视进程是:持有一个用户组屏幕上可见的Activity,但不是位于前景(其 onPause() 方法已被调用过)。比如,当前景的活动已经显示,一个对话框出现,则之前的活动则在其之后可见。这类进程被认为非常重要,不会被杀掉,除非杀掉该进程是为了保持所有前台进程处于运行状态。
A service process is one holding a Service that has been started with the startService()method. Though these processes are not directly visible to the user, they are generally doing things that the user cares about (such as background mp3 playback or background network data upload or download), so the system will always keep such processes running unless there is not enough memory to retain all foreground and visible process.
一个服务进程是:持有一个通过startService() 方法启动的Service。尽管这些进程并非对用户可见,它们通常处理一些用户关心的事情(比如后台mp3播放器或后台网络数据上传下载),所有系统总是尽量保持这些进程运行,除非没有足够的内存保证所有前台进程和可视进程运行。
A background process is one holding an Activity that is not currently visible to the user (its onStop() method has been called). These processes have no direct impact on the user experience. Provided they implement their activity lifecycle correctly (see Activity for more details), the system can kill such processes at any time to reclaim memory for one of the three previous processes types. Usually there are many of these processes running, so they are kept in an LRU list to ensure the process that was most recently seen by the user is the last to be killed when running low on memory.
一个后台进程是:持有一个当前对用户不可见的Activity (其onStop() 方法已被调用)。这些进程对用户的体验没有直接影响。如果其持有的活动的生命周期相关方法被正确实现(更多细节请看 Activity ),系统会在任何时候杀掉这些进程以回收内存供前三种进程使用。通常会有很多这类进程运行,他们被保存在一个LRU列表内,保证最新被用户看到的进程在系统内存过低时最晚被系统杀掉。
An empty process is one that doesn't hold any active application components. The only reason to keep such a process around is as a cache to improve startup time the next time a component of its application needs to run. As such, the system will often kill these processes in order to balance overall system resources between these empty cached processes and the underlying kernel caches.
一个空进程是:没有持有任何活动的应用程序组件。保持这样一个进程的唯一理由是在下一次一个应用程序的组件需要运行时作为缓存来加快启动速度。同样,系统会经常杀掉这些进程以在空的缓存进程和底层内核缓存之间保持系统资源平衡。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。