问题描述
VtsHalSensorsV2_0Target
VtsHalSensorsV2_0Target#SensorsHidlTest.FlushSensor(default)_32bit
Fail:
hardware/interfaces/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp:730
Expected equality of these values:
callback.getFlushCount(sensor.sensorHandle)
Which is: 0
expectedFlushCount
Which is: 5
解决方案
1.没有使用pick up sensor(很少有function用到此功能)的情况下:
在projectconfig中注释掉上述宏控即可
在ProjectConfig.mk 中去掉 CUSTOM_KERNEL_PICK_UP_SENSOR
2.使用pick up sensor的情况下:
ex:这个sensor 用于抬起亮屏
如果是MTK算法,直接关掉.
如果三方算法,需要第三方处理并做以下修改:
/kernel-4.14/drivers/misc/mediatek/sensors-1.0/situation/pickup_gesture/pickup_gesture.c
{
int err = 0;
if (event->flush_action == FLUSH_ACTION)
--- pr_debug("pickup_gesture do not support flush\n");
+++ situation_flush_report(ID_PICK_UP_GESTURE);
else if (event->flush_action == DATA_ACTION)
err = situation_notify_t(ID_PICK_UP_GESTURE,
(int64_t)event->time_stamp);
return err;
}
/vendor/mediatek/proprietary/hardware/sensor/sensors-1.0/Situation.cpp
case ID_PICK_UP_GESTURE:
if (event->flush_action == DATA_ACTION) {
mPendingEvent.version = sizeof(sensors_event_t);
mPendingEvent.sensor = ID_PICK_UP_GESTURE;
mPendingEvent.type = SENSOR_TYPE_PICK_UP_GESTURE;
if (event->time_stamp)
mPendingEvent.timestamp = event->time_stamp;
else
mPendingEvent.timestamp = android::elapsedRealtimeNano();
mPendingEvent.data[0] = (float) event->word[0];
--- }
+++ }else if (event->flush_action == FLUSH_ACTION) {
+++ mPendingEvent.version = META_DATA_VERSION;
+++ mPendingEvent.sensor = 0;
+++ mPendingEvent.type = SENSOR_TYPE_META_DATA;
+++ mPendingEvent.meta_data.what = META_DATA_FLUSH_COMPLETE;
+++ mPendingEvent.meta_data.sensor = ID_PICK_UP_GESTURE;
+++ // must fill timestamp, if not, readEvents may can not report flush to framework
+++ mPendingEvent.timestamp = android::elapsedRealtimeNano() + IGNORE_EVENT_TIME;
}
break;