Only log dropped events every two seconds
If a device enters a state where the Sensor Event Connection's cache
is full, it would generate a log for every new event it received which
led to a large number of logs. This patch rate-limits how often the
dropped event log line is output and summarizes the number of events
that were dropped.
Bug: 120790102
Test: Builds, verified log was generated at most once every two
seconds per SensorEventConnection
Change-Id: I61d84bc15dd72d5d36d250ce40ace200d549a6c0
diff --git a/services/sensorservice/SensorEventConnection.h b/services/sensorservice/SensorEventConnection.h
index eefd81a..061809f 100644
--- a/services/sensorservice/SensorEventConnection.h
+++ b/services/sensorservice/SensorEventConnection.h
@@ -165,6 +165,8 @@
sensors_event_t *mEventCache;
int mCacheSize, mMaxCacheSize;
+ int64_t mTimeOfLastEventDrop;
+ int mEventsDropped;
String8 mPackageName;
const String16 mOpPackageName;
#if DEBUG_CONNECTIONS