目录
【背景】
【目标】
【ACTION】
【结果】
1、抓取正常情况和异常情况的bugreport进行分析对比
MwiRIL
KeyguardIndication
Nlpwakelock
2、使用唯一变量方法替换播放器进行对比
3、使用唯一变量方法替换蓝牙耳机进行测试验证
4、使用唯一变量方法替换手机进行验证(p0、p1、p2)
5、回退版本进行验证,验证工厂、native版本状态
6、确认正常情况下播放音乐是否存在功耗会跳变 10 +- 的情况
【背景】
手机连接小米蓝牙耳机青春版,使用小米音乐播放音乐,大概率出现功耗偏高到65ma往上的情况
【目标】
在使用小米蓝牙耳机青春版本连接手机播放音乐的时候功耗要稳定在62ma +- 1ma左右
【ACTION】
1、抓取正常情况和异常情况的bugreport进行分析对比
2、使用唯一变量方法替换播放器进行对比
3、使用唯一变量方法替换蓝牙耳机进行测试验证
4、使用唯一变量方法替换手机进行验证(p0、p1、p2)
5、回退版本进行验证、验证工厂、native版本状态
6、确认正常情况下播放音乐是否存在功耗会跳变 10 +- 的情况
【结果】
1、抓取正常情况和异常情况的bugreport进行分析对比
bugreport解析结果如下
Partial wakelock
Jun 29 2022
21:45:07 - 21:46:06
+2m57s375ms to +3m56s315ms
active duration: 58s 940ms
3 occurences
Wakelock_in | Number of times | Total duration | Actual event times
MwiRIL | 1 | 4m 41s 716ms | [21:42:10 - 21:46:51]
Doze:KeyguardIndication | 1 | 4m 45s 576ms | [21:42:10 - 21:46:55]
IntentOp:.common.broadcast.BackgroundBroadcastReceiverSupport$PersistentReceiverIntentOperation | 1 | 16ms | [21:46:06 - 21:46:06]
MwiRIL
属于radio进程,通话相关,和telephony-radio类型相同,在IDLE白名单中,系统休眠之后应该不会强制休眠
mDeviceIdleWhitelist=[1001, 2000, 10039, 10046, 10096, 10109, 10130, 10131]
UID 1001: ACTIVE count=0 state=0
06-30 04:30:14.271 - 1001 - ACQ *telephony-radio* (partial)
06-30 04:30:14.271 - 1001 - REL *telephony-radio*
06-30 04:30:57.348 - 1001 - ACQ *telephony-radio* (partial)
06-30 04:30:57.351 - 1001 - ACQ *telephony-radio* (partial)
06-30 04:30:57.351 - 1001 - REL *telephony-radio*
06-30 04:30:57.351 - 1001 - ACQ *telephony-radio* (partial)
06-30 04:30:57.371 - 1001 - ACQ RILJ_ACK_WL (partial)
06-30 04:30:57.375 - 1001 - ACQ RILJ_ACK_WL (partial)
06-30 04:30:57.520 - 1001 - REL *telephony-radio*
06-30 04:30:57.637 - 1001 - REL RILJ_ACK_WL
06-30 04:30:57.639 - 1001 - REL RILJ_ACK_WL
06-30 04:30:57.864 - 1001 - ACQ MwiRIL (partial)
06-30 04:30:57.881 - 1001 - REL MwiRIL
KeyguardIndication
音乐控制提示框在锁屏界面显示有个资源ID拿不到一直报错
06-30 05:42:17.170 10049 10038 10194 W System.err: java.lang.NoSuchFieldException: extraNotification
06-30 05:42:17.178 1000 473 495 I libPerfCtl: xgfGetFPS pid:9180 fps:60
06-30 05:42:17.188 10049 10038 10194 W System.err: at java.lang.Class.getField(Class.java:1635)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.notification.NotificationHelper.setEnableFloat(NotificationHelper.java:313)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.notification.NotificationHelper.buildMediaStyle(NotificationHelper.java:247)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.notification.NotificationHelper.build(NotificationHelper.java:91)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.service.MediaPlaybackService.startForegroundInternal(MediaPlaybackService.java:1910)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.service.MediaPlaybackService.play(MediaPlaybackService.java:1793)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.service.MediaPlaybackService.play(MediaPlaybackService.java:1739)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.service.ServiceStub.play(ServiceStub.java:177)
06-30 05:42:17.189 10049 10038 10194 W System.err: at com.miui.player.service.IMediaPlaybackService$Stub.onTransact(IMediaPlaybackService.java:406)
06-30 05:42:17.190 10049 10038 10194 W System.err: at android.os.Binder.execTransactInternal(Binder.java:1179)
06-30 05:42:17.190 10049 10038 10194 W System.err: at android.os.Binder.execTransact(Binder.java:1143)
06-30 05:42:17.197 10049 10038 10194 I MediaPlaybackService: startForegroundInternal already in foreground
06-30 05:42:17.198 10049 10038 10038 I MediaPlaybackService: notifyChange: what=com.miui.player.refreshprogress, extra=null
06-30 05:42:17.198 10049 10038 10038 I play : sendBroadcast what= com.miui.player.refreshprogress, extra = null
06-30 05:42:17.211 10049 10038 10038 I MediaPlaybackService: sendBroadcast:com.miui.player.refreshprogress
06-30 05:42:17.213 10049 10038 10038 E MediaPlaybackService: state: 3
06-30 05:42:17.219 1002 7938 7938 W AudioMediaPlayerWrapper: onPlaybackStateChanged(): com.miui.player tried to update with no new data
06-30 05:42:17.224 10049 10038 10038 I NotificationBuilder: getNotification notification, title=Au4_15min
06-30 05:42:17.243 10049 10038 10038 W System.err: java.lang.NoSuchFieldException: extraNotification
06-30 05:42:17.244 10049 10038 10038 W System.err: at java.lang.Class.getField(Class.java:1635)
06-30 05:42:17.251 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationHelper.setEnableFloat(NotificationHelper.java:313)
06-30 05:42:17.252 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationHelper.buildMediaStyle(NotificationHelper.java:247)
06-30 05:42:17.252 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationHelper.build(NotificationHelper.java:91)
06-30 05:42:17.252 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationHelper.notify(NotificationHelper.java:55)
06-30 05:42:17.252 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationBuilder.sendNotificationBarInternal(NotificationBuilder.java:69)
06-30 05:42:17.252 10049 9180 9180 I MediaPlaybackServicePro: onReceive
06-30 05:42:17.252 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationBuilder.access$100(NotificationBuilder.java:32)
06-30 05:42:17.252 10049 9180 9180 I MediaPlaybackServicePro: parseIntentToPlayingState start
06-30 05:42:17.252 10049 10038 10038 W System.err: at com.miui.player.notification.NotificationBuilder$1.handleMessage(NotificationBuilder.java:48)
06-30 05:42:17.252 10049 10038 10038 W System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
06-30 05:42:17.253 10049 10038 10038 W System.err: at android.os.Looper.loopOnce(Looper.java:201)
06-30 05:42:17.254 10049 10038 10038 W System.err: at android.os.Looper.loop(Looper.java:288)
06-30 05:42:17.254 10049 10038 10038 W System.err: at android.app.ActivityThread.main(ActivityThread.java:7881)
06-30 05:42:17.254 10049 10038 10038 W System.err: at java.lang.reflect.Method.invoke(Native Method)
06-30 05:42:17.255 10049 10038 10038 W System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
06-30 05:42:17.255 10049 10038 10038 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
06-30 05:42:17.255 10049 10038 10038 I NotificationHelper: notify notification, id=2
06-30 05:42:17.255 10049 9180 9180 I MediaPlaybackServicePro: parseIntentToPlayingState end
06-30 05:42:17.256 10049 9180 9180 I local : action = com.miui.player.refreshprogress,extra =null
06-30 05:42:17.256 10049 9180 9180 I AlbumObservable: action=com.miui.player.refreshprogress, extra=null
06-30 05:42:17.256 10049 9180 9180 I MediaPlaybackServicePro: notifyPlayChange time is 0
06-30 05:42:17.267 1000 509 509 I BufferQueueProducer: [com.miui.player/com.miui.player.playerui.NowPlayingActivity#0](this:0xadffcd4c,id:-1,api:0,p:-1,c:509) queueBuffer: fps=36.59 dur=1011.08 max=298.04 min=16.20
06-30 05:42:17.476 10134 1388 1388 E ndroid.systemu: No package ID ff found for ID 0xffffffff.
06-30 05:42:17.483 1000 509 509 I BufferQueueProducer: [StatusBar#0](this:0xae342d4c,id:-1,api:0,p:-1,c:509) queueBuffer: fps=3.24 dur=2470.02 max=2337.45 min=16.51
06-30 05:42:17.487 10134 1388 1388 E Icon : Unable to load resource 0xffffffff from pkg=com.miui.player
06-30 05:42:17.487 10134 1388 1388 E Icon : android.content.res.Resources$NotFoundException: Resource ID #0xffffffff
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:245)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.content.res.Resources.getDrawableForDensity(Resources.java:982)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.content.res.Resources.getDrawable(Resources.java:922)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.graphics.drawable.Icon.loadDrawableInner(Icon.java:388)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.graphics.drawable.Icon.loadDrawable(Icon.java:339)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.widget.ImageView.setImageIcon(ImageView.java:622)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaControlPanel.bindPlayer(MediaControlPanel.java:410)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaCarouselController.addOrUpdatePlayer(MediaCarouselController.kt:373)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaCarouselController.access$addOrUpdatePlayer(MediaCarouselController.kt:46)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaCarouselController$6.onMediaDataLoaded(MediaCarouselController.kt:214)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataManager$Listener$DefaultImpls.onMediaDataLoaded$default(MediaDataManager.kt:838)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataFilter.onMediaDataLoaded(MediaDataFilter.kt:105)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataManager$Listener$DefaultImpls.onMediaDataLoaded$default(MediaDataManager.kt:838)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataCombineLatest.update(MediaDataCombineLatest.kt:96)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataCombineLatest.onMediaDataLoaded(MediaDataCombineLatest.kt:42)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataManager$Listener$DefaultImpls.onMediaDataLoaded$default(MediaDataManager.kt:838)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.systemui.media.MediaSessionBasedFilter$dispatchMediaDataLoaded$1.run(MediaSessionBasedFilter.kt:174)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.os.Handler.handleCallback(Handler.java:938)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.os.Handler.dispatchMessage(Handler.java:99)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.os.Looper.loopOnce(Looper.java:201)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.os.Looper.loop(Looper.java:288)
06-30 05:42:17.487 10134 1388 1388 E Icon : at android.app.ActivityThread.main(ActivityThread.java:7881)
06-30 05:42:17.487 10134 1388 1388 E Icon : at java.lang.reflect.Method.invoke(Native Method)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
06-30 05:42:17.487 10134 1388 1388 E Icon : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
06-30 05:42:17.489 10134 1388 1388 E ndroid.systemu: No package ID ff found for ID 0xffffffff.
06-30 05:42:17.490 10134 1388 1388 E Icon : Unable to load resource 0xffffffff from pkg=com.miui.player
06-30 05:42:17.490 10134 1388 1388 E Icon : android.content.res.Resources$NotFoundException: Resource ID #0xffffffff
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:245)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.content.res.Resources.getDrawableForDensity(Resources.java:982)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.content.res.Resources.getDrawable(Resources.java:922)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.graphics.drawable.Icon.loadDrawableInner(Icon.java:388)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.graphics.drawable.Icon.loadDrawable(Icon.java:339)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.widget.ImageView.setImageIcon(ImageView.java:622)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaControlPanel.bindPlayer(MediaControlPanel.java:410)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaCarouselController.addOrUpdatePlayer(MediaCarouselController.kt:373)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaCarouselController.access$addOrUpdatePlayer(MediaCarouselController.kt:46)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaCarouselController$6.onMediaDataLoaded(MediaCarouselController.kt:214)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataManager$Listener$DefaultImpls.onMediaDataLoaded$default(MediaDataManager.kt:838)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataFilter.onMediaDataLoaded(MediaDataFilter.kt:105)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataManager$Listener$DefaultImpls.onMediaDataLoaded$default(MediaDataManager.kt:838)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataCombineLatest.update(MediaDataCombineLatest.kt:96)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataCombineLatest.onMediaDataLoaded(MediaDataCombineLatest.kt:42)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaDataManager$Listener$DefaultImpls.onMediaDataLoaded$default(MediaDataManager.kt:838)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.systemui.media.MediaSessionBasedFilter$dispatchMediaDataLoaded$1.run(MediaSessionBasedFilter.kt:174)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.os.Handler.handleCallback(Handler.java:938)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.os.Handler.dispatchMessage(Handler.java:99)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.os.Looper.loopOnce(Looper.java:201)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.os.Looper.loop(Looper.java:288)
06-30 05:42:17.490 10134 1388 1388 E Icon : at android.app.ActivityThread.main(ActivityThread.java:7881)
06-30 05:42:17.490 10134 1388 1388 E Icon : at java.lang.reflect.Method.invoke(Native Method)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
06-30 05:42:17.490 10134 1388 1388 E Icon : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Nlpwakelock
是 Google 服务框架用来做 位置历史记录 wifi 定位上报 等相关工作的,也处于IDLE白名单中,系统休眠之后应该不会强制休眠,参考文档如下
https://www.nuomiphp.com/t/60e144d71707be6d4c6442ba.html
Line 4780: mDeviceIdleWhitelist=[1001, 2000, 10039, 10046, 10096, 10109, 10130, 10131]
Line 5491: 06-30 02:51:39.916 - 10109 - ACQ Wakeful StateMachine: GeofencerStateMachine (partial)
Line 5492: 06-30 02:51:39.920 - 10109 - REL Wakeful StateMachine: GeofencerStateMachine
Line 5493: 06-30 02:51:39.923 - 10109 - ACQ NlpWakeLock (partial)
Line 5494: 06-30 02:51:39.944 - 10109 - REL NlpWakeLock
Line 5508: 06-30 02:51:43.591 - 10109 - ACQ Wakeful StateMachine: GeofencerStateMachine (partial)
Line 5512: 06-30 02:51:43.610 - 10109 - REL Wakeful StateMachine: GeofencerStateMachine
Line 5514: 06-30 02:51:43.612 - 10109 - ACQ NlpWakeLock (partial)
Line 5515: 06-30 02:51:43.622 - 10109 - REL NlpWakeLock
2、使用唯一变量方法替换播放器进行对比
换了其他三方的音乐播放器也存在这个问题
3、使用唯一变量方法替换蓝牙耳机进行测试验证
使用P1的机器刷6.27版本+amoif9耳机测试6次数据是在56-65ma之间
使用P1的机器刷6.27版本+小米项圈耳机青春版测试数据在62-71之间
4、使用唯一变量方法替换手机进行验证(p0、p1、p2)
使用不同批次的手机都能复现此问题
5、回退版本进行验证,验证工厂、native版本状态
目前正式版本没有一个是正常的;工厂版本、native版本待验证
6、确认正常情况下播放音乐是否存在功耗会跳变 10 +- 的情况
不连接蓝牙耳机的情况下播放音乐不会出现功耗跳变的情况