[Android][sensor][motion\stationary]动静传感器:静止待机时上层注册监听频繁触发sensor数据上报

储修谨
2023-12-01

动静传感器是两个sensor:stationary_detect和motion_detect

灭屏待机后,手机静止状态5秒左右循环触发sensor上报逻辑,即待机状态下抓取实时log发现有如下循环log打印:

07-21 03:44:31.568 13276 15319 I sensors-hal: handle_indication_realtime:356, SCHED_FIFO(10) for qmi_cbk
07-21 03:44:31.573 13276 13282 I sensors-hal: batch:140, android.sensor.stationary_detect/6, period=1000000, max_latency=0
07-21 03:44:31.574 13276 13282 I sensors-hal: batch:149, android.sensor.stationary_detect/6, period=1000000, max_latency=0 request completed
07-21 03:44:31.574 13276 13282 I sensors-hal: activate:107, android.sensor.stationary_detect/6 en=1
07-21 03:44:31.574 13276 13282 I sensors-hal: ssc_enable_rt_task:255, ssc_enable_rt_task : true
07-21 03:44:31.578 13276 13282 I sensors-hal: activate:118, android.sensor.stationary_detect/6 en=1 completed

高通SEE架构下qmi流程的motion和stationary上报有一个5s的保护机制。
但是从log看上层在不停地监听stationary detect,然后stationary detect就会一直进行上报(机器是在静止待机状态下,按理说,这样上报也没有问题,但是5s上报一次影响功耗,即会影响待机时长)

于是,上层不能连续监听stationary_detect,这就好比静止的时候上层在问下层是否静止,下层会一直回应是,即只报1(不会回应否),就会每隔5s不停上报stationary_detect

正常逻辑是:上层注册监听stationary_detect,如果静止,下层上报,然后上层解注册stationary,注册监听motion。即stationary和motion需要交叉注册监听。

 类似资料: