在安卓的调试过程当中,有一条很重要的命令 logcat -b events.我们可以通过这条命令获取到大量的的信息。本文主要以其中获取到的AM相关信息进行解释。(下文中的参数,如果重复不再重复解释,请自行查找。)
30001.am_finish_activity
当activity finish时打印,包含参数:
(An activity is being finished:)
(1) User 用户
(2) Token (Token标识了一个ActivityRecord对象,即间接标识了一个Activity。)
(3) TaskID 任务栈id
(4) ComponentName 组件名
(5) Reason 原因
打印地址 : 位于AS.finishActivityLocked, removeHistoryRecordsForAppLocked
30002.am_task_to_front
当task被带到屏幕前方时打印,包含参数:
( A task is being brought to the front of the screen:)
(1) User
(2) Task 任务栈
打印地址:位于AS.moveTaskToFrontLocked
30003.am_new_intent
当现有的activity被赋予新的intent时打印,包含参数:
(An existing activity is being given a new intent:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
(5) Action
(6) MIMEType ( Intent-Filter中的有一个mimeType . 它的作用是告诉Android系统本Activity可以处理的文件的类型。如设置为 “text/plain”表示可以处理“.txt”文件.)
30004.am_create_task
当创造task时打印,包含参数:
(A new task is being created:)
(1) User
(2) Task ID
30005.am_create_activity
当一个新的activity在一个现有的task中被创建时打印,包含参数:
(A new activity is being created in an existing task:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
(5) Action
(6) MIMEType
(7) URI
(8) Flags
打印地址:位于ASS.startActivityUncheckedLocked
30006.am_restart_activity
当activity已恢复到前台,但尚未运行时打印,包含参数:
(An activity has been resumed into the foreground but was not already running:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
打印地址:位于ASS.realStartActivityLocked
30007.am_resume_activity
当activity已恢复,现在位于前台时打印,包含参数:
(An activity has been resumed and is now in the foreground:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
打印地址:位于AS.resumeTopActivityInnerLocked
30008.am_anr
当anr时打印,包含参数:
(Application Not Responding)
(1) User
(2) pid (PID是进程的身份标识)
(3) Package Name
(4) Flags
(5) reason
打印地址:位于AMS.appNotResponding
30009.am_activity_launch_time
activity启动时间,包含参数:
(Activity launch time)
(1) User
(2) Token
(3) ComponentName
(4) time
打印地址:位于ActivityRecord.reportLaunchTimeLocked(),后面两个参数分别是thisTime和 totalTime.(在这里特殊解释一下最后的两个time表示什么,在一部分应用中,我们可能先启动一个activity进行一些判断操作等之后再启动新的activity,totalTime包含这两次activity启动时间的总和,而thisTime,只表示最后一个activity的启动时间)。
30010.am_proc_bound
应用进程创建完毕,包含参数:
(Application process bound to work)
(1) User
(2) PID
(3) ProcessName
打印地址:位于AMS.attachApplicationLocked
30011.am_proc_died
当进程死掉时打印,包含参数:
(Application process died)
(1) User
(2) PID
(3) ProcessName
30012.am_failed_to_pause
当活动管理器未能暂停给定的activity时打印(窗口Pause超时),包含参数:
(The Activity Manager failed to pause the given activity.)
(1) User
(2) Token
(3) Wanting to pause
(4) Currently pausing
30013.am_pause_activity
当尝试暂停当前activity时打印(窗口Pause开始),包含参数:
( Attempting to pause the current activity)
(1) User
(2) Token
(3) ComponentName
打印地址:位于AS.startPausingLocked
30014.am_proc_start
当进程被启动时打印(开始创建应用进程),包含参数:
(Application process has been started)
(1) User
(2) PID
(3) UID
(4) ProcessName
(5) Type
(6) Component
打印地址:位于AMS.startProcessLocked,启动进程
30015.30015 am_proc_bad
当一个进程已经被标记成bad时打印,包含参数:
(An application process has been marked as bad)
(1) User
(2) PID
(3) ProcessName
30016.am_proc_good
当一个bad的进程被标记为good时打印,包含参数:
(An application process that was bad is now marked as good)
(1) User
(2) PID
(3) ProcessName
30017.am_low_memory
当内存不足时打印,包含参数:
(Reporting to applications that memory is low)
(1) NumProcesses (进程数)
打印地址:位于AMS.killAllBackgroundProcesses或者AMS.appDiedLocked,记录当前Lru进程队列长度。
30018.am_destroy_activity
当activity被销毁时打印,包含参数:
(An activity is being destroyed:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
(5) Reason
打印地址:位于AS.destroyActivityLocked
30019.am_relaunch_resume_activity
当activity已重新启动、恢复,现在位于前台时打印,包含参数:
(An activity has been relaunched, resumed, and is now in the foreground:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
30020.am_relaunch_activity
当activity已重新启动时打印,包含参数:
(An activity has been relaunched:)
(1) User
(2) Token
(3) TaskID
(4) ComponentName
30021.am_on_paused_called
当activity的onpaused已经被调用时打印,包含参数:
(The activity’s onPause has been called.)
(1) User
(2) ComponentName
30022.am_on_resume_called
当activity的onResume已经被调用时打印,包含参数:
(The activity’s onResume has been called)
(1) User
(2) ComponentName
30023.am_kill
终止进程以回收内存时打印,包含参数:
(Kill a process to reclaim memory.)
(1) User
(2) PID
(3) ProcessName
(4) OomAdj ((Out of Memory Adjustment)是android系统在内存不足情况下进行内存调整的重要参数)
(5) Reason
打印地址:位于ProcessRecord.kill,杀掉进程
30024.am_broadcast_discard_filter
丢弃未传递的序列化广播(超时/anr/crash)时打印,包含参数:
( Discard an undelivered serialized broadcast (timeout/ANR/crash))
(1) User
(2) Broadcast
(3) Action
(4) ReceiverNumber
(5) BroadcastFilter
打印地址:位于BroadcastQueue.logBroadcastReceiverDiscardLocked
30025.am_broadcast_discard_app
包含参数:
(1) User
(2) Broadcast
(3) Action
(4) ReceiverNumber
(5) App
打印地址:位于BroadcastQueue.logBroadcastReceiverDiscardLocked
30030.am_create_service
当service被创建时打印,包含参数:
(A service is being created)
(1) User
(2) ServiceRecord
(3) Name
(4) UID
(5) PID
30031.am_destroy_service
当service被销毁时打印,包含参数:
(A service is being destroyed)
(1) User
(2) ServiceRecord
(3) PID
30032.am_process_crashed_too_much
当一个进程崩溃了太多次,正在被清除时打印,包含参数:
(A process has crashed too many times, it is being cleared)
(1) User
(2) Name
(3) PID
30033.am_drop_process
当未知进程正在尝试附加到activity manager时打印,包含参数:
(An unknown process is trying to attach to the activity manager)
(1) PID
30034.am_service_crashed_too_much
当服务崩溃太多次,正在停止时打印,包含参数:
(A service has crashed too many times, it is being stopped)
(1) User
(2) Crash Count
(3) ComponentName
(4) PID
30035.am_schedule_service_restart
当服务的进程结束后将重新启动时打印,包含参数:
(A service is going to be restarted after its process went away)
(1) User
(2) ComponentName
(3) Time
30036.am_provider_lost_process
当客户端正在等待内容提供程序,但其进程丢失时打印,包含参数:
( A client was waiting for a content provider, but its process was lost)
(1) User
(2) Package Name
(3) UID
(4) Name
30037.am_process_start_timeout
当activity manager放弃了一个新进程,启动时间太长时打印,包含参数:
(The activity manager gave up on a new process taking too long to start)
(1) User
(2) PID
(3) UID
(4) ProcessName
30039.am_crash
当crash时打印,包含参数:
( Unhandled exception)
(1) User
(2) PID
(3) ProcessName
(4) Flags
(5) Exception
(6) Message
(7) File
(8) Lir
打印地址:位于AMS.handleApplicationCrashInner
30040.am_wtf
当Log.wtf()被调用时打印,包含参数:
(Log.wtf() called)
(1) User
(2) PID
(3) ProcessName
(4) Flags
(5) Tag
(6) Message
打印地址:位于AMS.handleApplicationWtf
30041.am_switch_user
当切换用户时打印,包含参数:
(User switched)
(1) id
30042.am_activity_fully_drawn_time
当activity全部绘制时打印,包含参数:
(Activity fully drawn time)
(1) User
(2) Token
(3) ComponentName
(4) time
打印地址:位于ActivityRecord.reportFullyDrawnLocked, 后面两个参数分别是thisTime和 totalTime
30043.am_focused_activity
当activity获取焦点时打印,包含参数:
(Activity focused)
(1) User
(2) ComponentName
30044.am_home_stack_moved
打印,包含参数:
(1) User
(2) To Front
(3) Top Stack Id
(4) Focused Stack Id
(5) Reason
30045.am_pre_boot
当运行启动前打印,包含参数:
(Running pre boot receiver)
(1) User
(2) Package
30046.am_meminfo
全局内存状态的报告收集,包含参数:
( Report collection of global memory state)
(1) Cached
(2) Free
(3) Zram
(4) Kernel
(5) Native
30047.am_pss
一个进程使用过程中的内存使用情况,包含参数:
(Report collection of memory used by a process)
(1) Pid
(2) UID
(3) ProcessName
(4) Pss
(5) Uss