Implementation of Android one click cleaning and memory cleaning functions

360 desktop and Jinshan cleaning master all provide functions such as one click cleaning and one click acceleration. In fact, they kill some background processes to release memory.

The basic idea is to list all running processes and check their important values (runningappprocessinfo. Importance. The greater the value, the lower the importance of the process). You can set a threshold. If the important value of the process is greater than the threshold, you can kill the process.

The important values of the process have the following levels:

Permission required:

The specific operation codes are as follows:

be careful:

The threshold I choose here is import_ Visible level, that is, invisible background processes and services will be killed (except for some system processes). The cleaning effect is similar to that of Jinshan cleaning master and 360 desktop.

If you don't want to kill too hard, you can choose Import_ Service level, kill those useless or empty processes for a long time. The cleaning force at this level is not strong enough to achieve the effect of Jinshan cleaning master.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>