(四十六)从events_log看应用退出

前言:以前看log主要看crash_log和main_log,现在sys_log看的稍微多一点,events_log几乎没有关注过,现在关注一下,看看其中隐藏着什么,以应用各种退出方式作为切入点。


1. events_log简介

我对events_log的认识还比较浅,比较熟悉的就是它会和应用的生命周期有关,比如创建暂停销毁(onCreate OnPause OnDestroy)有关。看百度上有个比较精炼的介绍,events_log就是有关ActivityManager和PowerManager等相关的log,后面有其他认识再补充。

adb抓取events_log命令: adb logcat -b events

2.抓取应用退出log

应用crash的时候我总喜欢看下crash_log,里面会把堆栈打印出来,空指针什么的一目了然,那event_log在各种应用退出的情况下是如何打印的呢?

测试demo:

package com.example.onkeydowntest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "jiatai";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        Log.d(TAG, "onKeyDown : "+ keyCode);
        switch (keyCode) {
            case KeyEvent.KEYCODE_VOLUME_UP:
                Log.d(TAG, "KeyEvent.KEYCODE_VOLUME_UP");
                String s = null;
                if(s.equals("jiatai")) return false;
                return true;
            case KeyEvent.KEYCODE_VOLUME_DOWN:
                Log.d(TAG, "KeyEvent.KEYCODE_VOLUME_DOWN");
                return true;
            default:
                break;
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        //Log.d(TAG, "onKeyUp", new RuntimeException());
        Log.d(TAG, "onKeyUp : "+ keyCode);
        return super.onKeyUp(keyCode, event);
    }
}


2.1 应用正常退出

正常从桌面图标启动,然后返回退出主界面,最后从最近任务移除应用。

//正常从桌面图标启动
06-22 10:17:24.157   794  3981 I am_create_activity: [0,76731128,78,com.example.onkeydowntest/.MainActivity,android.intent.action.MAIN,NULL,NULL,270532608]
06-22 10:17:24.235   794  1878 I am_proc_start: [0,6269,10134,com.example.onkeydowntest,activity,com.example.onkeydowntest/.MainActivity]
06-22 10:17:24.304   794  3981 I am_proc_bound: [0,6269,com.example.onkeydowntest]
06-22 10:17:24.313   794  3981 I am_restart_activity: [0,76731128,78,com.example.onkeydowntest/.MainActivity]
06-22 10:17:24.315   794  3981 I am_set_resumed_activity: [0,com.example.onkeydowntest/.MainActivity,minimalResumeActivityLocked]
06-22 10:17:25.015  6269  6269 I am_on_resume_called: [0,com.example.onkeydowntest.MainActivity,LAUNCH_ACTIVITY]
06-22 10:17:25.260   794   908 I sysui_multi_action: [319,167,321,127,322,1095,325,1913,757,761,758,7,759,1,806,com.example.onkeydowntest,871,com.example.onkeydowntest.MainActivity,904,com.xxxx.launcher,905,0,945,152]
06-22 10:17:25.261   794   908 I am_activity_launch_time: [0,76731128,com.example.onkeydowntest/.MainActivity,1027,1027]
//按返回键退出主界面
06-22 10:17:58.757   794  3981 I am_finish_activity: [0,76731128,78,com.example.onkeydowntest/.MainActivity,app-request]
06-22 10:17:58.760   794  3981 I am_pause_activity: [0,76731128,com.example.onkeydowntest/.MainActivity]
06-22 10:17:58.768  6269  6269 I am_on_paused_called: [0,com.example.onkeydowntest.MainActivity,handlePauseActivity]
06-22 10:17:59.113   794   899 I am_destroy_activity: [0,76731128,78,com.example.onkeydowntest/.MainActivity,finish-imm]
06-22 10:17:59.124  6269  6269 I am_on_stop_called: [0,com.example.onkeydowntest.MainActivity,destroy]
//从最近任务移除应用
06-22 10:18:18.937  1036  1036 I sysui_action: [289,ComponentInfo{com.example.onkeydowntest/com.example.onkeydowntest.MainActivity}]
06-22 10:18:18.938  1036  1036 I sysui_multi_action: [757,289,758,4,806,ComponentInfo{com.example.onkeydowntest/com.example.onkeydowntest.MainActivity}]
06-22 10:18:18.940   794  5473 I am_kill : [0,6269,com.example.onkeydowntest,900,remove task]
06-22 10:18:19.084   794  1732 I am_proc_died: [0,6269,com.example.onkeydowntest,900,17]

