Android一键式清理,内存清理功能的实山清理大师等均提供一键式清理和一键加速等功能。实际上,它们杀死了一些后台进程以达到释放内存的目的。
基本思想是列出所有正在运行的进程,检查它们的重要值(RunningAppProcessInfo.importance,该值越大,进程的重要性越低),可以设置一个阈值,如果过程大于阈值,则可以终止该过程。
该过程的重要性具有以下级别:
/**
* Constant for {@link #importance}: this is a persistent process.
* Only used when reporting to process observers.
* @hide
*/
public static final int IMPORTANCE_PERSISTENT = 50;
/**
* Constant for {@link #importance}: this process is running the
* foreground UI.
*/
public static final int IMPORTANCE_FOREGROUND = 100;
/**
* Constant for {@link #importance}: this process is running something
* that is actively visible to the user, though not in the immediate
* foreground.
*/
public static final int IMPORTANCE_VISIBLE = 200;
/**
* Constant for {@link #importance}: this process is running something<