当前分类:其它

Android平台“后台进程”的理解

    后台进程,应该有两种理解,一种用户的理解,一种是开发的理解。
    区别在于,对用户而言,所有在运行又看不见(界面)的进程都视为后台进程;而对于开发而言,后台进程只有一种,那就是调用了onStop()方法的进程。说这里不得不提一个Processes的生命周期,一个Android进程,一般分以下几种生命形态:
  1. Foreground process
  2. Visible process
  3. Service process
  4. Background process
  5. Empty process
这里面的第4类,就是开发级别的后台进程。

Background process官方说明

A process holding an activity that's not currently visible to the user (the activity's onStop() method has been called). These processes have no direct impact on the user experience, and the system can kill them at any time to reclaim memory for a foreground, visible, or service process. Usually there are many background processes running, so they are kept in an LRU (least recently used) list to ensure that the process with the activity that was most recently seen by the user is the last to be killed. If an activity implements its lifecycle methods correctly, and saves its current state, killing its process will not have a visible effect on the user experience, because when the user navigates back to the activity, the activity restores all of its visible state. See the Activities document for information about saving and restoring state.

    在adb shell am kill-all命令中解释为:Kill all background processes.
    这里指的就是Android 进程生命周期中的后台进程,所以在执行这个命令时,会发现手动切换到后台的进程 ,并不能被kill掉,原因就在此了,虽然被切换到后台,但在Android系统来看,还不算后台进程,在该进程调用onStop()后才会变成真正的Background process,kill-all命令才会对该进程生效。
    解释这个差异的目的在于明确用户与开发因角度不同,可能会在“需求分析”、“功能设计”等方面出现沟通理解上的存在漏洞。
参考文档:
http://developer.android.com/guide/components/processes-and-threads.html
http://developer.android.com/tools/help/shell.html

成功加入米柚内测粉丝组

 

很荣幸,成功加入米柚内测,赞一个~~

米柚内测用户

 

MonkeyTest更新版本至v0.6

更新内容:

1. 更改默认的测试结果保存路径
2. 增加结果输出到文件
3. 增加设备连接检查
4. 修改部分注释
5. 优化条件判断
6. 将测试完成的结果输出封装成函数,方便多次调用

 

决定学习Python

从今天开始,学习Python!

从今天开始,做一个有坚持的人!

一个月不行,就两个月……

两个月不行,就三个月……

直接“行”为止!

令人头痛的Bugzilla:PPM安装包只有663?

本来想研究下在XAMPP环境下搭建Bugzilla的,结果让人头疼的是,完全按照教程做可以输出的结果就是不一样……

教程中的PPM包最多的有11737个,而我为啥最多只有663个?

教程中的:

我添加后的:

按照教程所说的,添加了这三个链接:

Install Modules

Bugzilla requires a number of perl modules to be installed. They are available in the ActiveState repository and the following additional repositories:
Perl 5.8.x:
http://theoryx5.uwinnipeg.ca/ppms/
Perl 5.10.x:
http://cpan.uwinnipeg.ca/PPMPackages/10xx/ and
http://trouchelle.com/ppm10/

可结果却不一样,为啥呢?有大神路过没?