附另外抓的sys_log

06-22 11:28:19.055   868  4357 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.onkeydowntest/.MainActivity (has extras)} from uid 10012
06-22 11:28:19.081   868  1939 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{d19fab4 u0 com.example.onkeydowntest/.MainActivity t97}. System free memory=621318144
06-22 11:28:19.098   868  1939 I ActivityManager: Start proc 5551:com.example.onkeydowntest/u0a134 for activity com.example.onkeydowntest/.MainActivity duration: 16
06-22 11:28:19.100   868  1939 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{d19fab4 u0 com.example.onkeydowntest/.MainActivity t97}. System free memory=620093440
06-22 11:28:42.550   868  1929 D ActivityManager: [MemInfo] Before resuming ActivityRecord{75f8a7c u0 com.xxxx.launcher/com.android.launcher3.Launcher t93}. System free memory=618897408
06-22 11:28:42.883   868   942 I ActivityManager: Killing 4956:com.android.providers.calendar/u0a37 (adj 906): empty #17
06-22 11:28:54.603   868  1296 I ActivityManager: START u0 {flg=0x10804000 cmp=com.android.systemui/.recents.RecentsActivity} from uid 10017
06-22 11:28:54.639   868  1296 D ActivityManager: [MemInfo] Before resuming ActivityRecord{1185a46 u0 com.android.systemui/.recents.RecentsActivity t96}. System free memory=612225024
06-22 11:28:58.697   868  4357 I ActivityManager: Killing 5551:com.example.onkeydowntest/u0a134 (adj 900): remove task
06-22 11:28:58.700   868  1999 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.xxxx.launcher/com.android.launcher3.Launcher} from uid 10017
06-22 11:28:58.736   868  1999 D ActivityManager: [MemInfo] Before resuming ActivityRecord{75f8a7c u0 com.xxxx.launcher/com.android.launcher3.Launcher t93}. System free memory=637976576
06-22 11:28:58.831   868  4357 W ActivityManager: App Op not allow to restart app com.example.onkeydowntest/10134
06-22 11:28:58.851   868   950 W ActivityManager: setHasOverlayUi called on unknown pid: 5551



2.2 用adb命令杀死应用

正常从桌面启动,然后用adb命令杀死

//正常从桌面启动
06-22 10:19:41.407   794  5437 I am_create_activity: [0,43078101,79,com.example.onkeydowntest/.MainActivity,android.intent.action.MAIN,NULL,NULL,270532608]
06-22 10:19:41.459   794  5437 I am_proc_start: [0,6401,10134,com.example.onkeydowntest,activity,com.example.onkeydowntest/.MainActivity]
06-22 10:19:41.523   794   834 I am_proc_bound: [0,6401,com.example.onkeydowntest]
06-22 10:19:41.532   794   834 I am_restart_activity: [0,43078101,79,com.example.onkeydowntest/.MainActivity]
06-22 10:19:41.534   794   834 I am_set_resumed_activity: [0,com.example.onkeydowntest/.MainActivity,minimalResumeActivityLocked]
06-22 10:19:42.226  6401  6401 I am_on_resume_called: [0,com.example.onkeydowntest.MainActivity,LAUNCH_ACTIVITY]
06-22 10:19:42.466   794   908 I sysui_multi_action: [319,136,321,90,322,1049,325,2050,757,761,758,7,759,1,806,com.example.onkeydowntest,871,com.example.onkeydowntest.MainActivity,904,com.xxxx.launcher,905,0,945,122]
06-22 10:19:42.466   794   908 I am_activity_launch_time: [0,43078101,com.example.onkeydowntest/.MainActivity,1006,1006]

