If the looper is waking up, the current timeout limit is exceeded. There are no external APIs to query if a looper is trying to wake up or blocking to wait for the event data. Therefore, I'm this change and will replace the timeout with a significantly high number that could only be exceeded if sensor fails with a fatal problem. The goal is not to wait on ALooper_pollAll forever. This reverts commit 1575a42f33e3354db87760bcc8c9d951e35347dd. Change-Id: I861d81f2550c4435247a0b1d4ce141e94d1e3ec9 Reviewed-on: https://go-review.googlesource.com/8565 Reviewed-by: Burcu Dogan <jbd@google.com>
21 lines
708 B
C
21 lines
708 B
C
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
#ifndef SENSORS_ANDROID_H
|
|
#define SENSORS_ANDROID_H
|
|
|
|
typedef struct android_SensorManager {
|
|
ASensorEventQueue* queue;
|
|
ALooper* looper;
|
|
int looperId;
|
|
} android_SensorManager;
|
|
|
|
void android_createManager(int looperId, android_SensorManager* dst);
|
|
void android_destroyManager(android_SensorManager* m);
|
|
int android_enableSensor(ASensorEventQueue*, int, int32_t);
|
|
void android_disableSensor(ASensorEventQueue*, int);
|
|
int android_readQueue(int looperId, ASensorEventQueue* q, int n, int32_t* types, int64_t* timestamps, float* vectors);
|
|
|
|
#endif
|