Which process is killed to recycle resources by the application in the process?Program. The application has the same priority as the highest priority of its components.
When the two applications have the same priority, the process that remains at the lower priority for a long time will be killed first. Process Priority is also affected by inter-process dependencies. If one application depends on another application'sServiceOrContent ProviderThen, the application that provides the service should have at least the same priority as the application that receives the service.
All applications run in memory until the system needs its resources to be allocated to other applications.
Figure3-3The priority tree is displayed to determine the order in which applications are terminated.
It is important to build an application correctly to ensure that its priority is appropriate for what it does. If you do not, your application may be killed in some important periods.
The following list details the figure.3-3The Application Status shown in explains how the component determines the status:
BytesActive Process
Active (Front-end) ProcessThe application programs attached to a process contain the components currently interacting with users. These areAndroidResources are recycled to protect processes that are continuously responsive. Generally, very few processes like this are killed at last.
Active process includes:
timeline in" active " Status activity , they run on the frontend to respond to user events. In this chapter, you will see more information about activity Status Details.
margin in progress onrec Eive broadcast receiver .
timeline running onstart , oncreate , ondestroy service .
BytesVisible Process
Visible but not active processes are those with "visible" Activity . The name indicates "visible" Activity Is visible on the screen, but not in the foreground or does not respond to user events Activity . This happens when Activity Partially covered (by a non-full screen or transparent Activity ). Generally, few processes are visible. They are only killed in extreme circumstances to ensure Active Process .
BytesStarted service process
processes are attached to started service . service continuous running in a dynamic manner but no visible interface. Because service do not directly interact with users. They have visible process lower priority. They can still be considered as foreground processes and won't be killed until resources are active/visible process requirement.
BytesBackground Process
Attached in the processActivityInvisible and there is no startup in the processServiceThese processes can be viewed as background processes. In the system, there are a large number of background processes, andAndroidFollow the principle of "first kill" to kill the background process and obtain resources from the foreground process.
BytesEmpty Process
To improve the performance of the entire system,AndroidApplications that have completed their lifecycles are often stored in the memory.AndroidMaintain these caches to improve the startup time of application restart. These processes are often killed when resources are needed.