Foreground process
The foreground process is the process that the user is currently using. Only some foreground processes can exist at all times. They were the last to be ended when the memory was low to the point where they couldn't even run. In general, in this case, the device makes memory scheduling and aborts some foreground processes to maintain a response to user interaction.
If the following is the case, then the foreground process:
This process runs an activity that is interacting with the user (the Onresume () method of the activity is called).
This process has a service that is bound to a real activity that is currently interacting with the user.
This process has a service object that is executing a callback function for its life cycle (OnCreate (), OnStart (), OnDestroy ())
This process has a Broadcastreiver object that is in the OnReceive () method.
Visible process
The visible process does not contain a component of the foreground but a visible process on the screen is very important, unless the foreground process needs to get its resources, otherwise it will not be aborted.
If one of the following scenarios is a visible process:
This process contains an activity that is not in the foreground, but is still visible to the user (the activity's OnPause () method is called), which is likely to occur, for example, if the foreground activity is a dialog box, will allow you to see the previous activity behind it.
This process has a service that is bound to a visible activity.
Service process
Runs a service that starts with the StartService () method, which is not part of the 2 higher importance mentioned above. The process in which the service is located is not directly visible to the user, but they perform tasks that the user is very concerned about (such as playing MP3, downloading data from the network). As long as the foreground process and visible processes have enough memory, the system does not recycle them.
Background process
Runs an activity that is not visible to the user (called the OnStop () method). These processes have no direct impact on the user experience and can be recycled when the service process, visible processes, and foreground processes require memory. Often, there are many invisible processes running in the system, and they are stored in the LRU (least recently used) list so that they are reclaimed by the first time when the memory is low. If an activity correctly executes its lifecycle, shutting down the process does not have much impact on the user experience.
Empty process
No program components are running. The only reason to run these processes is to shorten the startup time that the next program needs to be reused as a cache. These processes are often aborted by the system, which adjusts the balance between the program cache and the system cache.
When Android ratings the importance of a process, it chooses its highest level. For example, if a process contains a service and a visual activity, the process is grouped into a visual process rather than a service process.
In addition, the level of a process may increase when it is dependent on another process. A process that serves other processes is never less important than the process being serviced. Because the service process is more important than the background activity process, an activity that needs to be time-consuming is best to start a service to do the work, rather than start a subprocess-especially if the operation takes longer than the activity exists. For example, playing music in the background, uploading a picture of a webcam to the web, using a service can make the process at least as important as the service process level, regardless of the current state of the activity. Broadcast receivers do time-consuming work, you should also enable a service instead of opening a thread.
Source: >
Android Process (review)