@505113236 写道:
Creator 版本:2.2.0
目标平台: Android
- 详细报错信息,包含调用堆栈:
打开游戏,触发音效,切到后台,过滤"wake lock"的信息:
2020-01-05 11:34:44.271 1519-1598/? I/PowerManagerService: [PWL] PARTIAL_WAKE_LOCK 'AudioMix' ACQ=-10m21s276ms LONG (uid=1041 ws=WorkSource{10896})
2020-01-05 11:35:44.565 1519-1796/? I/BarTender:ANALYZERWAKELOCK: MSG_TYPE_WAKELOCK_FIND_ABUSIVE: abusive found:tag=AudioMix packageName=audioserver uid=1041, pid=0, ws=WorkSource{10896} mPolicy=1
_acquireTimeTotal=681568 reason=Audio wakelock is held but no music or recording com.xxx.xxx(手动隐藏)_
count=1 ctgr=Audio state=PER2020-01-05 11:35:44.569 1519-1796/? I/BarTender:ANALYZERBATTSTATS: Observer from Controller - type: wlock list:[com.xxx.xxx(手动隐藏),tag=AudioMix packageName=audioserver uid=1041, pid=0, ws=WorkSource{10896} mPolicy=1
**acquireTimeTotal=681568 reason=Audio wakelock is held but no music or recording com.xxx.xxx(手动隐藏)**
count=1 ctgr=Audio state=PER]2020-01-05 11:36:04.274 1519-1598/? I/PowerManagerService: [PWL] PARTIAL_WAKE_LOCK 'AudioMix' ACQ=-11m41s278ms LONG (uid=1041 ws=WorkSource{10896})
2020-01-05 11:37:29.300 1519-1598/? I/PowerManagerService: [PWL] PARTIAL_WAKE_LOCK 'AudioMix' ACQ=-13m6s305ms LONG (uid=1041 ws=WorkSource{10896})
2020-01-05 11:38:59.312 1519-1598/? I/PowerManagerService: [PWL] PARTIAL_WAKE_LOCK 'AudioMix' ACQ=-14m36s317ms LONG (uid=1041 ws=WorkSource{10896})
- 重现方式:
由于demo包体过大,所以直接丢在github仓库上了,还麻烦下载一下,
github仓库地址: https://github.com/w1365988550/wake-log-demo1. 手机开启USB调试; 2. 安装demo.apk; 3. 打开游戏,点击按钮播放音效,切到后台即可; 4. 在android studio的logcat中搜索wake lock,或cmd执行adb shell dumpsys power --charged 搜索wake lock; 可以看到一个关于'AudioMix'的PARTIAL_WAKE_LOCK长期没有被释放。
之前哪个版本是正常的 :无。首次使用2.2.0打包,未使用过其他版本。
出现概率:demo必现。
- 额外线索:
该问题最早在google play console中Android vitals被统计到,超过0.1%的出现阈值就会提示存在Stuck partial wake locks (background)的不良行为,直接影响在应用的搜索排名,如图。
cocos2dx论坛中有类似发帖,但并未解决问题:
android官方文档:
https://developer.android.com/topic/performance/vitals/wakelock.html
https://source.android.com/devices/tech/debug/dumpsys
帖子: 1
参与者: 1