//然后用adb命令杀死
06-22 10:19:53.949   794   891 I am_pss  : [6401,10134,com.example.onkeydowntest,39263232,33537024,132096]
06-22 10:20:02.544   794  1965 I am_proc_died: [0,6401,com.example.onkeydowntest,0,2]
06-22 10:20:02.553   794  1965 I am_finish_activity: [0,43078101,79,com.example.onkeydowntest/.MainActivity,proc died without state saved]


systemUI的最近任务中仍然有应用的启动记录,移除,打印如下log

06-22 10:21:44.465  1036  1036 I sysui_action: [289,ComponentInfo{com.example.onkeydowntest/com.example.onkeydowntest.MainActivity}]
06-22 10:21:44.466  1036  1036 I sysui_multi_action: [757,289,758,4,806,ComponentInfo{com.example.onkeydowntest/com.example.onkeydowntest.MainActivity}]


adb杀死应用命令:                                    
1|xxx:/ # ps -A | grep onkeydown                                       
u0_a134       6401   503 4513416 105752 SyS_epoll_wait 7f52cf86ec S com.example.onkeydowntest
xxxx:/ # kill 6401

6401就是应用对应的进程号。可以看到6401和am_proc_start、am-proc_bond的第二位数字是对应的。

附重新抓的sys_log

06-22 11:32:49.636   868  4357 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.onkeydowntest/.MainActivity (has extras)} from uid 10012
06-22 11:32:49.709   868  2000 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{7e1e417 u0 com.example.onkeydowntest/.MainActivity t99}. System free memory=608862208
06-22 11:32:49.726   868  2000 I ActivityManager: Start proc 5880:com.example.onkeydowntest/u0a134 for activity com.example.onkeydowntest/.MainActivity duration: 16
06-22 11:32:49.727   868  2000 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{7e1e417 u0 com.example.onkeydowntest/.MainActivity t99}. System free memory=607121408
06-22 11:33:00.552   868  1255 I ActivityManager: Process com.example.onkeydowntest (pid 5880) has died: fore TOP 
06-22 11:33:00.552   868  1255 W ActivityManager: App Op not allow to restart app com.example.onkeydowntest/10134
06-22 11:33:00.558   868  1255 W ActivityManager: Force removing ActivityRecord{7e1e417 u0 com.example.onkeydowntest/.MainActivity t99}: app died, no saved state
06-22 11:33:00.605   868  1255 D ActivityManager: [MemInfo] Before resuming ActivityRecord{75f8a7c u0 com.xxxx.launcher/com.android.launcher3.Launcher t93}. System free memory=616087552
06-22 11:33:00.619   868   950 W ActivityManager: setHasOverlayUi called on unknown pid: 5880


2.3 应用自身crash

从下面的log可以看到应用crash的时候events_log中也有相关打印的am_crash和NullPointerException,23对应着发生crash的代码行数。

//从桌面启动应用
06-22 10:30:27.378   794   834 I am_create_activity: [0,257695215,81,com.example.onkeydowntest/.MainActivity,android.intent.action.MAIN,NULL,NULL,270532608]
06-22 10:30:27.412   794   834 I am_proc_start: [0,7184,10134,com.example.onkeydowntest,activity,com.example.onkeydowntest/.MainActivity]
06-22 10:30:27.487   794  1968 I am_proc_bound: [0,7184,com.example.onkeydowntest]
06-22 10:30:27.501   794  1968 I am_restart_activity: [0,257695215,81,com.example.onkeydowntest/.MainActivity]
06-22 10:30:27.503   794  1968 I am_set_resumed_activity: [0,com.example.onkeydowntest/.MainActivity,minimalResumeActivityLocked]
06-22 10:30:28.222  7184  7184 I am_on_resume_called: [0,com.example.onkeydowntest.MainActivity,LAUNCH_ACTIVITY]
06-22 10:30:28.468   794   908 I sysui_multi_action: [319,135,321,100,322,1080,325,2696,757,761,758,7,759,1,806,com.example.onkeydowntest,871,com.example.onkeydowntest.MainActivity,904,com.xxxx.launcher,905,0,945,115]
06-22 10:30:28.468   794   908 I am_activity_launch_time: [0,257695215,com.example.onkeydowntest/.MainActivity,1052,1052]


