summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.h
diff options
context:
space:
mode:
authorAravind Akella <aakella@google.com>2015-06-18 14:18:28 -0700
committerAravind Akella <aakella@google.com>2015-06-18 14:24:05 -0700
commit18d6d51a00897988e3347b130f533e9ffdd8c365 (patch)
tree4d705069e75f46b3956c47a688de2ae5435c8baf /services/sensorservice/SensorService.h
parent8f37aa5011bf5d8c0a67126b92e3b435ffd4dca0 (diff)
downloadframeworks_native-18d6d51a00897988e3347b130f533e9ffdd8c365.zip
frameworks_native-18d6d51a00897988e3347b130f533e9ffdd8c365.tar.gz
frameworks_native-18d6d51a00897988e3347b130f533e9ffdd8c365.tar.bz2
More information in sensor bugreports.
i) Log last 20 activations/deactivations of sensors. ii) Increase logging upto 50 events for accelerometer, step_counter and significant motion. Change-Id: I3966ed0abda8b705f3d16e94a9370fa1b97baa57
Diffstat (limited to 'services/sensorservice/SensorService.h')
-rw-r--r--services/sensorservice/SensorService.h37
1 files changed, 25 insertions, 12 deletions
diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h
index 7c466c1..0a7abe8 100644
--- a/services/sensorservice/SensorService.h
+++ b/services/sensorservice/SensorService.h
@@ -54,6 +54,7 @@
#define SOCKET_BUFFER_SIZE_NON_BATCHED 4 * 1024
#define CIRCULAR_BUF_SIZE 10
+#define SENSOR_REGISTRATIONS_BUF_SIZE 20
struct sensors_poll_device_t;
struct sensors_module_t;
@@ -272,18 +273,8 @@ class SensorService :
// for debugging.
int32_t mHour, mMin, mSec;
- TrimmedSensorEvent(int numData, int sensorType) {
- mTimestamp = -1;
- if (sensorType == SENSOR_TYPE_STEP_COUNTER) {
- mStepCounter = 0;
- } else {
- mData = new float[numData];
- for (int i = 0; i < numData; ++i) {
- mData[i] = -1.0;
- }
- }
- mHour = mMin = mSec = 0;
- }
+ TrimmedSensorEvent(int sensorType);
+ static bool isSentinel(const TrimmedSensorEvent& event);
~TrimmedSensorEvent() {
delete [] mData;
@@ -297,6 +288,7 @@ class SensorService :
class CircularBuffer {
int mNextInd;
int mSensorType;
+ int mBufSize;
TrimmedSensorEvent ** mTrimmedSensorEventArr;
public:
CircularBuffer(int sensor_event_type);
@@ -306,6 +298,25 @@ class SensorService :
~CircularBuffer();
};
+ struct SensorRegistrationInfo {
+ int32_t mSensorHandle;
+ String8 mPackageName;
+ bool mActivated;
+ int32_t mSamplingRateUs;
+ int32_t mMaxReportLatencyUs;
+ int32_t mHour, mMin, mSec;
+
+ SensorRegistrationInfo() : mPackageName() {
+ mSensorHandle = mSamplingRateUs = mMaxReportLatencyUs = INT32_MIN;
+ mHour = mMin = mSec = INT32_MIN;
+ mActivated = false;
+ }
+
+ static bool isSentinel(const SensorRegistrationInfo& info) {
+ return (info.mHour == INT32_MIN && info.mMin == INT32_MIN && info.mSec == INT32_MIN);
+ }
+ };
+
static int getNumEventsForSensorType(int sensor_event_type);
String8 getSensorName(int handle) const;
bool isVirtualSensor(int handle) const;
@@ -387,6 +398,8 @@ class SensorService :
// The size of this vector is constant, only the items are mutable
KeyedVector<int32_t, CircularBuffer *> mLastEventSeen;
+ int mNextSensorRegIndex;
+ Vector<SensorRegistrationInfo> mLastNSensorRegistrations;
public:
void cleanupConnection(SensorEventConnection* connection);
status_t enable(const sp<SensorEventConnection>& connection, int handle,