资料
待看
- www.cntofu.com/book/46/and…
- blog.csdn.net/weixin_4235…
- blog.csdn.net/weixin_3205…
- blog.csdn.net/servermanag…
- juejin.cn/post/705411…
- blog.csdn.net/weixin_4479…
- blog.csdn.net/chi_wy/arti…
- 如何分析activity生命周期的log
- 使用adb命令查看呢event_log
- Android 锁屏状态下启动应用很慢的原因分析
打印EventLog
adb logcat -b events
adb logcat -b events > eventlog.txt
完整语义明细
以 am_proc_start (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3) 为例
-
括号里格式如下: (属性名称|属性数据类型|属性数据单位)
-
属性数据类型
- 1: int
- 2: long
- 3: string
- 4: list
- 5: float
-
属性数据单位
- 1: Number of objects 对象个数
- 2: Number of bytes 字节数
- 3: Number of milliseconds 毫秒数
- 4: Number of allocations 分配数
- 5: Id
- 6: Percent 百分比
- s: Number of seconds (monotonic time) 系统启动以后流逝的时间/多少秒
-
实际例子 05-08 06:03:48.806 1176 1256 I am_proc_start: [0,1902,10131,com.android.systemui,service,{com.android.systemui/com.android.systemui.ImageWallpaper}]
am_proc_start (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3) 开始创建应用进程 : 用户ID是0, PID是1902, UID是10131, 进程名称是com.android.systemui, 进程类型是service, 组件是com.android.systemui/com.android.systemui.ImageWallpaper
ActivityManager相关
# See system/core/logcat/event.logtags for a description of the format of this file.
option java_package com.android.server.am
2719 configuration_changed (config mask|1|5)
2721 cpu (total|1|6),(user|1|6),(system|1|6),(iowait|1|6),(irq|1|6),(softirq|1|6)
# ActivityManagerService.systemReady() starts:
3040 boot_progress_ams_ready (time|2|3)
# ActivityManagerService calls enableScreenAfterBoot():
3050 boot_progress_enable_screen (time|2|3)
# Do not change these names without updating the checkin_events setting in
# google3/googledata/wireless/android/provisioning/gservices.config !!
#
# Application Not Responding
30008 am_anr (User|1|5),(pid|1|5),(Package Name|3),(Flags|1|5),(reason|3)
# Application process bound to work
30010 am_proc_bound (User|1|5),(PID|1|5),(Process Name|3)
# Application process died
30011 am_proc_died (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(ProcState|1|5)
# Application process has been started
30014 am_proc_start (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3),(Type|3),(Component|3)
# An application process has been marked as bad
30015 am_proc_bad (User|1|5),(UID|1|5),(Process Name|3)
# An application process that was bad is now marked as good
30016 am_proc_good (User|1|5),(UID|1|5),(Process Name|3)
# Reporting to applications that memory is low
30017 am_low_memory (Num Processes|1|1)
# Kill a process to reclaim memory.
30023 am_kill (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3)
# Discard an undelivered serialized broadcast (timeout/ANR/crash)
30024 am_broadcast_discard_filter (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(BroadcastFilter|1|5)
30025 am_broadcast_discard_app (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(App|3)
# A service is being created
30030 am_create_service (User|1|5),(Service Record|1|5),(Name|3),(UID|1|5),(PID|1|5)
# A service is being destroyed
30031 am_destroy_service (User|1|5),(Service Record|1|5),(PID|1|5)
# A process has crashed too many times, it is being cleared
30032 am_process_crashed_too_much (User|1|5),(Name|3),(PID|1|5)
# An unknown process is trying to attach to the activity manager
30033 am_drop_process (PID|1|5)
# A service has crashed too many times, it is being stopped
30034 am_service_crashed_too_much (User|1|5),(Crash Count|1|1),(Component Name|3),(PID|1|5)
# A service is going to be restarted after its process went away
30035 am_schedule_service_restart (User|1|5),(Component Name|3),(Time|2|3)
# A client was waiting for a content provider, but its process was lost
30036 am_provider_lost_process (User|1|5),(Package Name|3),(UID|1|5),(Name|3)
# The activity manager gave up on a new process taking too long to start
30037 am_process_start_timeout (User|1|5),(PID|1|5),(UID|1|5),(Process Name|3)
# Unhandled exception
30039 am_crash (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Exception|3),(Message|3),(File|3),(Line|1|5)
# Log.wtf() called
30040 am_wtf (User|1|5),(PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3)
# User switched
30041 am_switch_user (id|1|5)
# Running pre boot receiver
30045 am_pre_boot (User|1|5),(Package|3)
# Report collection of global memory state
30046 am_meminfo (Cached|2|2),(Free|2|2),(Zram|2|2),(Kernel|2|2),(Native|2|2)
# Report collection of memory used by a process
30047 am_pss (Pid|1|5),(UID|1|5),(Process Name|3),(Pss|2|2),(Uss|2|2),(SwapPss|2|2),(Rss|2|2),(StatType|1|5),(ProcState|1|5),(TimeToCollect|2|2)
# Report changing memory conditions (Values are ProcessStats.ADJ_MEM_FACTOR* constants)
30050 am_mem_factor (Current|1|5),(Previous|1|5)
# UserState has changed
30051 am_user_state_changed (id|1|5),(state|1|5)
# Note when any processes of a uid have started running
30052 am_uid_running (UID|1|5)
# Note when all processes of a uid have stopped.
30053 am_uid_stopped (UID|1|5)
# Note when the state of a uid has become active.
30054 am_uid_active (UID|1|5)
# Note when the state of a uid has become idle (background check enforced).
30055 am_uid_idle (UID|1|5)
# Note when a service is being forcibly stopped because its app went idle.
30056 am_stop_idle_service (UID|1|5),(Component Name|3)
# The task is being compacted
30063 am_compact (Pid|1|5),(Process Name|3),(Action|3),(BeforeRssTotal|2|2),(BeforeRssFile|2|2),(BeforeRssAnon|2|2),(BeforeRssSwap|2|2),(DeltaRssTotal|2|2),(DeltaRssFile|2|2),(DeltaRssAnon|2|2),(DeltaRssSwap|2|2),(Time|2|3),(LastAction|1|2),(LastActionTimestamp|2|3),(setAdj|1|2),(procState|1|2),(BeforeZRAMFree|2|2),(DeltaZRAMFree|2|2)
# The task is being frozen
30068 am_freeze (Pid|1|5),(Process Name|3)
# The task is being unfrozen
30069 am_unfreeze (Pid|1|5),(Process Name|3)
# User switch events
30070 uc_finish_user_unlocking (userId|1|5)
30071 uc_finish_user_unlocked (userId|1|5)
30072 uc_finish_user_unlocked_completed (userId|1|5)
30073 uc_finish_user_stopping (userId|1|5)
30074 uc_finish_user_stopped (userId|1|5)
30075 uc_switch_user (userId|1|5)
30076 uc_start_user_internal (userId|1|5)
30077 uc_unlock_user (userId|1|5)
30078 uc_finish_user_boot (userId|1|5)
30079 uc_dispatch_user_switch (oldUserId|1|5),(newUserId|1|5)
30080 uc_continue_user_switch (oldUserId|1|5),(newUserId|1|5)
30081 uc_send_user_broadcast (userId|1|5),(IntentAction|3)
# Tags below are used by SystemServiceManager - although it's technically part of am, these are
# also user switch events and useful to be analyzed together with events above.
30082 ssm_user_starting (userId|1|5)
30083 ssm_user_switching (oldUserId|1|5),(newUserId|1|5)
30084 ssm_user_unlocking (userId|1|5)
30085 ssm_user_unlocked (userId|1|5)
30086 ssm_user_stopping (userId|1|5)
30087 ssm_user_stopped (userId|1|5)
30088 ssm_user_completed_event (userId|1|5),(eventFlag|1|5)
# Foreground service start/stop events.
30100 am_foreground_service_start (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3)
30101 am_foreground_service_denied (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3)
30102 am_foreground_service_stop (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3)
1. Activity生命周期相关
am_create_activity|am_restart_activity|am_resume_activity|am_pause_activity|am_stop_activity|am_finish_activity|am_destroy_activity
am_on_create_called|am_on_restart_called|am_on_start_called|am_on_resume_called|am_on_paused_called|am_on_stop_called|am_on_destroy_called
-
am_create_activity|am_restart_activity|am_resume_activity|am_pause_activity|am_stop_activity|am_finish_activity|am_destroy_activity
-
am_on_create_called|am_on_restart_called|am_on_start_called|am_on_resume_called|am_on_paused_called|am_on_stop_called|am_on_destroy_called
- am_create_activity
- am_restart_activity
- am_resume_activity
- am_pause_activity
- am_stop_activity
- am_finish_activity
- am_destroy_activity
- am_on_create_called
- am_on_restart_called
- am_on_start_called
- am_on_resume_called
- am_on_paused_called
- am_on_stop_called
- am_on_destroy_called
2. 进程
完整查询:
am_proc_start|am_proc_bound|am_proc_died|am_proc_bad|am_proc_good|am_process_start_timeout|am_process_crashed_too_much|am_anr|am_kill|am_crash|am_low_memory
- am_proc_start|am_proc_bound|am_proc_died|am_proc_bad|am_proc_good|am_process_start_timeout
- am_proc_start
- 开始创建应用进程
- am_proc_bound
- 应用进程创建完毕
- am_proc_died
- 当进程死掉时打印
- am_proc_bad
- 当一个进程已经被标记成bad时打印
- am_proc_good
- 当一个bad的进程被标记为good时打印
- am_process_start_timeout
- activity manager放弃了一个新进程,启动时间太长时打印
- am_proc_start
- am_process_crashed_too_much
- 当一个进程崩溃了太多次,正在被清除时打印
- am_anr
- ANR
- am_kill
- 终止进程以回收内存时打印
- am_crash
- 当crash时打印
- am_low_memory
- 当进程收到内存低时打印
3. Service
- am_create_service|am_destroy_servic|am_schedule_service_restart|am_service_crashed_too_much
- am_create_service
- 当service被创建时打印
- am_destroy_service
- 当service被销毁时打印
- am_schedule_service_restart
- 当服务的进程结束后将重新启动时打印
- am_service_crashed_too_much
- 当服务崩溃太多次,正在停止时打印
- am_create_service
4. USER
- am_switch_user|am_user_state_changed
-
am_switch_user
- 用户切换
04-21 17:10:42.196 10015 10051 I ActivityManager: User 0 state changed from BOOTING to RUNNING_LOCKED 04-21 17:10:42.196 10015 10051 I am_user_state_changed: [0,1] -
am_user_state_changed
- 用户状态变更
05-08 06:03:53.614 1176 1255 I ActivityManager: User 10 state changed from BOOTING to RUNNING_LOCKED 05-08 06:03:53.614 1176 1255 I am_user_state_changed: [10,1] 05-08 06:03:54.273 1176 1246 I ActivityManager: User 10 state changed from RUNNING_LOCKED to RUNNING_UNLOCKING 05-08 06:03:54.273 1176 1246 I am_user_state_changed: [10,2] 05-08 06:03:54.367 1176 1255 I ActivityManager: User 10 state changed from RUNNING_UNLOCKING to RUNNING_UNLOCKED 05-08 06:03:54.367 1176 1255 I am_user_state_changed: [10,3]- 用户状态细分
***/Android/Sdk/sources/android-33/com/android/server/am/UserState.java public final class UserState { // User is first coming up. public final static int STATE_BOOTING = 0; // User is in the locked state. public final static int STATE_RUNNING_LOCKED = 1; // User is in the unlocking state. public final static int STATE_RUNNING_UNLOCKING = 2; // User is in the running state. public final static int STATE_RUNNING_UNLOCKED = 3; // User is in the initial process of being stopped. public final static int STATE_STOPPING = 4; // User is in the final phase of stopping, sending Intent.ACTION_SHUTDOWN. public final static int STATE_SHUTDOWN = 5; }
-
5. ContentProvider
- am_provider_lost_process
- 客户端正在等待ContentProvider,但ContentProvider所属进程已不存在
WindowManager相关
# See system/core/logcat/event.logtags for a description of the format of this file.
option java_package com.android.server.wm
# Do not change these names without updating the checkin_events setting in
# google3/googledata/wireless/android/provisioning/gservices.config !!
#
# An activity is being finished:
30001 wm_finish_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)
# A task is being brought to the front of the screen:
30002 wm_task_to_front (User|1|5),(Task|1|5)
# An existing activity is being given a new intent:
30003 wm_new_intent (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)
# A new task is being created:
30004 wm_create_task (User|1|5),(Task ID|1|5)
# A new activity is being created in an existing task:
30005 wm_create_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Action|3),(MIME Type|3),(URI|3),(Flags|1|5)
# An activity has been resumed into the foreground but was not already running:
30006 wm_restart_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# An activity has been resumed and is now in the foreground:
30007 wm_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# Activity launch time
30009 wm_activity_launch_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)
# The Activity Manager failed to pause the given activity.
30012 wm_failed_to_pause (User|1|5),(Token|1|5),(Wanting to pause|3),(Currently pausing|3)
# Attempting to pause the current activity
30013 wm_pause_activity (User|1|5),(Token|1|5),(Component Name|3),(User Leaving|3),(Reason|3)
# Application process has been started
# An activity is being destroyed:
30018 wm_destroy_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3),(Reason|3)
# An activity has been relaunched, resumed, and is now in the foreground:
30019 wm_relaunch_resume_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# An activity has been relaunched:
30020 wm_relaunch_activity (User|1|5),(Token|1|5),(Task ID|1|5),(Component Name|3)
# Activity set to resumed
30043 wm_set_resumed_activity (User|1|5),(Component Name|3),(Reason|3)
# Root task focus
30044 wm_focused_root_task (User|1|5),(Display Id|1|5),(Focused Root Task Id|1|5),(Last Focused Root Task Id|1|5),(Reason|3)
# Attempting to stop an activity
30048 wm_stop_activity (User|1|5),(Token|1|5),(Component Name|3)
# The task is being removed from its parent task
30061 wm_remove_task (Task ID|1|5), (Root Task ID|1|5)
# An activity been add into stopping list
30066 wm_add_to_stopping (User|1|5),(Token|1|5),(Component Name|3),(Reason|3)
# Keyguard status changed
30067 wm_set_keyguard_shown (Display Id|1|5),(keyguardShowing|1),(aodShowing|1),(keyguardGoingAway|1),(Reason|3)
# Out of memory for surfaces.
31000 wm_no_surface_memory (Window|3),(PID|1|5),(Operation|3)
# Task created.
31001 wm_task_created (TaskId|1|5),(RootTaskId|1|5)
# Task moved to top (1) or bottom (0).
31002 wm_task_moved (TaskId|1|5),(ToTop|1),(Index|1)
# Task removed with source explanation.
31003 wm_task_removed (TaskId|1|5),(Reason|3)
# bootanim finished:
31007 wm_boot_animation_done (time|2|3)
# Request surface flinger to show / hide the wallpaper surface.
33001 wm_wallpaper_surface (Display Id|1|5),(visible|1)
1. Activity生命周期相关
总体查询:
wm_create_activity|wm_restart_activity|wm_new_intent|wm_resume_activity|wm_pause_activity|wm_failed_to_pause|wm_finish_activity|wm_activity_launch_time|wm_destroy_activity|wm_relaunch_resume_activity|wm_relaunch_activity|wm_set_resumed_activity|wm_stop_activity|wm_add_to_stopping|wm_on_create_called|wm_on_restart_called|wm_on_start_called|wm_on_destroy_called|wm_on_activity_result_called|wm_on_paused_called|wm_on_resume_called|wm_on_stop_called|wm_on_top_resumed_gained_called|wm_on_top_resumed_lost_called
wm_create_activity|wm_restart_activity|wm_new_intent|wm_resume_activity|wm_pause_activity|wm_failed_to_pause|wm_finish_activity|wm_activity_launch_time|wm_destroy_activity|wm_relaunch_resume_activity|wm_relaunch_activity|wm_set_resumed_activity|wm_stop_activity|wm_add_to_stopping
- wm_create_activity|wm_restart_activity|wm_new_intent|wm_resume_activity|wm_pause_activity|wm_failed_to_pause|wm_finish_activity|wm_activity_launch_time|wm_destroy_activity|wm_relaunch_resume_activity|wm_relaunch_activity|wm_set_resumed_activity|wm_stop_activity|wm_add_to_stopping
-
wm_finish_activity
- 1个Activity正在被finish
-
wm_create_activity
- 在1个已存在的Activity栈中,1个Activity正在被创建
-
wm_resume_activity
- 1个Activity已经处于前台/Resume状态
-
wm_activity_launch_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)
- 1个Activity的启动时间
05-08 06:04:32.004 1176 1254 I wm_activity_launch_time: [10,97739848,***/.activity.TargetActivity,4660] -
wm_failed_to_pause (User|1|5),(Token|1|5),(Wanting to pause|3),(Currently pausing|3)
- ActivityManager暂停1个Activity失败
05-08 06:03:56.344 1176 1908 I wm_failed_to_pause: [0,28530921,***/.activity.TargetActivity,(none)] -
wm_add_to_stopping (User|1|5),(Token|1|5),(Component Name|3),(Reason|3)
- 1个Activity被加入到停止列表
05-08 06:05:27.114 1176 1244 I wm_add_to_stopping: [10,178804224,***/.TargetActivity,makeInvisible]
-
wm_on_create_called|wm_on_restart_called|wm_on_start_called|wm_on_destroy_called|wm_on_activity_result_called|wm_on_paused_called|wm_on_resume_called|wm_on_stop_called|wm_on_top_resumed_gained_called|wm_on_top_resumed_lost_called
- aospxref.com/android-13.…
- wm_on_create_called|wm_on_restart_called|wm_on_start_called|wm_on_destroy_called|wm_on_activity_result_called|wm_on_paused_called|wm_on_resume_called|wm_on_stop_called|wm_on_top_resumed_gained_called|wm_on_top_resumed_lost_called
- 以上tag是Activity特定生命周期函数被调用时打印
2. Task
- wm_task_created|wm_task_moved|wm_task_removed
-
wm_task_created (TaskId|1|5),(RootTaskId|1|5)
- Task被创建
05-08 06:03:52.994 1176 1841 I wm_task_created: [1000001,0] -
wm_task_moved (TaskId|1|5),(ToTop|1),(Index|1)
- Task移动到顶部(1)或底部(0)
05-08 06:04:56.802 1176 1244 I wm_task_moved: [1000001,1,2147483647] -
wm_task_removed (TaskId|1|5),(Reason|3)
- Task被移除
05-08 06:05:07.955 1176 1244 I wm_task_removed: [1000001,removeTask] 05-08 06:05:07.956 1176 1244 I wm_task_removed: [1000001,removeChild: last r=ActivityRecord{78aed5b u10 ***/.activity.1Activity t-1 f}} in t=Task{3f509d8 #1000001 visible=false type=home mode=fullscreen translucent=true A=1010073:*** U=10 StackId=1000001 sz=0}]
-
3. 内存
- wm_no_surface_memory
- wm_no_surface_memory (Window|3),(PID|1|5),(Operation|3)\
- surfaces内存溢出
- wm_no_surface_memory (Window|3),(PID|1|5),(Operation|3)\
4. 开机动画
- wm_boot_animation_done
-
wm_boot_animation_done (time|2|3)
- 开机动画结束
05-08 06:03:50.139 1176 1249 I WindowManager: ******* TELLING SURFACE FLINGER WE ARE BOOTED! 05-08 06:03:50.139 794 1155 I SurfaceFlinger: Boot is finished (12478 ms) 05-08 06:03:50.141 1176 1249 I wm_boot_animation_done: 23616 05-08 06:03:50.143 1176 1249 I ActivityManagerTiming: FinishBooting
-
Power相关
1. PowerManagerService相关
power_sleep_requested|power_screen_broadcast_send|power_screen_broadcast_done|power_screen_broadcast_stop|power_screen_state|power_partial_wake_state|power_soft_sleep_requested|battery_saver_mode|battery_saving_stats|user_activity_timeout_override|battery_saver_setting
- power_sleep_requested|power_screen_broadcast_send|power_screen_broadcast_done|power_screen_broadcast_stop|power_screen_state|power_partial_wake_state|power_soft_sleep_requested|battery_saver_mode|battery_saving_stats|user_activity_timeout_override|battery_saver_setting
-
power_sleep_requested (wakeLocksCleared|1|1)
- 当前设备被强制进入睡眠状态时候打印,例如用户按压电源键
-
power_soft_sleep_requested (savedwaketimems|2)
- 当前设备进入'待睡眠'状态时打印,会打印出还有多久进入睡眠状态
-
user_activity_timeout_override (override|2|3)
- Note when the user activity timeout has been overriden by ActivityManagerService
-
power_screen_state (offOrOn|1|5),(becauseOfUser|1|5),(totalTouchDownTime|2|3),(touchCycles|1|1),(latency|1|3)
- 屏幕被点亮或关闭时候打印 :首值1是on,0是off
//灭屏0 05-19 18:33:50.994 I/power_screen_state( 3183): [0,2,0,0,0] //亮屏1 05-19 19:27:08.883 I/power_screen_state( 3183): [1,0,0,0,967] -
power_screen_broadcast_send (wakelockCount|1|1)
- 亮屏广播发送完成之前打印
-
power_screen_broadcast_done (on|1|5),(broadcastDuration|2|3),(wakelockCount|1|1)
- 亮屏广播发送完成之后打印
-
power_partial_wake_state (releasedorAcquired|1|5),(tag|3)
- Partial wake locks 是 PowerManager API 中的一种机制。可让开发人员在设备显示屏关闭(无论是由于系统超时还是用户按下电源按钮)之后,继续让CPU保持运行状态
-
2. BatteryService相关
- battery_level|battery_status|battery_discharge
-
battery_level (level|1|6),(voltage|1|1),(temperature|1|1)
- 剩余电池容量(百分比)
- level :表示当前电池电量
- voltage : 表示当前电池电压
- temperature :表示当前电池温度
//剩余电量91%, 电池电压4.164v, 电池温度30.2℃ 11-19 06:15:40.076 1502 1538 I battery_level: [91,4164,302] 11-19 06:18:36.180 1502 2042 I battery_level: [90,4224,325] 11-19 06:26:30.404 1502 2042 I battery_level: [89,4203,338] -
battery_status (status|1|5),(health|1|5),(present|1|5),(plugged|1|5),(technology|3)
- status明细:电池充电状态 public static final int BATTERY_STATUS_UNKNOWN = 1; //充电中 public static final int BATTERY_STATUS_CHARGING = 2; //放电中 public static final int BATTERY_STATUS_DISCHARGING = 3; //未充电 public static final int BATTERY_STATUS_NOT_CHARGING = 4; //电池满 public static final int BATTERY_STATUS_FULL = 5;
- health明细 :电池健康状态 public static final int BATTERY_HEALTH_UNKNOWN = 1; //良好 public static final int BATTERY_HEALTH_GOOD = 2; //电池过热 public static final int BATTERY_HEALTH_OVERHEAT = 3; //电池没电 public static final int BATTERY_HEALTH_DEAD = 4; //电池电压过高 public static final int BATTERY_HEALTH_OVER_VOLTAGE = 5; //未知错误 public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; //电池过冷 public static final int BATTERY_HEALTH_COLD = 7;
- plugged明细 :充电类型 public static final int BATTERY_PLUGGED_NONE = 0; //充电器充电 public static final int BATTERY_PLUGGED_AC = 1; //USB充电 public static final int BATTERY_PLUGGED_USB = 2; //无线充电 public static final int BATTERY_PLUGGED_WIRELESS = 4; //移动电源充电 public static final int BATTERY_PLUGGED_DOCK = 8;
- present :是否存在电池
01-01 08:00:40.470 1000 1377 1505 I battery_status: [1,1,0,0,] 04-23 13:46:26.008 1000 8582 8639 I battery_status: [1,1,0,0,] -
battery_discharge (duration|2|3),(minLevel|1|6),(maxLevel|1|6)
- 电池之前至少经历过1次放电,且当前处于充电状态,且电池剩余电量发生变化,会打印.
- 用于记录电池从放电到充电状态的间隔时间
BatteryService.java // There's no value in this data unless we've discharged at least once and the // battery level has changed; so don't log until it does. if (mDischargeStartTime != 0 && mDischargeStartLevel != mHealthInfo.batteryLevel) { dischargeDuration = SystemClock.elapsedRealtime() - mDischargeStartTime; logOutlier = true; EventLog.writeEvent(EventLogTags.BATTERY_DISCHARGE, dischargeDuration, mDischargeStartLevel, mHealthInfo.batteryLevel); // make sure we see a discharge event before logging again mDischargeStartTime = 0; }
-
Notification相关
- notification_enqueue|notification_cancel|notification_cancel_all|notification_panel_revealed|notification_panel_hidden|notification_visibility_changed|notification_expansion|notification_clicked|notification_action_clicked|notification_canceled|notification_visibility|notification_alert|notification_autogrouped|notification_unautogrouped|notification_adjusted
-
notification_cancel_all (uid|1|5),(pid|1|5),(pkg|3),(userid|1|5),(required_flags|1),(forbidden_flags|1),(reason|1|5),(listener|3)
- 当有用户尝试取消特定包名的所有通知时打印
05-08 06:04:13.869 1176 1176 I notification_cancel_all: [1010119,5810,***.music,10,0,64,9,NULL] -
notification_canceled (key|3),(reason|1),(lifespan|1),(freshness|1),(exposure|1),(rank|1),(count|1),(listener|3)
- 当1个通知被取消时打印
05-08 06:03:51.562 1176 1176 I notification_canceled: [0|android|13|PreBootBroadcaster|1000,8,904,400,0,-1,-1,NULL] -
notification_enqueue (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3),(status|1)
- 当执行NotificationManager.notify时打印, 其中status: 0=post/发出1个通知, 1=update/更新1个通知, 2=ignored
//创建1个通知 05-08 06:04:03.670 1176 1176 I notification_enqueue: [1010119,5810,com.flyme.auto.music,1,NULL,10,Notification(channel=10000 shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0xff607d8b vis=PRIVATE),0] //更新1个通知 05-08 06:04:06.625 1176 1176 I notification_enqueue: [1010119,5511,com.flyme.auto.music,1,NULL,10,Notification(channel=10000 shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0xff607d8b vis=PRIVATE),1] -
notification_clicked (key|3),(lifespan|1),(freshness|1),(exposure|1),(rank|1),(count|1)
- 当1个通知被点击时打印
-
notification_action_clicked (key|3),(action_index|1),(lifespan|1),(freshness|1),(exposure|1),(rank|1),(count|1)
- 当1个通知的Action Button被点击时打印
-
Audio相关
-
volume_changed (stream|1), (prev_level|1), (level|1), (max_level|1), (caller|3)
- 音量改变
//小米手机 05-19 17:03:02.822 11930 11930 I Events : writeEvent show_dialog volume_changed keyguard=false