//按音量上键造成空指针crash
06-22 10:30:32.751   794  1965 I am_crash: [7184,0,com.example.onkeydowntest,952680262,java.lang.NullPointerException,Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference,MainActivity.java,23]
06-22 10:30:32.759   794  1965 I am_finish_activity: [0,257695215,81,com.example.onkeydowntest/.MainActivity,force-crash]
06-22 10:30:32.761   794  1965 I am_pause_activity: [0,257695215,com.example.onkeydowntest/.MainActivity]
06-22 10:30:33.709   794   899 I am_destroy_activity: [0,257695215,81,com.example.onkeydowntest/.MainActivity,finish-imm]



//截图过程中的莫名打印
06-22 10:31:05.911   794   891 I am_pss  : [7184,10134,com.example.onkeydowntest,45856768,39862272,136192]


//点击忽略(直至设备重启)
06-22 10:31:38.307   794  5471 I am_proc_died: [0,7184,com.example.onkeydowntest,900,17]


//从最近任务栏中去除应用
06-22 10:31:45.690  1036  1036 I sysui_action: [289,ComponentInfo{com.example.onkeydowntest/com.example.onkeydowntest.MainActivity}]
06-22 10:31:45.691  1036  1036 I sysui_multi_action: [757,289,758,4,806,ComponentInfo{com.example.onkeydowntest/com.example.onkeydowntest.MainActivity}]
截图如下所示,

附重新抓的sys_log

06-22 11:34:44.239   868  5873 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.onkeydowntest/.MainActivity (has extras)} from uid 10012
06-22 11:34:44.266   868  1254 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{9e53ee9 u0 com.example.onkeydowntest/.MainActivity t100}. System free memory=574717952
06-22 11:34:44.283   868  1254 I ActivityManager: Start proc 5982:com.example.onkeydowntest/u0a134 for activity com.example.onkeydowntest/.MainActivity duration: 17
06-22 11:34:44.285   868  1254 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{9e53ee9 u0 com.example.onkeydowntest/.MainActivity t100}. System free memory=573767680
06-22 11:34:47.557   868  5873 W ActivityManager:   Force finishing activity com.example.onkeydowntest/.MainActivity
06-22 11:34:47.592   868   943 I ActivityManager: Showing crash dialog for package com.example.onkeydowntest u0
06-22 11:34:48.061   868   942 W ActivityManager: Activity pause timeout for ActivityRecord{9e53ee9 u0 com.example.onkeydowntest/.MainActivity t100 f}
06-22 11:34:48.072   868   942 D ActivityManager: [MemInfo] Before resuming ActivityRecord{75f8a7c u0 com.xxxx.launcher/com.android.launcher3.Launcher t93}. System free memory=564867072

//点击忽略(直至设备重启)
06-22 11:34:54.172   868  1255 I ActivityManager: Process com.example.onkeydowntest (pid 5982) has died: cch  CEM 
06-22 11:34:54.172   868  1255 W ActivityManager: App Op not allow to restart app com.example.onkeydowntest/10134
06-22 11:34:54.238   868   950 W ActivityManager: setHasOverlayUi called on unknown pid: 5982


2.4 设置中强行停止

