关机重启流程原因https://blog.csdn.net/a396604593/article/details/125640406
systemui关机dialoghttps://blog.csdn.net/a396604593/article/details/131092232
1、找到最后一行monkey的log。
发现monkey正常下发事件,自身没有crash
06-04 23:23:38.305 2098 15002 V ShutdownTiming: SendShutdownBroadcast took to complete: 947ms
06-04 23:23:38.305 2098 15002 I ShutdownThread: Shutting down activity manager...
06-04 23:23:38.307 2793 2955 I QCC:JobManager: isLegacyReq ret: false
06-04 23:23:38.307 2793 2955 I QCC:JobService: getMd5Key= 6fff4c679c295ed3f462722ac2b30f17
06-04 23:23:38.308 2793 2955 I QCC:JobService: cancellation request, retKey: 6fff4c679c295ed3f462722ac2b30f17, ver: 13.0, tnx :13
06-04 23:23:38.308 2793 2955 I QCC:JobManager: cancelJobPeriodic clientId: 200
06-04 23:23:38.309 2793 2955 I QCC:JobManager: cancelRequest remove the job
06-04 23:23:38.311 2793 2955 I QCC:JobScheduler: cancelScheduler jobType:5
06-04 23:23:38.314 2098 5235 W InputManager: Input event injection from pid 24736 failed.
06-04 23:23:38.315 24736 24736 I Monkey : // Injection Failed
06-04 23:23:38.316 24736 24736 I Monkey : Sleeping for 500 milliseconds
2、ShutdownThread
发现monkey log前有ShutdownThread相关log,怀疑设备重启导致monkey停掉。
3、找测试抓系统属性
[persist.sys.boot.reason.history]: [reboot,userrequested,1685921077 reboot,userrequested,1685460643 reboot,shell,2940]
最后2次重启都是的原因用户请求
1685921077 === 2023-06-05 07:24:37
1685460643 === 2023-05-30 23:30:43
4、ShutdownCheckPoints
//2435调用系统关机接口
06-04 23:23:37.261 2098 16127 V ShutdownCheckPoints: Binder shutdown checkpoint recorded with pid=2435
06-04 23:23:37.275 2098 2098 V ShutdownCheckPoints: System server shutdown checkpoint recorded
//
06-04 23:23:37.278 2098 2098 D ShutdownThread: Notifying thread to start shutdown longPressBehavior=5
//关机动画
06-04 23:23:37.284 2098 2098 D ShutdownThread: Attempting to use SysUI shutdown UI
06-04 23:23:37.285 2098 2098 D ShutdownThread: SysUI handling shutdown UI
//关机前log信息
06-04 23:23:37.326 2098 15002 I ShutdownThread: Logging pre-reboot information...
5、systemui 下拉后点击关机按钮弹出dialog
06-04 23:23:36.128 2435 2435 W DialogLaunchAnimator: A dialog was launched from a View that does not implement LaunchableView. This can lead to subtle bugs where the visibility of the View we are launching from is not what we expected.
6、monkey点击 534,1360这个点
06-04 23:23:37.133 24736 24736 I Monkey : :Sending Touch (ACTION_DOWN): 0:(544.0,1372.0)
06-04 23:23:37.137 24736 24736 I Monkey : :Sending Touch (ACTION_MOVE): 0:(537.3437,1367.299)
06-04 23:23:37.144 24736 24736 I Monkey : :Sending Touch (ACTION_UP): 0:(534.91095,1360.306)
06-04 23:23:37.146 24736 24736 I Monkey : Sleeping for 500 milliseconds
7、打开开发者选项中的触摸位置按钮后,发现这个点在restart按钮上
8、关机重启dialog消失log
06-04 23:23:37.151 2435 2435 I DialogLaunchAnimator: Skipping animation of dialog into the touch surface
9、关机流程log
对应上面的ShutdownCheckPoints
06-04 23:23:37.261 2098 16127 V ShutdownCheckPoints: Binder shutdown checkpoint recorded with pid=2435
06-04 23:23:37.275 2098 2098 V ShutdownCheckPoints: System server shutdown checkpoint recorded
结论
由此分析得出,monkey点击到了重启按钮,导致重启。
修改方案见https://blog.csdn.net/a396604593/article/details/131092232