1. 现象
PowerMonitor灭屏发现持续长时间的大电流抬起,持续时间长达2分钟,导致灭屏待机电流高
2. BugReport分析
根据PowerMonitor的大电流抬起的的时间段,查看对应BatteryHistory的时间段发生了什么事件
JobScheduler
May 28 2019
17:35:33 - 17:38:44
+7m58s696ms to +11m09s202ms
active duration: 3m 10s 506ms
1 occurences
JobScheduler | Number of times | Total duration | Actual event times
DownloadManager:com.android.providers.downloads | 1 | 3m 10s 506ms | [17:35:33 - 17:38:44]
具体现象如下
上述中发现主要是downloads行为,故这里我们可以怀疑是不是在下载
3.查看net日志,看是否存在联网下载
这里主要查看 17:35:33 - 17:38:44 的net log日志,由于net日志没有最开始的17:35:33,但是可以发现这个时间段内 203.208.40.73 大量给手机推送数据,即 com.android.providers.downloads 存在大量下载
4 2019-05-28 17:35:47 203.208.40.73 10.92.48.181 SSLv2 1516 Encrypted Data
4. 查看联网源
4.1 mainlog查看 方法一
查看main.log日志
ws/pid/uid=WorkSource{10062}/1154/1000,其中10062 com.google.android.googlequicksearchbox
16,856: 05-28 17:35:52.341 1000 1154 1404 D PowerManagerService: No.0: PARTIAL_WAKE_LOCK '*job*/DownloadManager:com.android.providers.downloads'activated(lock=58109101, flags=1, uid=1000, pid=1154, total=18399ms)
17,141: 05-28 17:38:44.437 1000 1154 2540 D PowerManagerService: releaseWakeLockInternal: lock=58109101 [*job*/DownloadManager:com.android.providers.downloads], flags=0x0, total_time=190494ms, ws/pid/uid=WorkSource{10062}/1154/1000, packageName=android
05-28 17:29:38.629 1154 3575 D PowerManagerService: acquireWakeLockInternal: lock=68251967, flags=0x1, tag="*dexopt*", ws=WorkSource{10062}, uid=1000, pid=1154, packageName=android
05-28 17:29:38.678 1154 3575 I PackageManager.DexOptimizer: PERF skip dexopt pkg:com.google.android.googlequicksearchbox for DexFile.NO_DEXOPT_NEEDED
4.2 BugReport.txt 推荐
JobScheduler Jobs:
Ranking | Name | Uid | Duration / Hr | Count / Hr | Total Duration | Total Count
0 | com.google.android.googlequicksearchbox : DownloadManager:com.android.providers.downloads | 10062 | 6m59s837ms | 2.20 | 3m10.506s | 1
1 | ANDROID_SYSTEM : android/com.android.server.pm.BackgroundDexOptService | 1000 | 2s787ms | 2.20 | 1.265s | 1
2 | com.tct.weather : com.tct.weather/.service.UpdateScheduler | 10117 | 392ms | 4.41 | 178ms | 2
3 | ANDROID_SYSTEM : com.tct.onetouchbooster/.clean.server.SpeedCleanJobService | 1000 | 178ms | 6.61 | 81ms | 3
5.查看 com.google.android.googlequicksearchbox 下载详情
https://dl.google.com/dl/android/voice/en-us/v306/en-US-v306-f28.zip,我也下载了,大小差不多23.8MB.该大小也可以net日志对应
05-28 17:35:34.983 10041 2512 3753 I System.out: [socket] connection dl.google.com/203.208.40.73:443;LocalPort=-1(20000)
PROVIDER ContentProviderRecord{e413949 u0 com.android.providers.downloads/.DownloadProvider} pid=2512
Client:
Downloads updated in last hour:
Download #1:
_id=1
uri=https://https://dl.google.com/dl/android/voice/en-us/v306/en-US-v306-f28.zip/dl/android/voice/en-us/v306/en-US-v306-f28.zip?extraforlog=av%3A8.55.6.21.arm%3Bf%3A0%3Btv
%3A306%3Bpv%3A301%3Bs%3A2 method=0 entity=null no_integrity=null
hint=file:///storage/emulated/0/Android/data/com.google.android.googlequicksearchbox/files/download_cache/en-US-v306
-f28.zip otaupdate=null
_data=/storage/emulated/0/Android/data/com.google.android.googlequicksearchbox/files/download_cache/en-US-v306-f28.z
ip mimetype=application/zip destination=4 no_system=null visibility=2 control=null status=200 numfailed=0
lastmod=1559036324305 notificationpackage=com.google.android.googlequicksearchbox notificationclass=null
notificationextras=null useragent=null referer=null total_bytes=24999498 current_bytes=24999498 etag="1b7521"
uid=10062 otheruid=null title=Downloading English (US) description=Offline speech recognition data scanned=1
is_public_api=1 allow_roaming=1 allowed_network_types=-1 is_visible_in_downloads_ui=0
bypass_recommended_size_limit=0 mediaprovider_uri=content://media/external/file/37 deleted=0 errorMsg=null
allow_metered=0 allow_write=0 flags=0
上述的ip 203.208.40.73 对应域名dl.google.com
6. 总结
com.google.android.googlequicksearchbox 通过Job设定触发条件,通过系统的DownLoadProvider完成下载任务
7. 功耗优化建议
国内环境下,可以拦截掉该action,不然会影响国内功耗待机测试。或者第一次开机等久一些在进行测试用例的功耗测试。