//桌面打开应用
06-22 11:08:32.207   794  1396 I am_create_activity: [0,201779972,85,com.example.onkeydowntest/.MainActivity,android.intent.action.MAIN,NULL,NULL,270532608]
06-22 11:08:32.249   794  1396 I am_proc_start: [0,7739,10134,com.example.onkeydowntest,activity,com.example.onkeydowntest/.MainActivity]
06-22 11:08:32.317   794   837 I am_proc_bound: [0,7739,com.example.onkeydowntest]
06-22 11:08:32.327   794   837 I am_restart_activity: [0,201779972,85,com.example.onkeydowntest/.MainActivity]
06-22 11:08:32.329   794   837 I am_set_resumed_activity: [0,com.example.onkeydowntest/.MainActivity,minimalResumeActivityLocked]
06-22 11:08:33.025  7739  7739 I am_on_resume_called: [0,com.example.onkeydowntest.MainActivity,LAUNCH_ACTIVITY]
06-22 11:08:33.259   794   908 I sysui_multi_action: [319,134,321,81,322,1050,325,4981,757,761,758,7,759,1,806,com.example.onkeydowntest,871,com.example.onkeydowntest.MainActivity,904,com.xxxx.launcher,905,0,945,119]
06-22 11:08:33.259   794   908 I am_activity_launch_time: [0,201779972,com.example.onkeydowntest/.MainActivity,1013,1013]
06-22 11:08:35.166   794   967 I am_pause_activity: [0,201779972,com.example.onkeydowntest/.MainActivity]
06-22 11:08:35.168  7739  7739 I am_on_paused_called: [0,com.example.onkeydowntest.MainActivity,handlePauseActivity]
06-22 11:08:35.201   794   899 I am_stop_activity: [0,201779972,com.example.onkeydowntest/.MainActivity]
06-22 11:08:35.216  7739  7739 I am_on_stop_called: [0,com.example.onkeydowntest.MainActivity,handleStopActivity]


//进入到设置中的时候的莫名打印
06-22 11:09:06.048   794   891 I am_pss  : [7739,10134,com.example.onkeydowntest,25741312,20140032,146432]

//设置中点击强行停止
06-22 11:09:15.173  7782  7782 I sysui_action: [807,com.example.onkeydowntest]
06-22 11:09:15.173  7782  7782 I sysui_multi_action: [757,807,758,4,806,com.example.onkeydowntest]
06-22 11:09:15.175   794  1876 I am_kill : [0,7739,com.example.onkeydowntest,700,stop com.example.onkeydowntest]
06-22 11:09:15.197   794  1876 I am_finish_activity: [0,201779972,85,com.example.onkeydowntest/.MainActivity,force-stop]
06-22 11:09:15.214   794   899 I am_destroy_activity: [0,201779972,85,com.example.onkeydowntest/.MainActivity,finish-idle]
06-22 11:09:15.279   794   794 I notification_cancel_all: [1000,794,com.example.onkeydowntest,0,0,0,5,NULL]
06-22 11:09:15.280   794   794 I notification_cancel_all: [1000,794,com.example.onkeydowntest,0,0,0,5,NULL]
06-22 11:09:15.375   794   794 I notification_cancel_all: [1000,794,com.example.onkeydowntest,0,0,0,5,NULL]
06-22 11:09:15.640   794   794 I notification_cancel_all: [1000,794,com.example.onkeydowntest,0,0,0,5,NULL]
06-22 11:09:15.776   794   794 I notification_cancel_all: [1000,794,com.example.onkeydowntest,0,0,0,5,NULL]

附重新抓的sys_log

