2012年3月13日
摘要: 定义方法getAppProcess类StreamCousumer的定义见上篇文章同时用到Process和Thread/** * 运行PS命令得到进程信息 * * @return USER PID PPID VSIZE RSS WCHAN PC NAME root 1 0 416 300 c00d4b28 0000cd5c S /init */private List<String> getAllProcess(){ List<String> orgProcList = new ArrayList<String>(); Process proc = null; 阅读全文
posted @ 2012-03-13 16:24 习以常 阅读(399) 评论(0) 推荐(0) 编辑
摘要: /** * 每次记录日志之前先清除日志的缓存, 不然会在两个日志文件中记录重复的日志 */private void clearLogCache(){ Process proc = null; List<String> commandList = new ArrayList<String>(); commandList.add("logcat"); commandList.add("-c"); try { proc = Runtime.getRuntime().exec(commandList.toArray(new String[ 阅读全文
posted @ 2012-03-13 16:04 习以常 阅读(576) 评论(0) 推荐(0) 编辑
摘要: android.context.ContextWrapper.registerReceiverpublic Intent registerReceiver (BroadcastReceiver receiver, IntentFilter filter) Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application threa 阅读全文
posted @ 2012-03-13 15:14 习以常 阅读(24932) 评论(0) 推荐(1) 编辑
摘要: 近期在一个近10万行代码的android工程中修复BUG。为查找到BUG的位置需要将工程中的日志全部输出到文件中。工程运行过程中有3个进程。com.citrix.Receivercom.citrix.Receiver:pnagentcom.citrix.Receiver:wfica在本文中给第1个进程命名进程A;第2个进程命名进程B;第3个进程命名进程C。第2个进程对应AndroidManifest.xml文件<!-- PNAgent multi-tab activity --><activity android:name="com.citrix.client.pn 阅读全文
posted @ 2012-03-13 12:40 习以常 阅读(1366) 评论(0) 推荐(0) 编辑