一、唤醒源
我们可以先从kernel的log看唤醒源:
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000 utc 02:55:43
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000 02:56:00
exit comip suspend by modem 0x00000000|0x00000000|0x00010000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000 02:56:32
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000 02:57:36
exit comip suspend by gpio99 10:57:41
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000 02:57:41
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000 02:59:43
exit comip suspend by gpio99 11:01:33
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by modem 0x00000004|0x00000000|0x00000000|0x00000000
exit comip suspend by gpio99 11:04:40 按power键
时间的话可以根据utc时间+8小时算出
二、AP侧主动唤醒
像gpio99这种是ap侧的唤醒,
既然ap侧唤醒我们再去看对应的Framework的log
10:57:41.018415 889 1086 V AlarmManager: sending alarm Alarm{8afbde3 type 0 when 1459997860411 android} ...
11:01:33.022557 889 1086 V AlarmManager: sending alarm Alarm{696553f type 2 when 695348 com.android.phone}...
11:04:40.023738 889 1093 I WindowManager: PowerKey down, interactive = false
...
04-07 11:04:40.031768 889 1093 I PowerManagerService: Waking up from sleep (uid 1000)...
04-07 11:04:40.033560 889 889 I WindowManager: Started waking up...
果然在10:57:41、11:01:33有两个alarm唤醒,alarm唤醒主要搜sending,但是一定要注意type为0,2才是唤醒的alarm。
另外11:04:40是power按键唤醒
三、modem唤醒源
而modem的唤醒,ap侧这边能分析什么呢?因为modem一般是有网络数据过来,才把AP侧唤醒,因此我们可以看tcp的数据包,对照时间来看这个唤醒的点,有哪些服务器的数据包发送过来。
我们可以使用Wireshark这个软件分析数据包。
步骤如下:
打开cap文件,先使用“ip.addr==”来过滤出这个ip地址的收发业务,然后用“Follow TCP stream”来做汇总,弹出的对话框中一般在头上会有一些访问的host等信息,再结合百度去搜,基本就能确定了是什么服务器发过来的数据;
我们结合唤醒点的时间,然后看这个点的数据包,就能看是哪个服务器发送数据过来,导致modem唤醒AP。