06-22 11:36:01.055   868  1945 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.onkeydowntest/.MainActivity (has extras)} from uid 10012
06-22 11:36:01.087   868  1945 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{fb8a26e u0 com.example.onkeydowntest/.MainActivity t101}. System free memory=572157952
06-22 11:36:01.107   868  1945 I ActivityManager: Start proc 6070:com.example.onkeydowntest/u0a134 for activity com.example.onkeydowntest/.MainActivity duration: 19
06-22 11:36:01.113   868  1945 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{fb8a26e u0 com.example.onkeydowntest/.MainActivity t101}. System free memory=570048512
06-22 11:36:03.269   868  1009 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.xxxx.launcher/com.android.launcher3.Launcher (has extras)} from uid 1000
06-22 11:36:03.303   868  1009 D ActivityManager: [MemInfo] Before resuming ActivityRecord{75f8a7c u0 com.xxxx.launcher/com.android.launcher3.Launcher t93}. System free memory=553832448
06-22 11:36:07.379   868  1949 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings (has extras)} from uid 10012
06-22 11:36:07.419   868  1949 D ActivityManager: [MemInfo] Process already exists before starting ActivityRecord{cc77a89 u0 com.android.settings/.Settings t102}. System free memory=533790720
06-22 11:36:10.083   868  1927 I ActivityManager: START u0 {flg=0x8000 cmp=com.android.settings/.Settings$AppAndNotificationDashboardActivity (has extras)} from uid 1000
06-22 11:36:10.114   868  1927 D ActivityManager: [MemInfo] Process already exists before starting ActivityRecord{746b811 u0 com.android.settings/.Settings$AppAndNotificationDashboardActivity t102}. System free memory=538869760
06-22 11:36:11.998   868  1945 I ActivityManager: START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from uid 1000
06-22 11:36:12.035   868  1927 D ActivityManager: [MemInfo] Process already exists before starting ActivityRecord{ed4f214 u0 com.android.settings/.SubSettings t102}. System free memory=538177536
06-22 11:36:21.186   868  1057 I ActivityManager: START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from uid 1000
06-22 11:36:21.208   868  1945 D ActivityManager: [MemInfo] Process already exists before starting ActivityRecord{bfb0a74 u0 com.android.settings/.SubSettings t102}. System free memory=521396224
06-22 11:36:21.502   868  1057 I ActivityManager: Start proc 6148:com.google.android.packageinstaller/u0a31 for service com.google.android.packageinstaller/com.android.packageinstaller.permission.service.RuntimePermissionPresenterServiceImpl duration: 15
06-22 11:36:24.190   868  1949 I ActivityManager: Force stopping com.example.onkeydowntest appid=10134 user=0: from pid 5736
06-22 11:36:24.191   868  1949 I ActivityManager: Killing 6070:com.example.onkeydowntest/u0a134 (adj 700): stop com.example.onkeydowntest
06-22 11:36:24.192   868  1949 W ActivityManager: App Op not allow to restart app com.example.onkeydowntest/10134
06-22 11:36:24.203   868  1949 I ActivityManager:   Force finishing activity ActivityRecord{fb8a26e u0 com.example.onkeydowntest/.MainActivity t101}
06-22 11:36:24.218   868  1949 I ActivityManager: Force stopping com.example.onkeydowntest appid=10134 user=0: from pid 5736
06-22 11:36:24.223   868  1949 I ActivityManager:   Force finishing activity ActivityRecord{fb8a26e u0 com.example.onkeydowntest/.MainActivity t101 f}
06-22 11:36:24.223   868  1949 W ActivityManager: Duplicate finish request for ActivityRecord{fb8a26e u0 com.example.onkeydowntest/.MainActivity t101 f}
06-22 11:36:24.392   868   950 W ActivityManager: setHasOverlayUi called on unknown pid: 6070




2.5 重启导致应用退出

貌似没什么有用的信息,还少了点=-=

06-22 11:18:08.100   794  1210 I am_create_activity: [0,182410702,87,com.example.onkeydowntest/.MainActivity,android.intent.action.MAIN,NULL,NULL,270532608]
06-22 11:18:08.147   794  1210 I am_proc_start: [0,8052,10134,com.example.onkeydowntest,activity,com.example.onkeydowntest/.MainActivity]
06-22 11:18:08.245   794  1701 I am_proc_bound: [0,8052,com.example.onkeydowntest]
06-22 11:18:08.264   794  1701 I am_restart_activity: [0,182410702,87,com.example.onkeydowntest/.MainActivity]
06-22 11:18:08.266   794  1701 I am_set_resumed_activity: [0,com.example.onkeydowntest/.MainActivity,minimalResumeActivityLocked]
06-22 11:18:09.029  8052  8052 I am_on_resume_called: [0,com.example.onkeydowntest.MainActivity,LAUNCH_ACTIVITY]
06-22 11:18:09.285   794   908 I sysui_multi_action: [319,182,321,116,322,1184,325,5557,757,761,758,7,759,1,806,com.example.onkeydowntest,871,com.example.onkeydowntest.MainActivity,904,com.xxxx.launcher,905,0,945,158]
06-22 11:18:09.285   794   908 I am_activity_launch_time: [0,182410702,com.example.onkeydowntest/.MainActivity,1141,1141]


//重启
06-22 11:18:19.952   794   891 I am_pss  : [8052,10134,com.example.onkeydowntest,42259456,37026816,150528]
06-22 11:18:20.523   794  8093 I am_pause_activity: [0,182410702,com.example.onkeydowntest/.MainActivity]
06-22 11:18:20.525  8052  8052 I am_on_paused_called: [0,com.example.onkeydowntest.MainActivity,handlePauseActivity]
06-22 11:18:20.538   794   899 I am_stop_activity: [0,182410702,com.example.onkeydowntest/.MainActivity]
06-22 11:18:20.548  8052  8052 I am_on_stop_called: [0,com.example.onkeydowntest.MainActivity,sleeping]

有systemserver和am相关打印

06-22 11:20:23.671282   843  1970 I dvm_lock_sample: [system_server,1,Binder:843_12,10,ActivityManagerService.java,18788,boolean com.android.server.am.ActivityManagerService.stopServiceToken(android.content.ComponentName, android.os.IBinder, int),-,18876,boolean com.android.server.am.ActivityManagerService.unbindService(android.app.IServiceConnection),2]
06-22 11:20:23.818312   843  1946 I dvm_lock_sample: [system_server,1,Binder:843_F,39,ActivityManagerService.java,19330,void com.android.server.am.ActivityManagerService.unregisterReceiver(android.content.IIntentReceiver),-,18876,boolean com.android.server.am.ActivityManagerService.unbindService(android.app.IServiceConnection),7]

附重新抓的sys_log

06-22 11:37:28.244   868  4357 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.onkeydowntest/.MainActivity (has extras)} from uid 10012
06-22 11:37:28.276   868  1933 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{dc6042a u0 com.example.onkeydowntest/.MainActivity t104}. System free memory=660869120
06-22 11:37:28.291   868  1933 I ActivityManager: Start proc 6323:com.example.onkeydowntest/u0a134 for activity com.example.onkeydowntest/.MainActivity duration: 14
06-22 11:37:28.300   868  1933 D ActivityManager: [MemInfo] Process does not exist before starting ActivityRecord{dc6042a u0 com.example.onkeydowntest/.MainActivity t104}. System free memory=658677760
06-22 11:37:33.643   868  1931 I ActivityManager: Start proc 6387:com.xxxx.deskclock:ui/u0a60 for broadcast com.xxxx.deskclock/.AlarmInitReceiver duration: 25
06-22 11:37:33.869   868  6225 I ActivityManager: Start proc 6417:com.xxxx.livedemoservice/1000 for broadcast com.xxxx.livedemoservice/.receiver.BootReceiver duration: 14
06-22 11:37:34.026   868  1933 I ActivityManager: Start proc 6444:com.xxxx.sysmonitor/u0a46 for broadcast com.xxxx.sysmonitor/.ShutDownReceiver duration: 17
06-22 11:37:35.241   868   888 I ActivityManager: Process com.android.bluetooth (pid 1669) has died: fore SVC 


3. 总结

从events_log中可以看到应用的生命周期变化,应用的进程号以及crash的部分信息,另外可以分辨出是用户杀死/adb 杀死/crash 杀死/设置强行停止,这样看起来有用信息还是不少的。

相关推荐
©️2020 CSDN 皮肤主题: 鲸 设计师:meimeiellie 返回首页